Home » SQL & PL/SQL » SQL & PL/SQL » Update query using case when exists (11)
Update query using case when exists [message #573922] Fri, 04 January 2013 05:38 Go to next message
cplusplus1
Messages: 40
Registered: October 2012
Location: usa
Member
I am trying to use the below query, is there any other better way than the below.

update t_emp set TTL_FLG =
CASE
WHEN EXISTS
(SELECT 1 from Schema1.T_STG_LW_EMP E
WHERE E.Employee = Schema2.T_emp.EMPLOYEE_NUMBER
AND E.JB_CODE like '%TP%' or E.JB_CODE like '%DGD%' or E.JB_CODE like '%PDD%'
or E.JB_CODE like '%YND%'
)
THEN 'Y'
ELSE 'N'
END;

Thanks a lot for the helpful info.

[Updated on: Fri, 04 January 2013 05:45]

Report message to a moderator

Re: Update query using case when exists [message #573927 is a reply to message #573922] Fri, 04 January 2013 05:44 Go to previous message
Michel Cadot
Messages: 59498
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
update t_emp set TTL_FLG = nvl((select 'Y' from T_STG_LW_EMP E ...), 'N')
where ...;

Regards
Michel

[Updated on: Fri, 04 January 2013 05:45]

Report message to a moderator

Previous Topic: PDF to Oracle table
Next Topic: LISTAGG
Goto Forum:
  


Current Time: Thu Oct 30 12:43:53 CDT 2014

Total time taken to generate the page: 0.12817 seconds