Subject | insert into tab1 (...) select (...) from tab1 |
---|---|
Author | tomjanczkadao |
Post date | 2009-09-15T07:48:47Z |
Hi
I sometimes need to duplicate data in a table. I use
"insert into tab1 (...) select (...) from tab1" syntax.
The problem is, that it result in infinite loop, so it selects records that have been just inserted and inserts it again and so on.
Is it correct behaviour?
I expected, that select takes a snapshot of table content and inserts it once.
My temporary solution is to add temp_field, fill existing records with some value, and add "where temp_field is null" to select clause.
Regards, Tomek
I sometimes need to duplicate data in a table. I use
"insert into tab1 (...) select (...) from tab1" syntax.
The problem is, that it result in infinite loop, so it selects records that have been just inserted and inserts it again and so on.
Is it correct behaviour?
I expected, that select takes a snapshot of table content and inserts it once.
My temporary solution is to add temp_field, fill existing records with some value, and add "where temp_field is null" to select clause.
Regards, Tomek