Skip to content Skip to sidebar Skip to footer

Insert Into With Union All And Nextval Doesn't Work With Duplicate Values

I want to insert 2 lines in a table within one insert into statement with Oracle SQL. This code works: insert into a_glw select tt.*, work_id_seq.nextval from (select 11111, '

Solution 1:

As the values are different in the second example, you have to have an alias name for your columns in order to execute the insert statement.

In the first example, test is the column value and it assumes test as the default column name as you did not provide alias name.

See the example here

If you look at the enclosed screenshot, the second example is having TEXT columns repeated twice as the select statement is considering the column value as the column name and therefore you must provide alias names for the columns.

enter image description here

Post a Comment for "Insert Into With Union All And Nextval Doesn't Work With Duplicate Values"