ORACLE的存储过程可以执行成功 可是表中的数据没有发生变化

Lishyer 2017-09-19 09:24:39
create or replace procedure pro_op_m_test
as
tab1 dw2.dw2_etl_com@bi52%rowtype;
tab2 dw2.dw2_etl_com@bi52%rowtype;
tab3 dw2.dw2_etl_com@bi52%rowtype;
tab4 Itf2.Inter_Cfg@bi52%rowtype;
tab5 ST.BI_JOB_LIST@FJBIJS_ST%rowtype;
tab op_m_test1%rowtype;
begin
select * into tab1
from dw2.dw2_etl_com@bi52 t where t.tablename='DW_SRV_4GCUUSER_DT';
select * into tab2
from dw2.dw2_etl_com@bi52 t where t.tablename='DW_IS_MVUSER_DI';
select * into tab3
from dw2.dw2_etl_com@bi52 t where t.tablename='DW_IS_ALUSER_DI';
select * into tab4
from Itf2.Inter_Cfg@bi52 T WHERE T.TABLENAME='ODS_2IMSG_MSGJH';
select * into tab5
from ST.BI_JOB_LIST@FJBIJS_ST T WHERE T.ITFDATE='20170911' AND SRCTABLEname='CELL_INFO';
if tab1.optime=to_char(sysdate,'yyyymmdd')-1 and tab1.status!=0 then
update op_m_test1 set stop_time=tab1.stoptime,
datafile_day=tab1.optime,
status=tab1.status,
status_name=(case tab1.status
when 0 then 'zz成功'
when 1 then '正在抽取'
when -1 then '执行失败'
end)
where table_name='DW_SRV_4GCUUSER_DT';
end if;
if sql%found then
DBMS_OUTPUT.PUT_LINE('this is successful!');
end if;
end pro_op_m_test;
...全文
1672 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
Alen_Liu_SZ 2020-05-24
  • 打赏
  • 举报
回复
缺少commit,Oracle数据库的提交需要显式提交。
yingkedandan 2020-04-14
  • 打赏
  • 举报
回复
你这存储过程里面得写 commit; 呀
shpery 2017-09-19
  • 打赏
  • 举报
回复
在更新语句后面加上commit;
Lishyer 2017-09-19
  • 打赏
  • 举报
回复
要怎么提交 我不会
Lishyer 2017-09-19
  • 打赏
  • 举报
回复
我后面用sql%found判断update是否对数据库有影响的时候 有输出This is succuessful! 然后我另外用select语句查询原表以及要被更新的数据是不一样的
acen_chen 2017-09-19
  • 打赏
  • 举报
回复
update后没提交吧
卖水果的net 2017-09-19
  • 打赏
  • 举报
回复
数据没有变化,有两个可能: 1、 update 语句没有执行; 2、 update 前后的值是一样的;
碧水幽幽泉 2017-09-19
  • 打赏
  • 举报
回复
update后面要加上commit;
Oracle对于insert语句、delete语句、update语句都要加上commit;
才会更改数据库表数据。

17,086

社区成员

发帖
与我相关
我的任务
社区描述
Oracle开发相关技术讨论
社区管理员
  • 开发
  • Lucifer三思而后行
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧