Set Up Demonstration Procedure
CREATE OR REPLACE PROCEDURE named_notation_demo (
only_in IN NUMBER,
in_and_out IN OUT NUMBER,
internal_in_with_default IN DATE DEFAULT SYSDATE,
only_out OUT NUMBER,
trailing_in_with_default IN VARCHAR2 DEFAULT 'WHENEVER POSSIBLE')
IS
BEGIN
DBMS_OUTPUT.put_line ('only_in' || only_in);
DBMS_OUTPUT.put_line ('in_and_out ' || in_and_out);
DBMS_OUTPUT.put_line (
'internal_in_with_default ' || TO_CHAR (internal_in_with_default));
DBMS_OUTPUT.put_line (
'trailing_in_with_default ' || TO_CHAR (trailing_in_with_default));
only_out := 100000000;
END;
Procedure created.
All the Combinations
DECLARE
n_inout NUMBER := 100000;
n_out NUMBER;
BEGIN
/* All positional notation */
named_notation_demo (50000000,
n_inout,
SYSDATE + 20,
n_out,
'Don''t have to provide this');
/* All positional notation, minimum number of values */
named_notation_demo (50000000,
n_inout,
SYSDATE + 20,
n_out);
/* All named notation, original order. */
named_notation_demo (only_in => 50000000,
in_and_out => n_inout,
internal_in_with_default => SYSDATE - 100,
only_out => n_out);
/* Skip all IN parameters with default values. */
named_notation_demo (only_in => 50000000,
in_and_out => n_inout,
only_out => n_out);
/* Change order with named notation, partial list. */
named_notation_demo (only_out => n_out,
internal_in_with_default => SYSDATE + 20,
only_in => 50000000,
in_and_out => n_inout);
/* Blend positional and named notation. You can start
with positional, but once you switch to named
notation, you can't go back to positional. */
named_notation_demo (50000000,
n_inout,
internal_in_with_default => SYSDATE + 200,
only_out => n_out);
END;
only_in50000000
in_and_out 100000
internal_in_with_default 07-AUG-16
trailing_in_with_default Don't have to provide this
only_in50000000
in_and_out 100000
internal_in_with_default 07-AUG-16
trailing_in_with_default WHENEVER POSSIBLE
only_in50000000
in_and_out 100000
internal_in_with_default 09-APR-16
trailing_in_with_default WHENEVER POSSIBLE
only_in50000000
in_and_out 100000
internal_in_with_default 18-JUL-16
trailing_in_with_default WHENEVER POSSIBLE
only_in50000000
in_and_out 100000
internal_in_with_default 07-AUG-16
trailing_in_with_default WHENEVER POSSIBLE
only_in50000000
in_and_out 100000
internal_in_with_default 03-FEB-17
trailing_in_with_default WHENEVER POSSIBLE