File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes query for updating Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "query for updating" Watch "query for updating" New topic

query for updating

vernon mweetwa

Joined: Nov 26, 2004
Posts: 24

Is it possible to create a single query that can update 2 tables at once when executed and if it is possible, how is the syntax.

below is the query i use to update the master patient table and i would like the same query to update another table. how do i add on for the other table?

"update master_patient set forename = Substr(forename,1,1),surname=Substr(surname,1,1) where forename is not null "
[ February 10, 2005: Message edited by: Bear Bibeault ]
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
stored procedure is the answer.
vernon mweetwa

Joined: Nov 26, 2004
Posts: 24
can anyone transform the given query to include the other update because using stored procedures as requested is what i don't know.

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33130

Why can't you just make 2 JDBC calls?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
vernon mweetwa

Joined: Nov 26, 2004
Posts: 24
Thanks Jeanne. I used 2 JDBC calls and it has worked.
I agree. Here's the link:
subject: query for updating
It's not a secret anymore!