I was using the statement
insert into foo select bar from foobar
it worked fine.
Then, one fine day, I changed it to:
insert into foo(bar) select bar from foobar
and now it doesn’t work.
whats wrong with the second statement?
I want to know these things so I can decide if I have to be careful about this in future.
EDIT
Now that that is clear. I would like to know if the syntax is different for MSSQL and Oracle. Please help
You have 2 possible syntax choices:
If your foo table doesn’t habe a bar column then you will get an error with your second syntax because you are naming the column in that you want to insert something.
With the first syntax you are not naming the column you are inserting into.