免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2133 | 回复: 0
打印 上一主题 下一主题

请教关于 execute immediate 报错问题,谢谢! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-03-31 16:27 |只看该作者 |倒序浏览
SQL> declare
  2    v_start varchar2(20);
  3    v_end varchar2(20);
  4    v_sql varchar2(2000);
  5  begin
  6    v_start:='2012-03-22 00:00:00';
  7    v_end:='2012-03-31 00:00:00';
  8    v_sql:='insert into QingQiuRenGong(callerno,usertype,waitbegin)
  9      select  callerno,usertype,waitbegin from t_bill_log03 where waitbegin>=to_date('||v_start||',''yyyy-mm-dd hh24:mi:ss'')
10      and waitbegin<to_date('||v_end||',''yyyy-mm-dd hh24:mi:ss'')';
11    execute immediate v_sql;
12  end;
13  /
declare
  v_start varchar2(20);
  v_end varchar2(20);
  v_sql varchar2(2000);
begin
  v_start:='2012-03-22 00:00:00';
  v_end:='2012-03-31 00:00:00';
  v_sql:='insert into QingQiuRenGong(callerno,usertype,waitbegin)
    select  callerno,usertype,waitbegin from t_bill_log03 where waitbegin>=to_date('||v_start||',''yyyy-mm-dd hh24:mi:ss'')
    and waitbegin<to_date('||v_end||',''yyyy-mm-dd hh24:mi:ss'')';
  execute immediate (v_sql);
end;
ORA-00907: 缺失右括号
ORA-06512: 在 line 11
----
大家好,请问我以上程序段,为何在11行报缺少右括号了?我左看右看都看不出错误啊,是不是 v_sql 这个变量赋值有什么问题吗?
还望各位指教,谢谢!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP