Update Oracle Error

Asked

Viewed 51 times

0

I need to do an oracle update, two tables related to the same fields, ran the command below, and gave the following result.

UPDATE  SAC_RV_DIVIDENDO,SAC_RV_DIVIDENDO_QTD_POS SET DT_EX='20190110' WHERE ID=53136

Error : ORA-00971: Missing SET keyword

2 answers

1

Oracle does not support simultaneous update of 2 tables, it would be necessary to either perform 2 transactions or create a precedent that performs this procedure for you:

UPDATE SAC_RV_DIVIDENDO         SET DT_EX = '20190110' WHERE ID = 53136;
UPDATE SAC_RV_DIVIDENDO_QTD_POS SET DT_EX = '20190110' WHERE ID = 53136;
COMMIT;

Or

CREATE PROCEDURE UPDATE_SAC_RV_DIVIDENDO(P_DT_EX IN VARCHAR2,
                                         P_ID    IN NUMBER) IS
BEGIN

  UPDATE SAC_RV_DIVIDENDO         SET DT_EX = P_DT_EX WHERE ID = P_ID;
  UPDATE SAC_RV_DIVIDENDO_QTD_POS SET DT_EX = P_DT_EX WHERE ID = P_ID;
  COMMIT;

END;

1

I do not believe that Oracle supports multiple operations of update in a statement unique. The solution would be to encapsulate the two operations in one transaction:

START TRANSACTION;
UPDATE SAC_RV_DIVIDENDO         SET DT_EX='20190110' WHERE ID=53136;
UPDATE SAC_RV_DIVIDENDO_QTD_POS SET DT_EX='20190110' WHERE ID=53136;
COMMIT;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.