解决方案 »
- 快来救救我,我是个顽皮的孩子,Oracle把我拒之门外了!!!
- EXECUTE emp_data.get_staff(10, :cv)
- 求帮助,Oracle里的SQL语句
- 表之间的copy问题,十万火急
- oracle卸载完,重新安装的问题?
- 新手变量定义的问题(急)
- 狂晕,300分,为什么改变条件的顺序会影响查询结果???
- oracle9i 的客户端怎么设置
- 请问各位:如何在linux下安装oracle8.1.7?谢谢
- 我是新手!我新装了8.05for nt 的,装了之后不会用,问问大家帮个忙啊~
- 数据递减问题
- ----------------------------java与oracle通过数组交互 出现问题,求助--------------------------
begin
select count(*) into i from user_tables where table_name='MDMC_T_NOTIFY_TEMP';
if i>0 then
execute immediate 'drop table MDMC_T_NOTIFY_TEMP';
end if;select count(*) into i from user_tables where table_name='SIS_T_NOTIFYDATA_TEMP';
if i>0 then
execute immediate 'drop table SIS_T_NOTIFYDATA_TEMP';
end if;execute immediate 'create table MDMC_T_NOTIFY_TEMP as select * from MDMC_T_NOTIFY where 1=0';
execute immediate 'create table SIS_T_NOTIFYDATA_TEMP as select * from SIS_T_NOTIFYDATA where 1=0';end;
这个用TRUNCATE就行了,避免过多的DDL操作,MDMC_T_NOTIFY_TEMP 临时表插入速度很快的还有,插入的时候用APPEND,
COMMIT;
END IF;
COUNTS := COUNTS + 1;
---上面这个有存在的必要吗?你的意思是不是每过1000条提交一次,oracle不希望有频繁的提交。只要一个commit就行。
---根据你上面需求,我感觉没有必要用游标实现,在plsql里,循环插入会增加plsql和sql语句的上下文切换的开销。直接用表关联执行sql语句就行。
---增加 execute immediate 'alter table MDMC_T_NOTIFY_TEMP nologging';
-- execute immediate 'alter table SIS_T_NOTIFYDATA_TEMP nologging';
--包括1楼说的。
MDMC_NOTIFY,SIS_T_NOTIFYDATA这2个表都比较大吧。
可以使用rowid尝试下。
eg:
begin
for i in (select a.rowid rd, from MDMC_NOTIFY a,MDMC_T_NOTIFY_TEMP b where a,b表关联)
loop
delete from MDMC_NOTIFY where rowid=i.rd;
end loop;
commit;
end;
/
2. 如果用游标循环,建议使用绑定变量:execute immediate 'INSERT INTO MDMC_T_NOTIFY_TEMP
SELECT * FROM MDMC_T_NOTIFY where NOTIFYID=:V_NOTIFYID and DESTTYPE=''IB'' AND FACTORYNAME=''SISTaskFactory''' using V_NOTIFYID;
execute PROC_MDMC_T_NOTIFY(1) ;
execute PROC_MDMC_T_NOTIFY(2) ;
execute PROC_MDMC_T_NOTIFY(3) ;
execute PROC_MDMC_T_NOTIFY(4) ;