单独执行 以下sql可以得到正确的输出
declare
V_SqlString VARCHAR2(2000);
V_totalRecords number;
begin
V_SqlString:='select to_number(Count(*)) from testtabel tt inner join score s on tt.ID=s.stuid where 1=1';
execute immediate V_SqlString into V_totalRecords;
Dbms_output.put_line(V_totalRecords);
end; 但是在存储过程中执行时 V_totalRecords总是输出为0 create or replace procedure TESTTABLE_Page
( V_totalRecords out number,--总记录数
...)
as
...
begin V_SqlString:='select to_number(Count(*)) from testtabel tt inner join score s on tt.ID=s.stuid where 1=1';
dbms_output.put_line(V_SqlString);
execute immediate V_SqlString into V_totalRecords;
dbms_output.put_line(V_totalRecords); end
问题应该出在联合查询 如果把 V_SqlString的值设置为 select to_number(Count(*)) from testtabel 则输出正常
这是什么情况啊 求牛人指教 同样的问题 用游标返回结果集时 查询单表 存储过程一切正常 联合查询则一条记录都没有
declare
V_SqlString VARCHAR2(2000);
V_totalRecords number;
begin
V_SqlString:='select to_number(Count(*)) from testtabel tt inner join score s on tt.ID=s.stuid where 1=1';
execute immediate V_SqlString into V_totalRecords;
Dbms_output.put_line(V_totalRecords);
end; 但是在存储过程中执行时 V_totalRecords总是输出为0 create or replace procedure TESTTABLE_Page
( V_totalRecords out number,--总记录数
...)
as
...
begin V_SqlString:='select to_number(Count(*)) from testtabel tt inner join score s on tt.ID=s.stuid where 1=1';
dbms_output.put_line(V_SqlString);
execute immediate V_SqlString into V_totalRecords;
dbms_output.put_line(V_totalRecords); end
问题应该出在联合查询 如果把 V_SqlString的值设置为 select to_number(Count(*)) from testtabel 则输出正常
这是什么情况啊 求牛人指教 同样的问题 用游标返回结果集时 查询单表 存储过程一切正常 联合查询则一条记录都没有
但是但对写 sql语句 返回时确定的记录数
if(V_pageSize<=0) then
V_pageSize:=1; end if;
这样的语法怎么报错 V_pageSize不能用作赋值目标??? 奇怪
太不适应 oracle的语法了