problem with setting parameter of a PreparedStatement

From: Oliver Hirschi (ohirschi_at_pm-medici.ch)
Date: 03/30/04

  • Next message: Manuel J. Goyenechea: "Re: Performance: "pl/sql" vs. "OS b-tree files""
    Date: Tue, 30 Mar 2004 08:56:09 +0200
    
    

    Hi netpeople.

    I have got a problem with setting parameters to a statement. I would
    like get the last inserted id of a table.

    The SQL statement for this on mssqlserver is:
    SELECT IDENT_CURRENT(<tablename>) AS <idfieldname>

    I use a PrepareStatement:
    SELECT IDENT_CURRENT(?) AS ?

    How do I set this parameter to the tablename and the idfieldname?
    I tried with:
    ------------------------------------------------------
    PreparedStatement oStmt = null;
    oStmt =
    m_oConn.prepareStatement(JDBCStmt.CBP_RETURNINTERFACE_UPDATE_CONTAINER);
    oStmt.setString(1, sTable);
    oStmt.setString(2, sField);
    -------------------------------------------------------
    But with this implementation, the executeQuery() fails.

    Special Thanks for your help.

    -- 
    Oliver Hirschi
    http://www.FamilyHirschi.ch
    

  • Next message: Manuel J. Goyenechea: "Re: Performance: "pl/sql" vs. "OS b-tree files""