#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Posts
    14
    Rep Power
    0

    imbricated SQL requests possible?


    Hi all!
    I'm trying to make a code like this work:

    sqlRequest = "request"
    try {
    sqlResultset = sqlStatement.executeQuery(sqlRequest);
    while (sqlResultset.next()) {


    /* s'y a ces lignes il ne met que la première action dans l'objet.
    sinon ça marche, il met les 5.

    String actID = String.valueOf(sqlResultset.getInt(1));
    sqlRequest = "SELECT actionowner.employeeID " +
    "FROM actionowner WHERE actionowner.meetingID = '" + id + "' " +
    "AND actionowner.actionID = '" + actID + "';";
    sqlResultsetOwners = sqlStatement.executeQuery(sqlRequest);
    while (sqlResultsetOwners.next()) {
    currentAction.addOwner(String.valueOf(sqlResultsetOwners.getInt(1)));
    }
    sqlResultsetOwners.close();

    */

    addAction(currentAction);
    }
    sqlResultset.close();
    }
    catch (SQLException E) { return -1; }
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Posts
    14
    Rep Power
    0

    Sorry!


    Sorry, I posted without finishing to write!!

    In fact the question is if it is possible to imbricate two statements. If you look the code I posted, you'll see commented lines. If I don't put these lines I got all the "actions" I want, but if I do, it gets only one action. (Every action has owners in a separated table).

    By the way, what are the (html?) tags to post code here?

    Thanks a lot!
    Tiago
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2002
    Posts
    14
    Rep Power
    0

    found the answer


    Ok, people, it is NOT possible to imbricate request this way. You must split your requests in two distinct ones.

    ::c ya!

IMN logo majestic logo threadwatch logo seochat tools logo