Join the OracleApps88 Telegram group @OracleApps88to get more information on Oracle EBS R12/Oracle Fusion applications.

If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.

Saturday, January 24, 2015

Parametrized Function example in PL/SQL

CREATE OR REPLACE FUNCTION vma_find_area (l   IN NUMBER,
                                          w   IN NUMBER DEFAULT 30)
   RETURN NUMBER
AS
   a   NUMBER;
BEGIN
   a := w * l;
   RETURN a;
END;

-- Different ways to call--
DECLARE
   a   NUMBER := 0;
BEGIN
   a := vma_find_area (10, 10);              --Positional notations/parameters
   DBMS_OUTPUT.put_line ('The product is ...' || a);

   a := vma_find_area (w => 20, l => 10); --named notations/parameters here order is not imp
   DBMS_OUTPUT.put_line ('The product is ...' || a);

   a := vma_find_area (20, w => 20); --Mixed notations/parameters here order is important first positional and then Named.
   DBMS_OUTPUT.put_line ('The product is ...' || a);

   a := vma_find_area (l => 10);                --Default notations/parameters
   DBMS_OUTPUT.put_line ('The product is ...' || a);
END;

/

No comments:

Post a Comment

If you are facing any issues while copying the Code/Script or any issues with Posts, Please send a mail to OracleApp88@Yahoo.com or message me at @apps88 or +91 905 957 4321 in telegram.
Best Blogger TipsGet Flower Effect