我正在尝试使用以下 JDBC 语句将一些值从 Java 插入 Oracle DB:
String SQL_PREP_INSERT = "INSERT INTO ABC.TEST (LOG_ID, SESSION_ID,USER_ID) VALUES"
+ " (ABC.logid_seq.nextval, ?, ?)";
stmt = con.prepareStatement(SQL_PREP_INSERT);
stmt.setString(1, sessionId);
stmt.setString(2, userid);
stmt.execute();
stmt.close();
序列创建如下:
create sequence ABC.logid_seq
minvalue 1 maxvalue 9999999999999999999999
increment by 10 start with 10 cache 20 noorder nocycle ;
我收到以下错误,
java.sql.SQLException: ORA-00942: table or view does not exist
但是当我尝试手动插入表格时,它是成功的。
insert into ABC.test(LOG_ID,SESSION_ID,USER_ID) values
(VZPPTL.logid_seq.nextval,'test_session', '001');
有什么问题?