• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can we update multiple tables in a single update query?  RSS feed

 
Ranch Hand
Posts: 1283
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we update multiple tables in a single update query?
 
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. At least not in Oracle
 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Kaustubh G Sharma wrote:Can we update multiple tables in a single update query?



have you idea about triggers
 
Kaustubh G Sharma
Ranch Hand
Posts: 1283
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes i know lil bit about triggers but never used it
 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Christophe Verré wrote:No. At least not in Oracle


But you can in MySQL. So it depends on your database.
 
Kaustubh G Sharma
Ranch Hand
Posts: 1283
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks .. Gotcha
 
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Christophe Verré wrote:No. At least not in Oracle


It is certainly possible in Oracle using key-preserved views ("updatable joins"). See what Tom Kyte has to say about it.

Then there is the multitable insert, which is usually used in ETL processing (read input data once and insert it into many tables, avoiding multiple full scans over external tables for example).
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bharath Raja wrote:have you idea about triggers


Triggers may appear to be cool, but no, I wouldn't advise to use drivers. There is no execution order specified for triggers and once there are more than a handful of them, any troubleshooting is a nightmare.

Stored procedure would be much better way in this case, if someone wanted to implement the logic in the database.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!