ORACLE中如何为存储过程传递参数
展开全部
给你一个 传递参数的例子
SQL> CREATE OR REPLACE PROCEDURE HelloWorld2 (
2 p_user_name IN VARCHAR2,
3 p_out_val OUT VARCHAR2,
4 p_inout_val IN OUT VARCHAR2
5 ) AS
6 BEGIN
7 dbms_output.put_line('Hello ' || p_user_name || p_inout_val || '!');
8 p_out_val := 'A';
9 p_inout_val := 'B';
10 END HelloWorld2;
11 /
Procedure created.
SQL> DECLARE
2 p_outval VARCHAR2(10);
3 p_inoutval VARCHAR2(10) := '~Hi~';
4 BEGIN
5 HelloWorld2('Edward', p_outval, p_inoutval);
6
7 dbms_output.put_line('p_outval=' || p_outval);
8 dbms_output.put_line('p_inoutval=' || p_inoutval);
9 END;
10 /
Hello Edward~Hi~!
p_outval=A
p_inoutval=B
PL/SQL procedure successfully completed.
SQL>
SQL> CREATE OR REPLACE PROCEDURE HelloWorld2 (
2 p_user_name IN VARCHAR2,
3 p_out_val OUT VARCHAR2,
4 p_inout_val IN OUT VARCHAR2
5 ) AS
6 BEGIN
7 dbms_output.put_line('Hello ' || p_user_name || p_inout_val || '!');
8 p_out_val := 'A';
9 p_inout_val := 'B';
10 END HelloWorld2;
11 /
Procedure created.
SQL> DECLARE
2 p_outval VARCHAR2(10);
3 p_inoutval VARCHAR2(10) := '~Hi~';
4 BEGIN
5 HelloWorld2('Edward', p_outval, p_inoutval);
6
7 dbms_output.put_line('p_outval=' || p_outval);
8 dbms_output.put_line('p_inoutval=' || p_inoutval);
9 END;
10 /
Hello Edward~Hi~!
p_outval=A
p_inoutval=B
PL/SQL procedure successfully completed.
SQL>
参考资料: http://hi.baidu.com/wangzhiqing999/blog/item/0991d3124070854420a4e9b4.html
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询