File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
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.
Don't get me started about those stupid
subject: copy couple of rows from same table with hiberrnate sequence value
select values that do not have state = x
copy data between two different servers
Comparing NUMBER columns with String values
How to delete duplicate rows
Changing row color in jtable
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014