将列的派生总和值插入另一个 table 作为 oracle 数据库中的记录

Insert derived sum value of a column into another table as a record in oracle database

我在 oracle 数据库上遇到错误

ORA-00936: missing expression

我不知道如何在 table 上正确插入一条记录,它是另一个 table.

的所有值的总和
    INSERT INTO initial_transaction_inventory
    VALUES (10000, SELECT SUM (pyi_total_price) FROM payable_inventory, SELECT SUM (pai_total_cost) FROM paid_inventory, SYSDATE, utl_raw.cast_to_raw ('C:\Users\username\Documents'));

这就是我要用我的代码做的事情。

你只需要使用括号如下:

INSERT INTO initial_transaction_inventory
VALUES (10000,
        (SELECT SUM (pyi_total_price) FROM payable_inventory),
        (SELECT SUM (pai_total_cost) FROM paid_inventory),
        SYSDATE,
        utl_raw.cast_to_raw ('C:\Users\username\Documents'));