Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How To Define a Sub Function?

define function sub
0
10 Posted

How To Define a Sub Function?

0

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 AS2 FUNCTION MY_SUM(X NUMBER, Y NUMBER)3 RETURN NUMBER AS4 BEGIN5 RETURN X + Y;6 END;7 BEGIN8 DBMS_OUTPUT.PUT_LINE(’3 + 5 = ‘ || TO_CHAR(MY_SUM(3,5)));9 DBMS_OUTPUT.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.