A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Spring in Action
this week in the
copy couple of rows from same table with hiberrnate sequence value
Joined: Aug 19, 2008
Sep 24, 2010 22:30:39
I am trying to copy couple of rows from same table with hibernate sequence value for column.
insert into emp(ID,name) values ( hibernate_sequence.nextval ,
(select name from emp where ref_id=10)
as there are multiple rows in with ref_id equal to 10 i am getting an error single row subquery returns more than one row
can anyone please let me know if there way to accomplish the above.
Thanks in advance
Joined: Apr 14, 2004
Sep 27, 2010 03:22:24
Presumably select name from emp where ref_id=10 returns more than one row? If it does you will need to use a cursor to do this. Open a cursor and for each of your name attributes, select the next value from the sequence and insert them into emp.
I agree. Here's the link:
subject: copy couple of rows from same table with hiberrnate sequence value
copy data between two different servers
select values that do not have state = x
Changing row color in jtable
How to delete duplicate rows
Comparing NUMBER columns with String values
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014