Please help! Dyn SQL 4 dupe inserts

From: MAX M. MAGLIARO <mmm_at_icf.hrb.com>
Date: 13 Aug 94 22:27:44 EST
Message-ID: <1994Aug13.222744.21694_at_icf.hrb.com>


I have posted this question before, and received no reply, but ORACLE support has been useless (in fact, it's been weeks since I called them and they have not even looked at my problem), and I am desperate.

I have a ProFORTRAN application, using dynamic SQL method 4. I can query fine. I can execute simple SQL that has no returned data such as an "ALTER TABLE" fine. The queries are fully dynamic... i.e. all the fields to be selected are dynamic and described in a SEL descriptor, and all the data retrieved in placed into host arrays, and any constraints in the WHERE clause are all bound variables like ":FRED" that are described in a BND descriptor.

What's the problem...? Inserts...

Fully dynamically bound inserts...

They work fine BUT, the first record inserted is always inserted twice!

I.E. I am inserting a bunch of records, and their data is

     contained in host arrays.  I set up a BND descriptor
     with the addresses, types, lengths, etc of each
     column.  I use an:

             EXEC SQL FOR :SIZE EXECUTE S1 USING DESCRIPTOR BND

     (and yes, :SIZE is right, I printed it out in debug).

     If SIZE is 1, the 1st record is inserted twice.
     If SIZE is 10, "   "    "    "    "       "   and all the
        rest are done right (so I get 11).

     Obviously, if I try this on a table that has a unique
     constraint on any column, the insert fails because I
     basically try to insert the same values twice.

 I have programmed in ProFORTRAN for about a year and half  now, using dynamic SQL and bind descriptors, and have never  had this happen....

 Can anyone help???
 mmm_at_icf.hrb.com

-- 
Max Magliaro
MMM_at_ICF.HRB.COM
Philipsburg, Pennsylvania

"He may look like an idiot, and he may sound like an idiot, but don't
 let him fool you.  He really is an idiot." --- Groucho Marx
Received on Sun Aug 14 1994 - 05:27:44 CEST

Original text of this message