oracle 存储过程 报 无效字符
来源:互联网 发布:flickerplate.js 编辑:程序博客网 时间:2024/06/06 12:39
create or replace procedure insert_MQdetail_table is -------------------指定数据生成只需修改以下条件----------------------------- --定义数据生成时间范围 /*start_date varchar2(100):='20150501'; end_date varchar2(100):='20150603';*/ --查询需要生成数据的指标记录 in ('GW0073','GW0074','GW0022','GW0075','GW0036','GW0040') cursor gdata_dict is(select t.id,t.today_sql from zyhipsys.monitor_quota_info t); ----------------------------------------------------------------------------- --变量声明 vsql varchar2(2000);--sql语句 vsid varchar2(200);--info id vsCoutn varchar2(4000);--最新的数目 vsCoutnTemp varchar2(4000);--临时的数目 vaNewDetailId varchar2(200);--要插入的新的主键begin --循环指标配置表记录 for vvv in gdata_dict loop begin vsql:=vvv.today_sql; vsid:=vvv.id; begin execute immediate vsql into vsCoutn;--根据配好的sql语句查询当日的数目 end; if vsql is not null then execute immediate 'select count(*) from zyhipsys.monitor_quota_detail t where t.insert_time >= trunc(sysdate) and t.insert_time < trunc(sysdate + 1) and t.info_id=:1' into vsCoutnTemp using vsid; end if; if vsCoutnTemp=0 then --执行插入 execute immediate 'select monitor_quota_detail_seq.nextval from dual' into vaNewDetailId; execute immediate 'insert into zyhipsys.monitor_quota_detail t (t.id,t.info_id,t.quota_value,t.insert_time,t.valid_flag) values(:1,:2,:3,sysdate,1)' using vaNewDetailId,vsid,vsCoutn; else --执行更新 execute immediate 'update zyhipsys.monitor_quota_detail t set t.quota_value=:1 where t.insert_time >= trunc(sysdate) and t.insert_time < trunc(sysdate + 1) and t.info_id=:2 ' using vsCoutn,vsid; end if; end; end loop;end insert_MQdetail_table;
原因是因为 在execute immediate vsql into vsCoutn 这边根据语句查询的时候得到数目的时候 加了 ;
;号和/都是执行的含义,如果使用了/就不需要使用分号了。
如果是执行存储过程则必须使用/
0 0
- oracle 存储过程 报 无效字符
- oracle存储过程报"无效的列索引"的错误
- oracle数据库 编译无效存储过程
- Oracle,数据库执行报:ORA-00911: 无效字符
- oracle运行存储过程报PLS-00201
- oracle存储过程转义字符单引号
- [转]Oracle中编译所有无效的存储过程
- 在Oracle中重编译所有无效的存储过程
- oracle 00911 无效字符
- 报“无效字符”的错误
- C#执行Oracle存储过程 报Oracle-06550错误解决方法
- oracle执行存储过程报错:ORA-12011
- oracle 存储过程执行报错ORA-12828
- Oracle中报无效数字
- oracle将查询结果导出文本报错:ORA-00911:无效的字符
- oracle中的反义字符及存储过程的调试方法
- ORACLE带字符的自增值存储过程的实现
- ORACLE 查询某些字符在存储过程中存在
- NSString 之 length 别让眼睛欺骗了你
- 数据源的配置
- 【笔试】36、树的子结构
- 谈谈展望
- 【java】File类的详解使用方法
- oracle 存储过程 报 无效字符
- Eclipse使用技巧
- SylixOS入门指南--架设开发环境
- Vim命令合集(貌似有的有错误,Mark在这里,用到的时候来找)
- SpringMVC框架介绍
- 运行程序报错:the file"xxx"couldn't be open because you don't have permisslion to view it
- Objective-C 【在手动内存管理中如何写set方法】
- 【java】getAbsolutePath()方法详解
- 通过fetchXml 实现分页查询