cobolinx1
asked on
Doing an update with an oracle with clause?
I have a physical table that I'm populating with employee data except for three columns. I have the sql to determine how to populate the three columns but I'm using a with clause. How do I update the three columns in my table using a with clause in Oracle? I have several differant with clauses to update these three columns based on various data.
ASKER
That's what I assumed. there is no way to run an update command with a WITH clause?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok almost there I want to do something like this
update tab2 set col4 = 'TEST' where (col2, col3) in
(
select col2,col3 from (
with myTab as ( select 'a' col1, 'Z' col2, 'X' col3 from dual )
select col1,col2,col3 from myTab where col1='a'
)
)
I get a single row subqury returns more then one row
how would I do that???
update tab2 set col4 = 'TEST' where (col2, col3) in
(
select col2,col3 from (
with myTab as ( select 'a' col1, 'Z' col2, 'X' col3 from dual )
select col1,col2,col3 from myTab where col1='a'
)
)
I get a single row subqury returns more then one row
how would I do that???
ASKER
I had to switch the to an in and it works great thanks!
See if this test case will help you
Open in new window