I am getting an ORA-00904 error from my Oracle database, while trying to run the following query from my Java application:
String sql =
"insert into LOADER_COUNT_STATUS (facility, count, author, run, created, ended, seconds) n" +
"values(?,?,?,?,?,?,?)";
PreparedStatement ps = null;
ps = db.getPreparedStatement(sql);
ps.setString(1, facility);
ps.setInt(2, count);
ps.setString(3, author);
ps.setLong(4, run);
ps.setDate(5, new java.sql.Date(startClock.getTime()));
ps.setDate(6, new java.sql.Date(Calendar.getInstance().getTime().getTime()));
ps.setLong(7, ((Calendar.getInstance().getTime().getTime() - startClock.getTime()) / 1000));
int rowCountUpdated = ps.executeUpdate();
getPreparedStatement()
is just a thin wrapper over java.sql.connection.prepareStatement()
, and every other method is directly from java.sql
Here’s the DDL for LOADER_COUNT_STATUS:
CREATE TABLE SPEC.LOADER_COUNT_STATUS
(
ID NUMBER GENERATED ALWAYS AS IDENTITY ( START WITH 8461 MAXVALUE 9999999999999999999999999999 MINVALUE 1 NOCYCLE CACHE 20 NOORDER NOKEEP) NOT NULL,
FACILITY VARCHAR2(64 BYTE),
COUNT NUMBER,
CREATED DATE DEFAULT sysdate,
AUTHOR VARCHAR2(16 BYTE),
"COMMENT" VARCHAR2(64 BYTE),
RUN NUMBER(38),
ENDED DATE DEFAULT sysdate,
SECONDS NUMBER(38)
)
How do I get rid of this particular error? I don’t think this is an issue of case-sensitivity, as these errors only pop up when the column name in the DDL is enclosed in double-quotes.
pranit is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.