[DB-SIG] ORA-24374 when selecting under DCOracle2

Eric Brunson brunson@level3.net
Mon, 5 Feb 2001 19:03:49 -0700


I just pulled the DCOracle2 package and with a few minor changes got
it to compile on my Solaris box.

However, I'm getting the following error when trying to do *any*
select from python using it.  This is a simple example, but all of the
test scripts 2-5 fail with the same error.

>>> import DCOracle2
>>> dbc = DCOracle2.Connect( 'scott/tiger' )
>>> c = dbc.cursor()
>>> c.execute( 'select * from dual' )
Traceback (innermost last):
  File "<stdin>", line 1, in ?
  File "DCOracle2/DCOracle2.py", line 305, in execute
    self._cursor.execute(params)
OracleError: (24374, 'ORA-24374: define not done before fetch or execute and fetch')

Oracle has this to say:

orb(~/src/DCO2/test)$ oerr ORA 24374
24374, 00000, "define not done before fetch or execute and fetch"
// *Cause:  The application did not define output variables for data being
//          fetched before issuing a fetch call or invoking a fetch by
//          specifying a non-zero row count in an execute call.
// *Action: Issue OCI define calls for the columns to be fetched.


Here's the offending code:

    def execute(self, operation, *params):
        if self._operation != operation:
                self._cursor.prepare(operation)
                self._operation = operation
        i = 0
        for p in params:
            i = i + 1
            if type(p) == types.TupleType:
                self._cursor.bindbypos(i, p[0], p[1])
            else:
                self._cursor.bindbypos(i, p)
        self._cursor.execute(params) <<<<<<<<<<<<<<<<<<<<<<<<
        self.description = self.describe()

But I'm not sure where the bind should have been done.  I don't think
it can be done up front, since the static SQL is passed into this very
function.

Anyway, I'm running Oracle 8.0.5 on Solaris 2.6.1, so does anyone know
of problems with either of those?  Do I need a newer Oracle?

Thanks,
e.

-- 
Eric Brunson - brunson@level3.net - page-eric@level3.net  

"When governments fear the people there is liberty. When the people
fear the government there is tyranny." - Thomas Jefferson