ORA-00932 尝试克服变异表错误

发布于 2024-11-05 03:17:45 字数 1152 浏览 4 评论 0原文

我已应用以下有关如何克服变异表错误的说明:

http: //asktom.oracle.com/pls/asktom/ASKTOM.download_file?p_file=6551198119097816936

但在我的最后一个触发器中,我收到了以下错误:

SQL> create or replace trigger Factura_Detalle_ai
after insert or update of PRODUCTO on Factura_Detalle
begin
                for i in 1 .. state_pkg.newRows.count loop

                        UPDATE Factura_Detalle
                        SET Precio = (SELECT pre.PRECIO
                        FROM PRECIO pre
                        WHERE pre.PRODUCTO = state_pkg.newRows(i));

                end loop;
end;
/
  2    3    4    5    6    7    8    9   10   11   12   13  
Warning: Trigger created with compilation errors.

SQL> show errors trigger factura_detalle_ai
Errors for TRIGGER FACTURA_DETALLE_AI:

LINE/COL ERROR
-------- -----------------------------------------------------------------
4/4      PL/SQL: SQL Statement ignored
7/23     PL/SQL: ORA-00932: inconsistent datatypes: expected NUMBER got
         ROWID

有什么想法吗?

问候

I have applied the fallowing instructions about how to overcome the mutate table error:

http://asktom.oracle.com/pls/asktom/ASKTOM.download_file?p_file=6551198119097816936

But in my last trigger I got the fallowing error:

SQL> create or replace trigger Factura_Detalle_ai
after insert or update of PRODUCTO on Factura_Detalle
begin
                for i in 1 .. state_pkg.newRows.count loop

                        UPDATE Factura_Detalle
                        SET Precio = (SELECT pre.PRECIO
                        FROM PRECIO pre
                        WHERE pre.PRODUCTO = state_pkg.newRows(i));

                end loop;
end;
/
  2    3    4    5    6    7    8    9   10   11   12   13  
Warning: Trigger created with compilation errors.

SQL> show errors trigger factura_detalle_ai
Errors for TRIGGER FACTURA_DETALLE_AI:

LINE/COL ERROR
-------- -----------------------------------------------------------------
4/4      PL/SQL: SQL Statement ignored
7/23     PL/SQL: ORA-00932: inconsistent datatypes: expected NUMBER got
         ROWID

Any ideas?

Greetings

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

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

发布评论

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

评论(1

再见回来 2024-11-12 03:17:45

将 where 子句替换为:

WHERE ROWID = state_pkg.newRows(i));

ROWID 是每行地址的伪列,并且它是一种数据类型。

编辑:

或者可能是这样的:

UPDATE Factura_Detalle
SET Precio = 
(
    SELECT pre.PRECIO
    FROM PRECIO pre
    WHERE pre.PRODUCTO = Factura_Detalle.PRODUCTO
)
WHERE ROWID = state_pkg.newRows(i);

Replace your where clause with this:

WHERE ROWID = state_pkg.newRows(i));

ROWID is a pseudo-column for the address of each row, and it's a data type.

EDIT:

Or maybe something like this:

UPDATE Factura_Detalle
SET Precio = 
(
    SELECT pre.PRECIO
    FROM PRECIO pre
    WHERE pre.PRODUCTO = Factura_Detalle.PRODUCTO
)
WHERE ROWID = state_pkg.newRows(i);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文