Performing UPDATE on ORACLE using FROM

Asked

Viewed 1,091 times

1

How to do UPDATE in Oracle records without using a clause IN to change data in bulk?

Thus:

UPDATE TABELA1 SET DADO = DADO
  FROM TABELA2 
 WHERE TABELA1.CODIGO = TABELA2.CODIGO;

Currently he me force to inform a clause IN:

UPDATE TABELA1 SET DADO = DADO
 WHERE CODIGO IN (SELECT CODIGO FROM TABELA2);

1 answer

1


The FROM clause is not accepted in the UPDATE command, hence the use of the IN clause in WHERE. Apparently, it is accepted in some Database Management Systems such as Postgre. But if we analyze the ANSI standard, it will not be present. I did this check in "ANSI SQL 99 Part 2 - SQL Foundation".

Browser other questions tagged

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