insert partial existing row data and fixed values into table

I'm trying to insert some existing row values, but with having some of the fields of different value.

I have the below code, which is of course giving syntax error, but I'm not sure how to fix it.
Can someone please point me in right direction?

Thanks
insert into TableFooFoo 
(column1, column2, column3, column4, columnGettingNewValue1, columnGettingNewValue2, columnGettingNewValue3)
 (
select column1, column2, column3, column4 from TableFooFoo where columnGettingNewValue3 = 'foo1' 
UNION 123, 'NewValue2', 'NewFoo'
);

Open in new window

LVL 30
AxterAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

j-horbCommented:
UPDATE TableFooFoo Set Column1=123,Column2='NewValue2',Column3='NewFoo' WHERE column3 = 'fool'

(or WHERE columnGettingNewValue3 ='fool' depending what the table structure is)

in short, you need to use UPDATE rather than INSERT, if I'm reading your question correctly
0
AxterAuthor Commented:
By I don't want to change the existing row, and instead I want to insert a copy of the row, with some fields being different.

I also need a way to put the existing row value together with new field values.
0
j-horbCommented:
Ah sorry, misunderstood the question. Still not quite sure what you are trying to do, but something like

INSERT INTO TableFooFoo ((column1, column2, column3, column4, columnGettingNewValue1, columnGettingNewValue2, columnGettingNewValue3)
VALUES
(SELECT column1, column2, column3, column4,123,'NewValue2','NewFoo' from TableFooFoo WHERE  columGettingNewValue3 = 'fool')


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AxterAuthor Commented:
Thank you very much.  That's what I'm looking for.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.