NutzCN Logo
问答 创建存储过程中 第二个片段插入sql报错 请问是什么原因
发布于 336天前 作者 qq_36699b6f 241 次浏览 复制 上一个帖子 下一个帖子
标签: sql

v_sql:='INSERT INTO tb_user_cert_name
select a.user_id,a.attr_code,a.attr_value,
to_char(a.start_date,''yyyymmdd'') start_date,to_char(a.end_date,''yyyymmdd'') end_date
from ucr_crm2_cdc.tf_f_user_item@lcllink9 a
where a.attr_code =''CertName''
and sysdate between start_date and end_date;
execute immediate v_sql;
commit;
v_sql:='INSERT INTO tmp_user_cert -- 这里报错了 请问一下这段sql是哪里有问题
select a.user_id,a.attr_code,a.attr_value,
substr(a.start_date,1,8) start_date,substr(a.end_date,1,8) end_date
from FORGRA.TAB_CBSS_D_USER_ITEM_ZY_'||V_day||'@LCLLINK1 A
where A.ATTR_CODE =''USE_CUST_NAME'';
execute immediate v_sql;
commit;

```

6 回复
encountered the ''insert'' when expecting one of the following:*&=-+</> at in is mod remainder not rem <an exponent(**)><> or!=or~=>=<=<> and or like kike2·····

报错是:encountered the ''insert'' when expecting one of the following:*&=-+</> at in is mod remainder not rem <an exponent(**)><> or!=or~=>=<=<> and or like kike2·····

end_date后面缺单引号

不缺引号,两个v_sql 交换顺序 都是第二个insert报错

v_sql:='INSERT INTO tb_user_cert_name
 select a.user_id,a.attr_code,a.attr_value,
 to_char(a.start_date,''yyyymmdd'') start_date,to_char(a.end_date,''yyyymmdd'') end_date
 from ucr_crm2_cdc.tf_f_user_item@lcllink9 a
 where a.attr_code =''CertName''
 and sysdate between start_date and end_date'; // 这个单引号,难道不需要匹配的?

添加回复
请先登陆
回到顶部