oracle 存储过程中的更新语句不起作用 [英] Update statement inside oracle stored procedure is not working

查看:50
本文介绍了oracle 存储过程中的更新语句不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 oracle 存储过程中有一个简单的更新语句.它执行成功,但没有更新表.

I have one simple update statement inside oracle stored procedure. Its executing successfully but its not updating the table.

CREATE OR REPLACE PROCEDURE UpdateSourceLog
( SourceLogId IN NUMBER, TotalRowCount IN INT,Status IN VARCHAR)

AS
BEGIN
        UPDATE  SourceLog
        SET     Status = Status,
                TotalRowCount = TotalRowCount,
                EndTime = SYSDATE
        WHERE   SourceLogId = SourceLogId;
        COMMIT;
END;

我尝试更改与列名称不同的参数名称.然后它也不起作用.我试过匿名块.我无法找出问题所在.请在这方面帮助我.谢谢!

I have tried with changing the perameter name different from column name. Then also Its not working. And I have tried with anonymous block. I'm not able to find out the isue. Please help me in this regard. Thanks!

推荐答案

给参数赋予与表列相同的名称是一种不好的做法.

It is a bad practice to give parameters the same name as table columns.

所以你应该改变它:

CREATE OR REPLACE PROCEDURE UpdateSourceLog
( p_SourceLogId IN NUMBER, p_TotalRowCount IN INT,p_status IN VARCHAR)

AS
BEGIN
        UPDATE  SourceLog
        SET     Status = p_status,
                TotalRowCount = p_TotalRowCount,
                EndTime = SYSDATE
        WHERE   SourceLogId = p_SourceLogId;
        COMMIT;
END;

因为现在,最有可能的是,Oracle 将其理解为列名,只是将列更新为该列中的值(完全没有意义)

Because for now, most likely, Oracle understands it as column names and just update column to value from this column (no sense at all)

这篇关于oracle 存储过程中的更新语句不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆