Collections:
What Are Named Parameters in Oracle
What Are Named Parameters in Oracle?
✍: FYIcenter.com
Named parameters are actual parameters specified not by position but by providing formal parameter names when calling the procedure or function. The main advantage of named parameters is that the caller don't have to remember the position of each parameter. But the caller have to remember the formal parameter names. The script below illustrates how to use named parameters:
SQL> CREATE OR REPLACE PROCEDURE SWAP_TEST AS
2 A NUMBER := 3;
3 B NUMBER := 8;
4 PROCEDURE MY_SWAP(X IN OUT NUMBER,Y IN OUT NUMBER) AS
5 T NUMBER;
6 BEGIN
7 T := X;
8 X := Y;
9 Y := T;
10 END MY_SWAP;
11 BEGIN
12 MY_SWAP(Y=>B, X=>A); -- same as (X=>A, Y=B), OR (A,B)
13 DBMS_OUTPUT.PUT_LINE('A = ' || TO_CHAR(A));
14 DBMS_OUTPUT.PUT_LINE('B = ' || TO_CHAR(B));
15 END;
16 /
SQL> EXECUTE SWAP_TEST;
A = 8
B = 3
⇒ Scope of Local Variables in Oracle
⇐ Define Default Values for Formal Parameters in Oracle
2018-10-13, 3017🔥, 0💬
Popular Posts:
Where to find answers to frequently asked questions I am new to Oracle database. Here is a list of f...
What Is an Oracle Instance in Oracle? Every running Oracle database is associated with an Oracle ins...
How To Verify a User name with SQLCMD Tool in SQL Server? The quickest way to verify a user name in ...
How To Convert Numeric Expression Data Types using the CAST() Function in SQL Server Transact-SQL? I...
How To Convert Characters to Numbers in Oracle? You can convert characters to numbers by using the T...