Calling myProc : Out Parameters « Function Procedure Packages « Oracle PL/SQL Tutorial






SQL>
SQL> set serveroutput on
SQL>
SQL> CREATE OR REPLACE PROCEDURE myProc(ip_line_length IN NUMBER,ip_separator IN VARCHAR2,op_line OUT VARCHAR2)
  2  IS
  3    myString VARCHAR2(150);
  4  BEGIN
  5
  6    FOR idx in 1..ip_line_length LOOP
  7
  8      myString :=myString ||ip_separator;
  9
 10    END LOOP;
 11
 12    op_line :=myString;
 13
 14  EXCEPTION WHEN OTHERS THEN
 15
 16    dbms_output.put_line(SQLERRM);
 17
 18    op_line :=null;
 19  END;
 20  /

Procedure created.

SQL>
SQL>
SQL> DECLARE
  2    v_length NUMBER :=50;
  3
  4    v_separator VARCHAR2(1):='=';
  5
  6    v_line VARCHAR2(150);
  7  BEGIN
  8
  9    myProc(v_length,v_separator,v_line);
 10
 11    dbms_output.put_line(v_line);
 12  END;
 13  /








27.16.Out Parameters
27.16.1.OUT Parameters
27.16.2.Out parameter
27.16.3.Calling myProc
27.16.4.IN OUT difference