I agree that Curt's solution is the best in most circumstances.

If you are truly want the highest possible performance, you could try using
a stored procedure to do the insert and returning the ID as an output
parameter.

This will mean abandoning the MultiSQL, making your application's SQL non
portable, increasing you version control issues and getting into the general
hassles of stored procedures that were discussed in this thread recently.

But you will probably improve performance.

Brendan Johnston
TeamND


        -----Original Message-----
        From:   Curt Springer [SMTP:[EMAIL PROTECTED]]
        Sent:   Wednesday, June 16, 1999 7:03 AM
        To:     [EMAIL PROTECTED]
        Subject:        Re: [ND] Getting the results of an Insert

        I suggest that you get the unique value manually by using
executeImmediate,
        and then set it into the row via setValue, prior to the insert.
That way
        you will have the value and will be able to do whatever once you
know that
        the insert has succeeded.

        You would also need to clear the 'insert source/formulas' on the
data
        object column, if that's how you're doing  it now.

        -- Curt Springer, Team ND



        At 06:25 AM 6/16/99 -0800, [EMAIL PROTECTED] wrote:
        >Hello. My problem is as follows:
        >
        >1) I have a MultiSQL data object that inserts a record with 
        >   a computed row. This computed row generates a unique
        >   ID using NEXTVAL - this ID is the primary key of the table.
        >
        >2) After the insert, I would like to use the value of that
        >   computed ID for other data objects, since that ID field
        >   is a foreign key in other tables. That is, I could use that
        >   ID as a dynamic criterion with other inserts.
        >
        >So, is there a way I can retrieve the value of this
        >computed column (i.e. a getLastResults() for an Insert)
        >*without* re-executing the MultiSQL data object as a Select, 
        >and getting the value that way? I am afraid of taking the 
        >performance hit.
        >
        >TIA,
        >
        >John G. de Freitas
        
>_________________________________________________________________________
        >
        >For help in using, subscribing, and unsubscribing to the discussion
        >forums, please go to:
http://www.netdynamics.com/support/visitdevfor.html
        >
        >For dire need help, email: [EMAIL PROTECTED]
        > 
        
_________________________________________________________________________

        For help in using, subscribing, and unsubscribing to the discussion
        forums, please go to:
http://www.netdynamics.com/support/visitdevfor.html

        For dire need help, email: [EMAIL PROTECTED]
_________________________________________________________________________

For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html

For dire need help, email: [EMAIL PROTECTED]

Reply via email to