oracle儲存過程plsql_sp_多個out引數測試語法

wisdomone1發表於2010-07-01
1  create or replace procedure p_dept(v_deptno number,v_dname out varchar2,v_loc out varchar2)
  2  as
  3  begin
  4  select dname,loc into v_dname,v_loc from dept where rownum<2;
  5  dbms_output.put_line('first out parameter'||v_dname);
  6  dbms_output.put_line('two out parameter'||v_loc);
  7* end;
Procedure created.
SQL> select * from dept;
    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON
SQL> desc dept;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 DEPTNO                                    NOT NULL NUMBER(2)
 DNAME                                              VARCHAR2(14)
 LOC                                                VARCHAR2(13)
SQL> var dname varchar2(14);
SQL> var loc varchar2(13)
SQL> exec p_dept(10,:dname,:loc);
PL/SQL procedure successfully completed.
SQL> print :dname
DNAME
--------------------------------------------------------------------------------
ACCOUNTING
SQL> print :loc
LOC
--------------------------------------------------------------------------------
NEW YORK
SQL>

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-666865/,如需轉載,請註明出處,否則將追究法律責任。

相關文章