i am using callable statement to update an oracle databse with 2
number fields and a BLOB field, it gives me an error when trying
to execute the statement saying"not all variables bound". i am
putting the whole error and the code snippet at the
bottom....pls do help
Full sql Statment begin update OMP_FILE_CONTENT set
CONTENT_SIZE=?24064?,CONTENT=?<24380 byte(s)>? where CONTENT_ID=?
9? returning ROWID into ?; end;
OMPException constructor
SchemaException constructor
RetrievalQueue getNextEntry
Failed to update/insert file:Content file:Content-9 element into
database
SQL:begin update OMP_FILE_CONTENT set CONTENT_SIZE=?
24064?,CONTENT=?<24380 byte(s)>? where CONTENT_ID=?9? returning
ROWID into ?; end;
SchemaException getRootCause
ORA-01008: not all variables bound
java.sql.SQLException: ORA-01008: not all variables bound
at oracle.jdbc.dbaccess.DBError.throwSqlException
(DBError.java:114)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:542)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7
(TTC7Protocol.java:1311)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch
(TTC7Protocol.java:738)
at oracle.jdbc.driver.OracleStatement.executeNonQuery
(OracleStatement.java:1313)
at oracle.jdbc.driver.OracleStatement.doExecuteOther
(OracleStatement.java:1232)
at oracle.jdbc.driver.OracleStatement.doExecuteWithBatch
(OracleStatement.java:1353)
at oracle.jdbc.driver.OracleStatement.doExecute
(OracleStatement.java:1760)
at
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout
(OracleStatement.java:1805)
at
oracle.jdbc.driver.OraclePreparedStatement.executeUpdate
(OraclePreparedStatement.java:322)
at oracle.jdbc.driver.OraclePreparedStatement.execute
(OraclePreparedStatement.java:366)
at com.oxmol.jdbc.ModificationStatement.execute
(ModificationStatement.java:189)
at com.oxmol.jdbc.UpdateStatement.execute
(UpdateStatement.java:152)
at com.oxmol.omp.schema.DefaultTypeProvider.merge
(DefaultTypeProvider.java:291)
at com.oxmol.omp.schema.Repository.mergeNode
(Repository.java:420)
at com.oxmol.omp.schema.Repository.mergeTree
(Repository.java:380)
at com.oxmol.omp.schema.Repository.mergeTree
(Repository.java:387)
at com.oxmol.omp.schema.Repository.merge
(Repository.java:217)
at com.oxmol.omp.oracle.OracleProvider.doMerge
(OracleProvider.java:207)
at com.oxmol.omp.QueueServicer.run
(RetrievalQueue.java:80)
at java.lang.Thread.run(Thread.java:484)
OracleSession getRepositorySession
RepositorySession getConnection
DOING ROLLBACK ****
thanx
Pooja
CONTENT_ID=?9? ... what does this syntax mean? It is not normal JDBC SQL syntax. That
and the earlier use of ? for quoting is the obvious source of the problem.
Also, are you using java.sql.PreparedStatement? If so, "into ?" won't work because
PreparedStatement has no getXXX() methods.
--
Lee Fesperman, FFE Software, Inc. (http://www.firstsql.com)
===================================================================
* Check out Database Debunkings (http://www.firstsql.com/dbdebunk/)
* "The Forum Where Database Matters Are Set Straight"
>That error says the for the '?' in your statement >you haven't
>filled in all of the '?' with values.
If you look at the query all the values are embeded in ?.
Acutally the query is generated dynamically and the values
are inserted in the query from an object of vector class.
Please help
Regards
Pooja
>Full sql Statment begin update OMP_FILE_CONTENT set
>CONTENT_SIZE=?24064?,CONTENT=?<24380 byte(s)>? where
>CONTENT_ID=? 9? returning ROWID into ?; end;
>CONTENT_ID=?9? ... what does this syntax mean? It is not normal
>JDBC SQL syntax. That and the earlier use of ? for quoting is
>the obvious source of the problem.
>Also, are you using java.sql.PreparedStatement? If so, "into ?"
>won't work because PreparedStatement has no getXXX
Actually following is my code
int vSize = myParams.size() ;
System.out.println("Size = " + vSize );
for ( int i = 0 ; i < vSize ; i ++ )
{
System.out.println("Type = "+ myParams.elementAt
(i).getClass());
System.out.println("Type = "+ myParams.elementAt
(i).getClass().getName());
System.out.println("Type = "+ myParams.elementAt
(i).getClass().toString());
System.out.println("date = " + myParams.get(i).toString
());
if ( myParams.elementAt(i) instanceof java.util.Date )
{
try
{
System.out.println("date = " + myParams.get
(i).toString());
dFormat = xmlDateFormat.format(myParams.elementAt
(i));
java.util.Date ts = df.parse(dFormat.toString());
java.sql.Timestamp sts = new java.sql.Timestamp
(ts.getTime());
cs.setTimestamp(i + 1 , sts ) ;
}
catch (Exception pe)
{
System.out.println("Date format problem for" +
pe.getMessage() );
}
System.out.println("vector element = " + myParams.get
(i).toString());
}
else
{
if ( myParams.elementAt(i) instanceof
com.oxmol.jdbc.ByteArrayWrapper )
{
try
{
// cs.setBlob(i+1, (java.sql.Blob)
myParams.elementAt(i)) ;
// cs.setBytes(i+1,
((com.oxmol.jdbc.ByteArrayWrapper)myParams.elementAt(i)).getBytes
() );
// cs.setBlob( i+1 , (java.sql.)
((com.oxmol.jdbc.ByteArrayWrapper)myParams.elementAt(i)).getBytes
());
cs.setBytes( 1,((com.oxmol.jdbc.ByteArrayWrapper)
myParams.elementAt(i)).getBytes() );
}
catch (SQLException se)
{
System.out.println("Blob binding error " +
se.getMessage() );
}
}
if ( myParams.elementAt(i) instanceof java.lang.String )
{
try
{
cs.setString( i +1, (java.lang.String)
myParams.elementAt(i)) ;
System.out.println("date = " + myParams.get
(i).toString());
}
catch (Exception pe)
{
System.out.println("String format problem for" +
pe.getMessage() );
}
}
java.sql.Types.NUMERIC )
}
}
// Execute the statement
cs.execute();
I am converting the variables into appropriate data types
with the above code... but I get an exception as soon as I
execute the callable statment.
Please Help
Pooja
You code is mangled and includes explicit references to parameter 1, so I couldn't make
sense out of it.
However, I still ask --- what does "CONTENT_ID=?9?" mean? It is not proper syntax for a
parameter. You are using ? to 'quote' a value. That is not the way to use parameters.