Win a copy of Kubernetes in Action this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

Ranch Hand
Posts: 416
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to call a oracle function(oracle817) from my java application,the function receive two parameter (string and boolean) and return a code as:

DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc racle:thin:@ 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);

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(
at oracle.jdbc.ttc7.TTIoer.processError(
at oracle.jdbc.ttc7.Oall7.receive(
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(
at oracle.jdbc.driver.OracleStatement.executeNonQuery(
at oracle.jdbc.driver.OracleStatement.doExecuteOther(
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(
at oracle.jdbc.driver.OraclePreparedStatement.execute(
at test.entDbEJBTestClient1.main(

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!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!