File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes SQLException Calling Stored Procedure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQLException Calling Stored Procedure" Watch "SQLException Calling Stored Procedure" New topic
Author

SQLException Calling Stored Procedure

David Bussey
Greenhorn

Joined: Apr 21, 2004
Posts: 1
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(); }
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQLException Calling Stored Procedure