Jun 25, 2009

Oracle Update SQL different patterns

update subscriber_questions set answer_text = 'Employ\u00E9'

update subscriber_questions set answer_text = 'Employ\u00E9'
where NOT EXISTS | EXISTS
(select a.answer_text from subscriber_questions a, subscribers b
where b.subscriber_code = a.subscriber_code
and b.site_id = 'XXX'
and a.country_iso_code = 'UK'
and a.question_code = 'OCCUPATION')

update subscriber_questions set answer_text = 'Employ\u00E9'
where answer_text =
(select a.answer_text from subscriber_questions a, subscribers b
where b.subscriber_code = a.subscriber_code
and b.site_id = 'XXX'
and a.country_iso_code = 'UK'
and a.question_code = 'OCCUPATION')


Update Employee e
SET location = (select city from Address a where e.empid = a.empId)
where location is null

Update
(Select location ll, city cc from Employee e, Address a where e.empid = A.empId and e.location is null)
SET ll = cc