Oracle更新过程问题

发布于 2024-09-05 17:26:48 字数 736 浏览 6 评论 0原文

我想更新 Oracle 表中的以下过程,但它抛出错误:

CREATE OR REPLACE PROCEDURE update_keywords (aKEYWORD IN VARCHAR2, aCOUNT IN NUMBER)
AS BEGIN
   update searchable_keywords  
   set KEYWORD =:new.aKEYWORD or COUNT =:new.aCOUNT 
   where KEUWORD_ID = : old.KEYWORD_ID;
  END;

这是我的过程。我想更新关键字 &使用 keyword_id (主键)在 searchable_keywords 表中进行计数,但它抛出如下错误:

LINE/COL ERROR
-------- -----------------------------------------------------------------
3/4      PL/SQL: SQL Statement ignored
4/17     PLS-00049: bad bind variable 'NEW.AKEYWORD'
4/31     PL/SQL: ORA-00933: SQL command not properly ended
4/41     PLS-00049: bad bind variable 'NEW.ACOUNT'

您能帮我解决这个问题吗?

I want to update the following procedure in the Oracle table, but it is throwing the error:

CREATE OR REPLACE PROCEDURE update_keywords (aKEYWORD IN VARCHAR2, aCOUNT IN NUMBER)
AS BEGIN
   update searchable_keywords  
   set KEYWORD =:new.aKEYWORD or COUNT =:new.aCOUNT 
   where KEUWORD_ID = : old.KEYWORD_ID;
  END;

This is my procedure. I want to update the keyword & count in the searchable_keywords table with keyword_id (primary key) but it is throwing an error as follows:

LINE/COL ERROR
-------- -----------------------------------------------------------------
3/4      PL/SQL: SQL Statement ignored
4/17     PLS-00049: bad bind variable 'NEW.AKEYWORD'
4/31     PL/SQL: ORA-00933: SQL command not properly ended
4/41     PLS-00049: bad bind variable 'NEW.ACOUNT'

Can you please help me solve this problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

带刺的爱情 2024-09-12 17:26:48

这看起来像一个触发器...您不需要 acount/a 关键字的“:new”,并且需要传入要更新的 ID。例如。

CREATE OR REPLACE
PROCEDURE UPDATE_KEYWORDS(
    AKEYWORD    IN VARCHAR2,
    ACOUNT      IN NUMBER,
    AKEYWORD_ID IN NUMBER)
AS
BEGIN
  UPDATE
    SEARCHABLE_KEYWORDS
  SET
    KEYWORD =  AKEYWORD
  , "COUNT"  = ACOUNT
  WHERE
    KEYWORD_ID = AKEYWORD_ID
END;

我不确定为什么你会有一个名为“COUNT”的列..除非你试图在该更新中做一些不同的事情,否则其中的“或”显然是错误的..

This looks like a trigger... You don't need the ":new" for acount/akeyword, and you need to pass in the ID you want update. Eg.

CREATE OR REPLACE
PROCEDURE UPDATE_KEYWORDS(
    AKEYWORD    IN VARCHAR2,
    ACOUNT      IN NUMBER,
    AKEYWORD_ID IN NUMBER)
AS
BEGIN
  UPDATE
    SEARCHABLE_KEYWORDS
  SET
    KEYWORD =  AKEYWORD
  , "COUNT"  = ACOUNT
  WHERE
    KEYWORD_ID = AKEYWORD_ID
END;

I'm not sure why you would have a column named "COUNT".. unless you are trying to do something different in that update, its obviously wrong with that "or" in there..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文