DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: How to use boolean variable in JDBC

  1. #1
    Join Date
    Sep 2001
    Posts
    99
    I created this package as follows:
    create or replace package trypa is
    function e(tryp boolean) return number;
    end trypa;
    /
    create or replace package body trypa is
    function e(tryp boolean) return number
    as
    begin
    return 1;
    end;
    end trypa;

    then I created a java file like this:
    package test;

    import java.io.*;
    import java.util.*;
    import conn.*;
    import java.sql.*;
    import oracle.jdbc.driver.*;

    public class readData {
    public static void main(String[] args) {
    try {
    Connect connPool = new Connect();
    Connection myConn = connPool.getConnection();
    CallableStatement cs = myConn.prepareCall("{?=call trypa.e(?)}");
    cs.registerOutParameter(1,OracleTypes.NUMBER);
    boolean b;
    b = true;
    cs.setBoolean(2,b);
    cs.execute();
    }
    catch (Exception e)
    {
    System.out.println("error1£º"+e.getMessage());
    }
    }
    }

    But an error occured.
    error1£ºORA-06550: µÚ 1 ÐÐ, µÚ 13 ÁÐ:
    PLS-00306: µ÷Óà 'E' ʱ²ÎÊýÊýÁ¿»òÀ*ÐÍ´*Îó
    ORA-06550: µÚ 1 ÐÐ, µÚ 7 ÁÐ:
    PL/SQL: Statement ignored
    I use Chinese Version. The error is parameter counts error or type error.
    If I replace boolean to number, it works well.
    How can I transfer a boolean variable?
    Please help
    thanks
    ocean

  2. #2
    Join Date
    Oct 2000
    Location
    Saskatoon, SK, Canada
    Posts
    3,925
    Thanx
    Sam



    Life is a journey, not a destination!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width