Oracle 动态SQL 注意细节 ORA-00911: 无效字符
Posted 363747320wxb-qihe
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Oracle 动态SQL 注意细节 ORA-00911: 无效字符相关的知识,希望对你有一定的参考价值。
lv_sql:=‘
insert into ETL_SUCESS_AMOUNT
select SEQ_OS_ETL_AMOUNTID.NEXTVAL AS AMOUNTID,1,AMOUNT_DATA,AMOUNT_HOUR,
serviceid,portalid,mouduleid,actionid,RESERVE1_ID,RESERVE2_ID,RESERVE3_ID,
RESERVE4_ID,AMOUNT,AMOUNT_TIME
from
(
select
trunc(INSERTTIME) AS AMOUNT_DATA,
TO_CHAR(INSERTTIME,‘‘HH24‘‘) AS AMOUNT_HOUR,
serviceid,portalid,mouduleid,actionid,
NULL AS RESERVE1_ID,
NULL AS RESERVE2_ID,
NULL AS RESERVE3_ID,
NULL AS RESERVE4_ID,
count(*) AS AMOUNT,
SYSDATE AS AMOUNT_TIME
from ‘||lv_table_name||‘
where inserttime > to_date(:1,‘‘yyyy-mm-dd hh24:mi:ss‘‘)
and inserttime < to_date(:2,‘‘yyyy-mm-dd hh24:mi:ss‘‘)
group by trunc(INSERTTIME),TO_CHAR(INSERTTIME,‘‘HH24‘‘),serviceid,mouduleid,portalid,actionid
)‘;
execute immediate lv_sql USING p_sdate,p_edate;
-- 细节动态语句里面不需要分号
--细节(‘‘HH24‘‘) 动态语句里面单引号要双写
--细节 from ‘||lv_table_name||‘ 语句之间注意空格符号
--细节使用参数:1 USING p_sdate,p_edate;
以上是关于Oracle 动态SQL 注意细节 ORA-00911: 无效字符的主要内容,如果未能解决你的问题,请参考以下文章