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






An OUT parameter returns a value to the main program.

An OUT parameter allows you to return more than one variable from the subprogram.

The actual parameter is a variable.

SQL> create or replace procedure p_split (i_date_dt DATE,o_hour OUT NUMBER, o_min OUT NUMBER)
  2  is
  3  begin
  4      DBMS_OUTPUT.put_line(o_hour||'/'||o_min);
  5      o_hour:= to_NUMBER(to_char(i_date_dt,'hh24'));
  6      o_min := TO_CHAR(i_date_dt,'mi');
  7      DBMS_OUTPUT.put_line(o_hour||'/'||o_min);
  8  end;
  9  /

Procedure created.

SQL>
SQL> declare
  2    v_hour NUMBER:=12;
  3    v_min  NUMBER:=20;
  4  begin
  5      p_split(sysdate, v_hour, v_min);
  6      DBMS_OUTPUT.put_line ('Total minutes:'||(v_hour*60+v_min));
  7  end;
  8  /
/
21/27
Total minutes:1287

PL/SQL procedure successfully completed.

SQL>








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