Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2003
    Posts
    2

    Red face Unanswered: Insert ... Select ... Returning !!

    I have a JSP program that receives SQL UPDATE/INSERT/DELETE statements as text from other JSPs (for different tables of my DB) and this program has to perform a select on the updated data...

    For INSERT statements, I tought of using PL/SQL's RETURNING clause to return the ROWID like that :

    CallableStatement stmt = conn.prepareCall("BEGIN " + insertStatement + " RETURNING ROWID INTO ?; END;");
    stmt.registerOutParameter(1, Types.VARCHAR);
    stmt.executeUpdate();
    rowId = stmt.getString(1);

    It worked great with INSERT...VALUES(...) statements, but with an INSERT...SELECT statement, it fails because this could insert more than one row.

    Is there a way of returning more than one ROWID, returning into an array or something... or maybe there's another approach I haven't tought of... ?

    Thanks

  2. #2
    Join Date
    Nov 2003
    Location
    Bangalore,India
    Posts
    51
    1. Using Returning to could stop your program for not considering for heterogenous databases.
    2. If it is purely oracle (in your case) avoid using returning to where it involves multiple fields
    3. You could create collection for this...but is it you really need?

Posting Permissions

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