comm package: type test_record is record(v_test number); procedure p_test(vp_test_record in test_record);comm package body: procedure p_test(vp_test_record in test_record)
is
begin
dbms_output.put_line(to_char(vp_test_record.v_test));
end p_test;
------------------------------------------------------------------------------------------测试一:
declare
v_test comm.test_record;
begin
select 986 into v_test from dual;
comm.p_test(v_test);
end;
执行成功,打印 986
------------------------------------------------------------------------------------------测试二:
declare
v_test comm.test_record;
v_str varchar2(400);
begin
select 986 into v_test from dual;
v_str:='begin
comm.p_test(:1);
end;';
execute immediate v_str using v_test;
end;
执行出错
ORA-06550: 第 9 行, 第 33 列:
PLS-00457: 表达式必须是 SQL 类型
ORA-06550: 第 9 行, 第 3 列:
PL/SQL: Statement ignored
------------------------------------------------------------------------------------------请问是什么原因,有解决办法吗,谢谢!
is
begin
dbms_output.put_line(to_char(vp_test_record.v_test));
end p_test;
------------------------------------------------------------------------------------------测试一:
declare
v_test comm.test_record;
begin
select 986 into v_test from dual;
comm.p_test(v_test);
end;
执行成功,打印 986
------------------------------------------------------------------------------------------测试二:
declare
v_test comm.test_record;
v_str varchar2(400);
begin
select 986 into v_test from dual;
v_str:='begin
comm.p_test(:1);
end;';
execute immediate v_str using v_test;
end;
执行出错
ORA-06550: 第 9 行, 第 33 列:
PLS-00457: 表达式必须是 SQL 类型
ORA-06550: 第 9 行, 第 3 列:
PL/SQL: Statement ignored
------------------------------------------------------------------------------------------请问是什么原因,有解决办法吗,谢谢!
2 execute immediate ' declare v_test comm.test_record;
3 begin
4 select 986 into v_test from dual;
5 comm.p_test(v_test);
6 end;';
7 end;
8 /
986
PL/SQL procedure successfully completed