Oracle 怎么把存储过程传过来的参数拼接成

2024-11-10 14:34:03
推荐回答(2个)
回答1:

给你一个 传递参数的例子

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>

回答2:

用字符串,用execute immediate strsql