• 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

SQLException Calling Stored Procedure

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
I'm getting the following exception when calling a stored procedure from Java. Maybe someone can help me out here. See details below.
Exception
java.sql.SQLException: ORA-01747: invalid user.table.column, table.column, or column specification
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:656)
at storedproctest.StoredProcApp.<init>(StoredProcApp.java:111)
at storedproctest.DBApp.<init>(DBApp.java:20)
at storedproctest.DBApp.main(DBApp.java:49)
Database - Oracle 9.2.0.1.
SQL> desc dsl_type;
Name Null? Type
----------------------------------------- -------- ----------------------------
SITE_NAME VARCHAR2(30)
DSL_ID NUMBER(10)
DSL_NAME VARCHAR2(20)
THRESHOLD NUMBER
AZIMUTH NUMBER
SIG_DWN_COL_DURATION NUMBER
COMMENTS VARCHAR2(100)
CREATED_BY_ID NUMBER(5)
DATE_CREATED DATE
LAST_MODIFIED_BY_ID NUMBER(5)
DATE_LAST_MODIFIED DATE
DATE_DEACTIVATED DATE
SQL>
SQL> desc dsls;
Name Null? Type
----------------------------------------- -------- --------------
SITE_NAME NOT NULL VARCHAR2(30)
DSL_ID NOT NULL NUMBER(10)
DSL_NAME NOT NULL VARCHAR2(20)
THRESHOLD NOT NULL NUMBER
AZIMUTH NOT NULL NUMBER
SIG_DWN_COL_DURATION NOT NULL NUMBER
COMMENTS NOT NULL VARCHAR2(100)
CREATED_BY_ID NOT NULL NUMBER(5)
DATE_CREATED NOT NULL DATE
LAST_MODIFIED_BY_ID NOT NULL NUMBER(5)
DATE_LAST_MODIFIED NOT NULL DATE
DATE_DEACTIVATED DATE
SQL>
pl/SQL procedure
PROCEDURE add( dslIn IN DSL_TYPE )
AS
dslId NUMBER := 0;
BEGIN
-- Do a little sanity checking
utils.assert_non_zero( dslIn.created_by_id );
utils.assert_not_null( dslIn.dsl_name );
-- Get a new sequence value and insert the new dsl
SELECT dsls_id_seq.NEXTVAL INTO dslId FROM dual;
INSERT INTO dsls( SITE_NAME, DSL_ID, DSL_NAME, THRESHOLD, AZIMUTH, SIG_DWN_COL_DURATION, COMMENTS,
CREATED_BY_ID, DATE_CREATED, LAST_MODIFIED_BY_ID, DATE_LAST_MODIFIED, DATE_DEACTIVATED )
VALUES(( SELECT TRIM( global_name ) FROM global_name ), dslId, dslIn.dsl_name, dslIn.threshold,
dslIn.azimuth, dslIn.sig_Dwn_Col_Duration, dslIn.comments, dslIn.created_by_id, SYSDATE,
dslIn.created_by_id, SYSDATE, NULL );
-- Commit this transaction to the database
COMMIT;
END add;
Java code
try {

StructDescriptor dslStructDesc = StructDescriptor.createDescriptor( "DSL_TYPE", dbConn );
Object[] dslAttributes = new Object[12];
dslAttributes[0] = " "; // populated via pl/sql
dslAttributes[1] = new BigDecimal( 0 ); // populated via pl/sql
dslAttributes[2] = "Crator Lake";
dslAttributes[3] = new BigDecimal( 098.34 );
dslAttributes[4] = new BigDecimal( 23.67 );
dslAttributes[5] = new BigDecimal( 101.1 );
dslAttributes[6] = "Inserting from JAVA!";
dslAttributes[7] = new BigDecimal( 2 );
dslAttributes[8] = new java.sql.Date( GregorianCalendar.getInstance().getTimeInMillis());
dslAttributes[9] = new BigDecimal( 2 );
dslAttributes[10] = new java.sql.Date( GregorianCalendar.getInstance().getTimeInMillis());
dslAttributes[11] = new java.sql.Date( GregorianCalendar.getInstance().getTimeInMillis());
STRUCT dslType = new STRUCT( dslStructDesc, dbConn, dslAttributes );
ocStmnt = (OracleCallableStatement)dbConn.prepareCall( "CALL DSL.add( ? )" );
ocStmnt.setObject( 1, dslType );
ocStmnt.execute();
ocStmnt.close();
dbConn.close();
}
catch( SQLException sqlEx ) { sqlEx.printStackTrace(); }
 
When I was younger I felt like a man trapped inside a woman’s body. Then I was born. My twin is a tiny ad:
professionally read, modify and write PDF files from Java
https://products.aspose.com/pdf/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!