太菜拉。。关于动态执行问题!

anbeel 2004-03-20 04:41:33
调不通这段程序:

create or replace procedure sptest(llc number,ll out number) is
total number;
tmpsql varchar2(100);
begin
tmpsql:='select count(*) into total from TEST';
Execute IMMEDIATE tmpsql;
end sptest;

出错:缺少关键字!!

请帮忙!!
...全文
109 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
anbeel 2004-03-20
  • 打赏
  • 举报
回复
to zlqs

谢谢。。。
anbeel 2004-03-20
  • 打赏
  • 举报
回复
to welyngj

你说得对,但为什么不能动态调用这一句呢?
zlqs 2004-03-20
  • 打赏
  • 举报
回复
create or replace procedure sptest(llc number,ll out number) is
total number;
tmpsql varchar2(100);
begin
tmpsql:='select count(*) from TEST';
Execute IMMEDIATE tmpsql into total;
dbms_output.put_line(total);
end sptest;
welyngj 2004-03-20
  • 打赏
  • 举报
回复
llc变量没有用处。也不必要使用动态sql,直接select count(*) into total from TEST就可以了

17,082

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧