用 execute immediate 执行 把查询结果赋给一个变量
Declare
str varchar2(100);
record number;
begin
str:= 'select count(*) from bookinfo ';
execute immediate str;
end ;
上面是正确执行 且不会抱错
Declare
str varchar2(100);
record number;
begin
str:= 'select count(*) into '||record|| ' from bookinfo ';
execute immediate str;
end ;
但下面的却 抱 一个 缺少表达式 的错误 ?.....
------解决方案--------------------Declare
str varchar2(100);
record number;
begin
str:= 'select count(*) from bookinfo ';
execute immediate str into record;
end ;