Home » Developer & Programmer » JDeveloper, Java & XML » How to implement this in JAVA?
How to implement this in JAVA? [message #190264] Tue, 29 August 2006 23:08
Messages: 21
Registered: August 2006
Junior Member
String sql1 = "select dbadmin.SEQREGID.NEXTVAL from gblk.dual";
String sql2 = "select dbadmin.SEQREGID.CURRVAL from gblk.dual";

Trying to convert an PL/SQL program into Java.

This is getting a running number. But I can't get JDBC to work.

This is the error I get.

Error! SQL Execution: select dbadmin.SEQREGID.NEXTVAL from dual, Error: java.sql.SQLException: ORA-00942: table or view does not exist

So I guess JDBC can't understand dual.

I searched the web for a solution and someone posted somewhere

// Actual call from sql.bsq
create table dual /* pl/sql's standard pckg requires dual. */
(dummy varchar2(1)) /* note, the optimizer knows sys.dual is single row */
storage (initial 1)
insert into dual values('X')
create public synonym dual for dual
grant select on dual to public with grant option

But even after I did this, I still get the same error.

Anyone got a better solution?

I need the running number during insertion of a record, kind of like an auto number. But the problem with getting the max(id) is that, it doesn't handle concurrency well and this id is suppose to be unique.

Previous Topic: XML for dummies, XLMELEMNT
Next Topic: Problems with loadjava
Goto Forum:

Current Time: Fri Jun 23 07:20:00 CDT 2017

Total time taken to generate the page: 0.19416 seconds