This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JDBC and the fly likes how can i pass the boolean data type from my java app to oracle function Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "how can i pass the boolean data type from my java app to oracle function" Watch "how can i pass the boolean data type from my java app to oracle function" New topic
Author

how can i pass the boolean data type from my java app to oracle function

zb cong
Ranch Hand

Joined: Jan 14, 2002
Posts: 416
hello
i want to call a oracle function(oracle817) from my java application,the function receive two parameter (string and boolean) and return a cursor.my code as:

DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc racle:thin:@192.168.0.200:1521 ral", "ciqfee", "ciqfeepwd");
String query = "begin :1 := test_func(:2,:3); end;";
CallableStatement cstmt = conn.prepareCall(query);
cstmt.registerOutParameter(1, OracleTypes.CURSOR);
cstmt.setString(2, "3703000032");
cstmt.setBoolean(3, true);
cstmt.execute();

when i execute it,it throw following exception:

java.sql.SQLException: ORA-06550: �ƒ���‚���‚�� 1 �ƒ���‚���‚�Œ, �ƒ���‚���‚�� 13 �ƒ���‚�ˆ�‚�—�ƒ���‚���‚�š
PLS-00306: �ƒ���‚���‚�ƒ�ƒ���‚�”�‚�� 'TEST_FUNC' �ƒ���‚�—�‚���ƒ���‚���‚�‚�ƒ���‚�•�‚���ƒ���‚�•�‚���ƒ���‚�‡�‚���ƒ���‚�ˆ�‚�–�ƒ���‚���‚���ƒ���‚�ž�‚�‹�ƒ���‚�”�‚�™�ƒ���‚���‚��
ORA-06550: �ƒ���‚���‚�� 1 �ƒ���‚���‚�Œ, �ƒ���‚���‚�� 7 �ƒ���‚�ˆ�‚�—�ƒ���‚���‚�š
PL/SQL: Statement ignored
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1900)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:407)
at test.entDbEJBTestClient1.main(entDbEJBTestClient1.java:264)


it is in chinese,means "parameter amount or type error",if i modify my program and the function,use the string as input param only,it works well,so i wonder how i can pass the boolean type param from java app to oracle function?
thanks very much!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how can i pass the boolean data type from my java app to oracle function
 
Similar Threads
init.ora parameter HELP
Determine the Callable Statements Parameters at runtime
select with an "in" clause...
invalid host/bind variable name
java.sql.SQLException: ORA-00900: invalid SQL statement