1

I'm new to sqlj and try to insert data with an id generated by a sequence. This is my current code:

String pattern = ...;
#sql {INSERT INTO my_table (id, pattern) VALUES (my_seq.nextVal(), :(pattern))};

but I keep getting and ORA-02287 Error. Do I need to do it differently?

EasterBunnyBugSmasher
  • 1,507
  • 2
  • 15
  • 34

2 Answers2

2

Not expert on sqlJ, but in the SQL part you should use my_seq.nextVal, with no ()

Aleksej
  • 22,443
  • 5
  • 33
  • 38
2

Omit the parentheses after nextval:

#sql {INSERT INTO my_table (id, pattern) VALUES (my_seq.nextval, :(pattern))}; 
collapsar
  • 17,010
  • 4
  • 35
  • 61