tags:

views:

375

answers:

1

Hi, i have 2 tables: tab1 (field1, field2, field3) tab2 (field1, field2,field3, field4)

I want to copy a record from tab1 to tab2 taking all the fields and adding a value for field4. How can i select field1, field2 and field3 from tab2 and also add a value? I know that SELECT and VALUES in a INSERT query are mutually exclusive. I'm working on a Oracle DB

Thanks in advance

Gustavo

+8  A: 

I don't know Oracle, but in Ms SQL it works like this:

insert into tab2 (field1, field2, field3, field4) 
select field1, field2, field3, 'New Value' from tab1
haarrrgh
Yes, this would work in Oracle. Of course this example assumes the value for field4 is a constant.
Dave Costa
It worked, thanks!
pistacchio