#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2007
    Posts
    6
    Rep Power
    0

    ORA-01008: not all variables bound


    I have this error when I debug script: ORA-01008: not all variables bound. Please see and help code below:
    ...
    ls_sql =
    " SELECT" +
    " count(*)" +
    " FROM" +
    " t_cust" +
    " WHERE" +
    " cust_id = ? and" +
    " no_id = ?";

    lprepstmCI = lconnCI.prepareStatement(ls_sql);

    lrsCI = lstmCI.executeQuery(ls_sql);
    lrsCI.next();
    boolean lb_update = false;
    if (lrsCI.getInt(1) > 0)
    lb_update = true;
    lrsCI.close();
    lrsCI = null;
    ...
  2. #2
  3. AYBABTU
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jul 2004
    Location
    Here or There
    Posts
    1,256
    Rep Power
    380
    You have to bind the question marks ("?") in your preparedStatement to values before executing it.
    Something like:
    Code:
    lprepstmCI.setString(1, someCustomerId);//If customer id is a String value
    See preparedStatement and JDBC Introduction

    Comments on this post

    • Annie79 agrees
    A common mistake people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.
    Douglas Adams

IMN logo majestic logo threadwatch logo seochat tools logo