Thanks ahead of time for your review!
I am on Oracle 9i trying to write an update query.
Below is the query that returns an error:
ORA-00913: to many values
When I remove the p.case_id I get the following error:
ORA-1427: single row query rturns more than one row.
What i am trying to accomplish with this statement is an update to the idnt table - specifically copying the contents of the Last_Name column into the Company_Name column when the ofic_cd is equal to P50 and the first_name and the company_name is null.
As you can see from the links I need data from two different tables, but I need to link through the third also to get there.
Does anybody have any ideas or suggestions on how I can write this query to mine out the data and make the update into the correct column?
Thanks for your time !!!!!!!
update CRDBA.idnt i
set i.company_name =
(select p.seq, p.case_id
from crdba.idnt i,
crdba.pty p,
crdba.case c
where c.ofic_cd = 'P50'
and i.first_name is null
and i.company_name is null
and i.idnt_id = p.idnt_id
and p.case_id = rc.case_id )
where exists
(select p.seq, p.case_id
from crdba.idnt i,
crdba.case c,
crdba.pty p
where c.ofic_cd = 'P50'
and i.first_name is null
and i.company_name is null
and i.idnt_id = p.idnt_id
and p.case_id = rc.case_id);
I am on Oracle 9i trying to write an update query.
Below is the query that returns an error:
ORA-00913: to many values
When I remove the p.case_id I get the following error:
ORA-1427: single row query rturns more than one row.
What i am trying to accomplish with this statement is an update to the idnt table - specifically copying the contents of the Last_Name column into the Company_Name column when the ofic_cd is equal to P50 and the first_name and the company_name is null.
As you can see from the links I need data from two different tables, but I need to link through the third also to get there.
Does anybody have any ideas or suggestions on how I can write this query to mine out the data and make the update into the correct column?
Thanks for your time !!!!!!!
update CRDBA.idnt i
set i.company_name =
(select p.seq, p.case_id
from crdba.idnt i,
crdba.pty p,
crdba.case c
where c.ofic_cd = 'P50'
and i.first_name is null
and i.company_name is null
and i.idnt_id = p.idnt_id
and p.case_id = rc.case_id )
where exists
(select p.seq, p.case_id
from crdba.idnt i,
crdba.case c,
crdba.pty p
where c.ofic_cd = 'P50'
and i.first_name is null
and i.company_name is null
and i.idnt_id = p.idnt_id
and p.case_id = rc.case_id);