Home » SQL & PL/SQL » SQL & PL/SQL » can we use update and select command in single query.
can we use update and select command in single query. [message #326534] Wed, 11 June 2008 23:04 Go to next message
vinnuunique
Messages: 3
Registered: June 2008
Location: Delhi
Junior Member
hi, friends.....pls tell me

can we use update and select command in single sql statement.......

Re: can we use update and select command in single query. [message #326535 is a reply to message #326534] Wed, 11 June 2008 23:08 Go to previous messageGo to next message
BlackSwan
Messages: 25036
Registered: January 2009
Location: SoCal
Senior Member
vinnuunique wrote on Wed, 11 June 2008 21:04
hi, friends.....pls tell me

can we use update and select command in single sql statement.......



yes, you can have UPDATE with a sub-SELECT
Re: can we use update and select command in single query. [message #326543 is a reply to message #326535] Wed, 11 June 2008 23:24 Go to previous messageGo to next message
vinnuunique
Messages: 3
Registered: June 2008
Location: Delhi
Junior Member
pls send me the syntex .............
Re: can we use update and select command in single query. [message #326546 is a reply to message #326534] Wed, 11 June 2008 23:29 Go to previous messageGo to next message
oraclestudent
Messages: 8
Registered: June 2008
Location: hyderbad
Junior Member
pls send me the syntax which you are trying.
Re: can we use update and select command in single query. [message #326547 is a reply to message #326534] Wed, 11 June 2008 23:30 Go to previous messageGo to next message
BlackSwan
Messages: 25036
Registered: January 2009
Location: SoCal
Senior Member
Are you willing & capable to Read The Fine Manual?

If so, enjoy.

http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_10007.htm#sthref9987

If not, you lose!
Re: can we use update and select command in single query. [message #326660 is a reply to message #326534] Thu, 12 June 2008 03:33 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
It depends what you want.
If you are looking for a single command that will update a set of rows and return the output to you as a select statement would, then you're out of luck.

If you want to get details back about the data that was updated, you can use the RETURNING clause with an UPDATE statement in Pl/Sql

If you want to use SELECT to restrice the set of rows that you update, then this is easy to do.

Which answer are you looking for?
Re: can we use update and select command in single query. [message #326681 is a reply to message #326534] Thu, 12 June 2008 04:37 Go to previous message
S.Rajaram
Messages: 1027
Registered: October 2006
Location: United Kingdom
Senior Member
This question sounds familiar to me.

http://forums.oracle.com/forums/thread.jspa?messageID=2533985&#2533985

Regards

Raj
Previous Topic: Problem: Find all table names in db and then find the list of SP used by this table
Next Topic: like to know more grants
Goto Forum:
  


Current Time: Sun Dec 04 08:48:05 CST 2016

Total time taken to generate the page: 0.10096 seconds