oracle调用函数的方式

--方法1.PLSQL代码块

SQL> set serveroutput on
SQL> declare
2 v_sal emp_pl.sal%type;
3 begin
4 v_sal :=get_sal(7902);
5 dbms_output.put_line('7902的工资是'||v_sal);
6 END;
7 /
--方法2.execute

SQL> variable g_salary number
SQL> execute :g_salary :=get_sal(7902) --不用分号
--方法3.call

SQL> var get_salary1 number
SQL> call get_sal(7902) into :get_salary1; --需要用分号
--variable同var
--方法4.select

SQL> select get_sal(7902) from dual;
--方法5.将函数作为另一个子程序的参数
 

SQL> execute dbms_output.put_line(get_sal(7902));
---------------------
版权声明:本文为CSDN博主「ninn-sang」的原创文章,遵循CC 4.0 by-sa版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_30934019/article/details/80557576

posted @ 2019-08-11 01:07  享尔正  阅读(3340)  评论(0编辑  收藏  举报