天天看點

Oracle存儲過程及函數練習

/*建立一個存儲過程,以員工号為參數,輸出該員工的工資*/
create or replace procedure p1(v_empno in emp.empno%type,v_sal out emp.sal%type) is
begin
    select sal into v_sal from emp where empno = v_empno;
end;
/*執行*/
declare 
    v_empno emp.empno%type := 7369;
    v_sal emp.sal%type;
begin
    p1(v_empno,v_sal);
    dbms_output.put_line(v_empno||' '||v_sal);
end;