Collections:
Define a Sub Function in Oracle
How To Define a Sub Function in Oracle?
✍: FYIcenter.com
A sub function is a function defined and used inside another procedure or function. You need to define a sub function in the declaration part of the enclosing procedure or function. Sub function definition starts with the FUNCTION key word. Here is a sample script showing you how to define and use a sub function:
SQL> CREATE OR REPLACE PROCEDURE SUM_TEST AS
2 FUNCTION MY_SUM(X NUMBER, Y NUMBER)
3 RETURN NUMBER AS
4 BEGIN
5 RETURN X + Y;
6 END;
7 BEGIN
8 DBMS_OUTPUT.PUT_LINE('3 + 5 = ' ||
9 TO_CHAR(MY_SUM(3,5)));
10 DBMS_OUTPUT.PUT_LINE('5 + 3 = ' ||
11 TO_CHAR(MY_SUM(5,3)));
12 END;
13 /
SQL> EXECUTE SUM_TEST;
3 + 5 = 8
5 + 3 = 8
⇒ Call Procedure or Function Recursively in Oracle
⇐ Call a Sub Procedure in Oracle
2018-03-18, 2844🔥, 0💬
Popular Posts:
How to calculate the storage size of a JSON (JavaScript Object Notation) value using the JSON_STORAG...
Where to find answers to frequently asked questions on Storage Engines: MyISAM, InnoDB and BDB in My...
What Privilege Is Needed for a User to Delete Rows from Tables in Another Schema in Oracle? For a us...
How To Use "IF ... ELSE IF ..." Statement Structures in SQL Server Transact-SQL? "IF ... ELSE IF ......
How To Calculate Age in Days, Hours and Minutes in SQL Server Transact-SQL? On many Web sites, news ...