Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2003
    Posts
    8

    Unanswered: Calling Oracle Function

    Hi,
    Please help me out with ORA-01008 not all variables bound

    Here is the JAVA Code ......
    final int numParams = 1;
    conn = SOTDBConnection.login();
    CallableStatement cs = conn.prepareCall("{ ? = call Round(?,?,?)}");
    cs.registerOutParameter(numParams, Types.INTEGER);
    cs.setString(2, currency);
    cs.setString(3, extendedCountry);

    for(int row = 0;row < numLines;row++)
    {
    String [] l = (String []) lines.get(row);
    tot = l[TOTAL];

    if(!tot.equals(""))
    {
    StringBuffer b = new StringBuffer(tot.length());
    b.setLength(tot.length());
    int current = 0;
    for(int i = 0;i < tot.length();i++)
    {
    char ch = tot.charAt(i);
    if(ch != ',')
    {
    b.setCharAt(current++, ch);
    }
    }
    String noComma = b.toString();
    cs.setDouble(1, Double.parseDouble(noComma));
    cs.execute();
    double price = Double.parseDouble(cs.getString(1));

    NumberFormat nf = NumberFormat.getNumberInstance();
    nf.setMaximumFractionDigits(numDecimals);
    nf.setMinimumFractionDigits(numDecimals);
    tot = new String(nf.format(price));
    data.set(row*numColumns + TOTAL, tot);
    }
    }
    }


    PL/SQL
    CREATE OR REPLACE FUNCTION Round(ip_input_value IN NUMBER,
    ip_curr_code IN VARCHAR2, ip_ext_cty IN VARCHAR2)
    RETURN NUMBER IS

    lv_round_factor currency.rounding_factor%TYPE;
    lv_new_value NUMBER(19,11);

    BEGIN

    .......
    .............

    RETURN (lv_new_value * 12);
    END Round;
    Last edited by gkkumar; 03-06-03 at 12:03.

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: Calling Oracle Function

    Well I'm not familiar with calling PL/SQL from Java, but haven't you forgotten to pass in a value for the first parameter? Presumably something like:

    cs.setNumber(1, amount);

  3. #3
    Join Date
    Feb 2003
    Posts
    8

    Calling Oracle Function

    THANKS ALL......

    PROBLEM SOLVED .....DONT TRY

Posting Permissions

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