Solved

Update Query

Posted on 2011-02-16
4
373 Views
Last Modified: 2012-06-22
I'm having quite the day, I'm unable to turn this access query into a pl/sql update query.

Please help :)
UPDATE CDB.PRJ_LM TIE 
    SET REC_CHNG_CD = 'U',
    MODIFIED_BY_ID = PARAM_0,
    MODIFIED_DT = SYSDATE,
    STAT_CD = 'I'
    WHERE EXISTS (SELECT T.P_ID P_ID, TIE.LM_ID ID, T.NM NAME,
'N/A' DEF_TX, FROM CDB.PRJ_T T LEFT JOIN CDB.PRJ_LM TIE ON (T.PUB_ID = TIE.PUB_ID) 
AND (T.ID = TIE.ID)
WHERE (((T.P_ID)= 1) 
AND ((T.CHNG_CD)='U') 
AND ((T.TMPLT_STAT_CD)='I') 
AND ((TIE.TIELM_STAT_CD)='A'))

Open in new window

0
Comment
Question by:lulubell-b
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 1

Accepted Solution

by:
hraja77 earned 250 total points
ID: 34907888
UPDATE CDB.PRJ_LM TIE
    SET REC_CHNG_CD = 'U',
    MODIFIED_BY_ID = PARAM_0,
    MODIFIED_DT = SYSDATE,
    STAT_CD = 'I'
    WHERE EXISTS (SELECT T.P_ID P_ID, TIE.LM_ID ID, T.NM NAME,
'N/A' DEF_TX, FROM CDB.PRJ_T T where (T.PUB_ID = TIE.PUB_ID
AND T.ID = TIE.ID)
WHERE (((T.P_ID)= 1)
AND ((T.CHNG_CD)='U')
AND ((T.TMPLT_STAT_CD)='I')
AND ((TIE.TIELM_STAT_CD)='A'))
0
 
LVL 28

Expert Comment

by:Naveen Kumar
ID: 34912432
There are lot of parenthesis missing/incorrect in the above version of your query. So corrected the same.

Try this to see if it works for you.

UPDATE CDB.PRJ_LM TIE
    SET REC_CHNG_CD = 'U',
    MODIFIED_BY_ID = PARAM_0,
    MODIFIED_DT = SYSDATE,
    STAT_CD = 'I'
WHERE EXISTS (SELECT 1 FROM CDB.PRJ_T T
WHERE T.PUB_ID = TIE.PUB_ID
AND T.ID = TIE.ID
and T.P_ID= 1
AND T.CHNG_CD='U'
AND T.TMPLT_STAT_CD='I'
AND TIE.TIELM_STAT_CD='A' )
0
 
LVL 15

Assisted Solution

by:Aaron Shilo
Aaron Shilo earned 250 total points
ID: 34933439
1. you had 1 " , " in you inner query just before the FROM key word.
2. when using EXIST no need to retrive all these column you will not use them your just checking for an existance of a value SO i changed that to a constant " 1 ".

enjoy .

UPDATE CDB.PRJ_LM TIE
    SET REC_CHNG_CD = 'U',
    MODIFIED_BY_ID = PARAM_0,
    MODIFIED_DT = SYSDATE,
    STAT_CD = 'I'
    WHERE EXISTS (SELECT1 FROM CDB.PRJ_T T LEFT JOIN CDB.PRJ_LM TIE ON (T.PUB_ID = TIE.PUB_ID)
AND (T.ID = TIE.ID)
WHERE (((T.P_ID)= 1)
AND ((T.CHNG_CD)='U')
AND ((T.TMPLT_STAT_CD)='I')
AND ((TIE.TIELM_STAT_CD)='A'))
0
 

Author Comment

by:lulubell-b
ID: 34973081
Thank you
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question