nextval problem with insert statement
Hi,
I have been working on this query for a day now and can’t seem to get it right. I will admit I am no expert in writing this stuff and am first to admit it. After several hours I have to give in and ask for some help. I am currently using 10.2.
I am writing this query for production to update some records. Those records also have a sequence number that needs to be generated. This is where I am stuck.
What I did was the following:
Created a table:
Create table local_list_temp as
Select * from local_list
Where org_id = 5901;
Then I updated two columns in that table.
Update local_list_temp
Set org_id = 6300
Where org_id = 5901;
Update local_list_temp
Set prof_id = -1
Where org_id = 5901;
Then I want to move these updated rows back to production. Because they are new inserts a new sequence value needs to be also inserted. And this is where I am getting hung up.
I wrote the following query
Insert into local_list values seqowner.s_local_list.nextval
(select addressee, description, office_symbol, org_id, prof_id, is_default, status, date_modified
From local_list_temp);
The above query gives me a missing expression error. I have tried several different variations of the same query and run out of ideas.
Any help with this query would be appreciated.
Thanks in advance.
Regards,
al