File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can we update multiple tables in a single update query?

 
Kaustubh G Sharma
Ranch Hand
Posts: 1283
Chrome Java Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we update multiple tables in a single update query?
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. At least not in Oracle
 
Bharath Raja
Ranch Hand
Posts: 111
  • 0
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes i know lil bit about triggers but never used it
 
Matthew Brown
Bartender
Posts: 4549
8
Java Netbeans IDE Scala
  • 0
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks .. Gotcha
 
Martin Vajsar
Sheriff
Pie
Posts: 3747
62
Chrome Netbeans IDE Oracle
  • 0
  • 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
Pie
Posts: 3747
62
Chrome Netbeans IDE Oracle
  • 0
  • 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