• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

not able to use sequence number with GROUP BY

 
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
insert into TABLE1( ID, COL1, COL2) select id_seq.nextval, COL1,COL2, from TABLE2 GROUP BY id_seq.nextval,COL1, COL2

this gives an error saying
ORA-02287: sequence number not allowed here

Because of performance issues, I am not using a ResultSet to get the data and iterate and generate the Id.
Is there any other way i can achieve this?

What I want to do is, select columns from one table with group by, and then insert into the second table with generated ids.
 
author & internet detective
Posts: 39448
768
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vivek,
What would it mean to group by sequence number? A sequence number is unique, so you wouldn't actually be grouping anything. It looks like your query would work exactly the same way without the group by clause.
 
See where your hand is? Not there. It's next to this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!