Subject | Re: [IBO] Parameterized inserts? |
---|---|
Author | Helen Borrie |
Post date | 2002-11-07T10:51:19Z |
At 01:36 AM 07-11-02 -0800, you wrote:
same transaction. Your transaction can see everything that it has done so
far...
If you have to test for existence in a batch insert, you should *not* be
doing this in the client. I'm curious to know how you are doing
conditional insert/update in batch in a single DSQL statement.
Helen
>Thanks, Helen. Another question:The next insert will see anything that has already been inserted within the
>
>Here's what I'm actually doing in my loop:
>
>Grab the key from the source data record.
>Do a select to see if the key already exists.
>If (key doesn't exist)
> Insert it
>else
> Update it
>
>Now, with the scenario that you outlined below (Using the transaction),
>what will happen if the source data has the same key twice? If I'm not
>committing after each insert, will the next select accurately know whether
>or not the key already exists (if it was previously inserted but not
>committed)?
same transaction. Your transaction can see everything that it has done so
far...
If you have to test for existence in a batch insert, you should *not* be
doing this in the client. I'm curious to know how you are doing
conditional insert/update in batch in a single DSQL statement.
>One other thing: If I have a hard-coded value that I'm inserting into EVERYOf course. Don't make it a parameter at all, but a constant in the SQL.
>record, is there any performance benefit to hard coding it into the insert
>statement, as opposed to leaving it as a parameter that I set the same
>every time?
Helen