oracle存储过程commit
1. oracle 存储过程需要commit吗
存储过程里面的DML语句比如insert,update是需要commit的
2. Oracle存储过程,更新大量数据,如何循环分批次提交
可通过以下方法:
以100条数据为例,如果海量数据可参考。
如test表中有如下数据:
sql">declare
iint;--定义变量
v_countint;--定义变量
v_loopint;--定义变量
begin
selectcount(*)intov_countfromtest;--计算表内数据总数
selectceil(v_count/10)intov_loopfromal;--计算需要循环次数
i:=1;--为i赋值
whilei<=v_looploop--循环退出条件
updatetestsetbegintime=<=10;--执行更新
commit;--提交
i:=i+1;--i依次加1
endloop;--结束循环
end;
3. 怎样在oracle存储过程中自动commit
需要写commit. 外部程序里, qry1.add('commit'); execsql; 与执行其它语句一样。
4. oracle存储过程中update语句的提交问题
后面是必须跟commit的,
看下是不是打开了自动提交
show
autocommit;
如果是on的话,就能解释你这个是什么情况了。
还有就是你在执行之后是不是做了用户切换,切换用户,用的是connect命令,是会提交事务的。
5. oracle 存储过程事务控制
把第一个commit去掉既可,如下:
create or replace procere aaa is
var2 number;
begin SELECT Seq_Tbtopic.nextval INTO var2 FROM al;
insert into tbTopic values (var2 , 1, 1, '口语3333',1,3,2,'','');
insert into tbchildtopic values (Seq_Tbchildtopic.Nextval,var2,'','ck','/kangsi/Resource/test/B1/1_2_2_1_Emily_ck_.mp3','ck');
commit;
end aaa;
6. oracle存储过程如何输出信息
可用DBMS_OUTPUT.PUT_LINE()对存储过程的进行输出。
编写存储过程:
create or replace procere test_pro(in_num number)
as
M number;
begin
M := in_num;
if 0 < M then
dbms_output.put_line('输出SQL语句1');
elsif M < 3 then
dbms_output.put_line('输出SQL语句2');
else
dbms_output.put_line('nothing');
end if;
end;
(6)oracle存储过程commit扩展阅读;
存储在数据库的数据字典中,存储在当前的应用中安全性由数据库提供安全保证,必须通过授权才能使用存储子程序,安全性靠应用程序来保证,如果能执行应用程序,就能执行该子程序。模式描述IN参数用来从调用环境中向存储过程传递值,不能给IN参数赋值,给此参数传递的值可以是常量、有值的变量、表达式等。
7. Oracle存储过程中需要写commit吗
这个完全看你自己的需求。
如果是你不需要再存储过程中进行提交,而是由调用程序负责提交或者回滚,那么不需要再存储过程中commit或者rollback
如果你不想由调用程序负责提交或者回滚,那么应该在存储过程中进行commit或rollback