oracle function call problem .....

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    oracle function call problem .....

    i have a function which returns boolean ....

    how will i write .... registerOutPara meter of CallableStateme nt
    as there is no Types.BOOLEAN .... plz help me out .....thanxxx
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    #2
    here this is what i want ....

    look at the code carefully .....

    import java.sql.*;

    class JDBCTEST
    {
    public static void main(String args[]) throws Exception
    {
    Class.forName(" oracle.jdbc.dri ver.OracleDrive r");
    Connection l_con = DriverManager.g etConnection("j dbc:oracle:thin :@172.20.0.207: 1522:BCCLPROD", "pis","p0i0s4") ;
    CallableStateme nt csmt = l_con.prepareCa ll("{?=call sfn_pis_holiday _checking(?,?)} ");
    csmt.registerOu tParameter(1,Ty pes.BIT);
    csmt.setInt(2,2 007);
    csmt.setDate(3, new java.sql.Date(1 00000));
    csmt.execute();
    }
    }
    and the oracle function code is .....

    function sfn_pis_holiday _checking
    (p_calendar_yea r IN number,p_calend ar_date In DATE)
    return boolean
    AS
    l_count number:=0;
    begin
    l_count := 0;
    begin
    select count(a.CALENDA R_DATE) into l_count
    from T_PIS_HOLIDAY_C ALENDAR_DTL a,
    T_PIS_HOLIDAY_C ALENDAR_HDR b
    where a.CALENDAR_ID = b.CALENDAR_ID
    and b.CALENDAR_YEAR = p_calendar_year
    and a.holiday_type= 'N'
    and trunc(a.CALENDA R_DATE) = trunc(p_calenda r_date);
    exception
    when others
    then
    l_count := 0;
    end;
    IF l_count <> 0
    THEN
    return TRUE;
    ELSE
    return FALSE ;
    END IF;
    end;
    now i get an error ...


    PLS-00382: expression is of wrong type
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    void oracle.jdbc.dri ver.OracleState ment.doExecuteW ithTimeout()
    int oracle.jdbc.dri ver.OraclePrepa redStatement.ex ecuteUpdate()
    boolean oracle.jdbc.dri ver.OraclePrepa redStatement.ex ecute()
    void AnnTest1.main(j ava.lang.String[])
    Exception in thread main
    why this happens ... plz help me out .... thanxxxxx

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      Originally posted by dmjpro
      i have a function which returns boolean ....

      how will i write .... registerOutPara meter of CallableStateme nt
      as there is no Types.BOOLEAN .... plz help me out .....thanxxx
      Can you be more specific dj? What are you trying to do now?

      Comment

      • dmjpro
        Top Contributor
        • Jan 2007
        • 2476

        #4
        if my function returns boolean type then what should i do code in JDBC-2.0

        CallableStateme nt.registerOutP arameter(col_nu m,Types.what)


        plz help me out ......

        Comment

        • dmjpro
          Top Contributor
          • Jan 2007
          • 2476

          #5
          plz help me out ... it's urgent .....

          thanxxx

          Comment

          Working...