Home » SQL & PL/SQL » SQL & PL/SQL » Update SQL (Oracle)
Update SQL [message #590461] Thu, 18 July 2013 06:07 Go to next message
rpuser
Messages: 2
Registered: June 2013
Junior Member
Please let me know where I am doing wrong here

UPDATE CHILD_SPECSET MASTER_ID=
SELECT MASTER_ID FROM
(
SELECT max(TV.MASTER_ID) AS MASTER_ID,
TV.M_ID AS M_ID,
TV.M_VERSION AS M_VERSION,
TV.M_TIMESTAMP AS M_TIMESTAMP,
TV.SOURCENAME AS SOURCENAME,
STG_TRADE.ICOND as ICOND
FROM MASTER_SPECSET TV,
STAGE STG_TRADE
WHERE TV.SOURCENAME = STG_TRADE.SOURCENAME
AND TV.M_ID = STG_TRADE.M_ID
AND TV.M_VERSION = STG_TRADE.M_VERSION
AND TV.M_TIMESTAMP = STG_TRADE.M_TIMESTAMP
AND TID = '91000' GROUP BY TV.M_ID, TV.M_VERSION, TV.M_TIMESTAMP, TV.SOURCENAME, STG_TRADE.ICOND
)TRD
WHERE CHILD_SPECSET.ICOND = TRD.ICOND


I am getting the error lissing expression.
I am new to SQL .
Please help me correct this and if there is any other effecient way
Re: Update SQL [message #590464 is a reply to message #590461] Thu, 18 July 2013 06:15 Go to previous messageGo to next message
dariyoosh
Messages: 532
Registered: March 2009
Location: Iran / France
Senior Member
Hello,

It seems that the UPDATE SET clause is missing in your statement. I didn't search your code to see whether there are other problems as you didn't format your code.

Take a look at UPDATE_SET_CLAUSE

And also

http://www.dpriver.com/pp/sqlformat.htm

Regards,
Dariyoohs
Re: Update SQL [message #590465 is a reply to message #590461] Thu, 18 July 2013 06:23 Go to previous messageGo to next message
Michel Cadot
Messages: 59118
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code, use code tags and align the columns in result.
Use the "Preview Message" or "Preview Quick Reply" button to verify.
Also always post your Oracle version, with 4 decimals.

And feedback to, if not thank, people that help you (check your previous topic).

Regards
Michel
Re: Update SQL [message #590486 is a reply to message #590461] Thu, 18 July 2013 09:57 Go to previous message
thelearner
Messages: 121
Registered: April 2013
Location: INDIA
Senior Member
try in this format
Update based on a single queried value...
UPDATE <table_name>
SET <column_name> = (
  SELECT <column_name>
  FROM <table_name
   WHERE <column_name> <condition> <value>)
WHERE <column_name> <condition> <value>;



Update based on a query returning multiple values

UPDATE   <table_name> <alias>
SET      (<column_name>,<column_name> ) = (
   SELECT (<column_name>, <column_name>)
   FROM    <table_name>
   WHERE  <alias.column_name> = <alias.column_name>)
WHERE      <column_name> <condition> <value>

Previous Topic: Column To Row Generation Help Required
Next Topic: Need Help in Advance Subqueries (Exists,With .Correlated Subquery)
Goto Forum:
  


Current Time: Wed Sep 17 17:34:07 CDT 2014

Total time taken to generate the page: 0.06358 seconds