Dyn SQL 4 Dupe Inserts Partly Fixed

From: MAX M. MAGLIARO <mmm_at_icf.hrb.com>
Date: 25 Aug 94 17:49:43 EST
Message-ID: <1994Aug25.174943.21746_at_icf.hrb.com>


Many thanks to those who responded to my pleas for help on the problem of the 1st record always being inserted twice when using ProFORTRAN and dynamic SQL method 4.

Believe it or not, ORACLE support finally replied to me today, with a *partial* solution (after 3-1/2 weeks!).

Basically, I had a

    EXEC SQL OPEN CURSOR C2 USING DESCRIPTOR BND
.
.
.

    EXEC SQL FOR :O_SIZE EXECUTE S2 USING DESCRIPTOR BND They informed me that the OPEN actually executes the INSERT, (and since it has no size field, it inserts only 1 row), so the EXEC SQL then inserts the 1st record AGAIN.

Ok, Ok, my fault. But...
They told me to just take out the OPEN, and that causes me to get ORA-01008 not all variables bound

errors. If I get rid of the EXEC SQL, and leave the OPEN, I can insert only 1 row.

I have now tried:

    EXEC SQL FOR :O_SIZE OPEN CURSOR C2 USING DESCRIPTOR BND The compiler didn't barf on this, and it seems to work. Am I in trouble doing this? Does this actually open the cursor :O_SIZE times (which I really don't want!)?

Also, can anyone tell me why ORACLE thinks my variables are not bound? I filled in all the fields of the BND descriptor, and they obviously work for the OPEN statement, so why not for the EXEC?

-- 
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 Fri Aug 26 1994 - 00:49:43 CEST

Original text of this message