Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ORA-24374: define not done before fetch or execute and fetch

Tags:

php

oracle10g

Is this kind of if statement valid?

if($result1 = oci_fetch_array($oms_query2) != null){}

It returns the error:

Warning: oci_fetch_array() [function.oci-fetch-array]: ORA-24374: define not done before fetch or execute and fetch

Here's the code snippet:

$oms_query = oci_parse($conn_oms,"select * from R_VALIDATION order by query_id");
oci_execute($oms_query);            
while($row = oci_fetch_assoc($oms_query)) {
    extract($row);
    If ($ACTIVE=='Y') {
        $TOTAL++;
        $result = array();      
        $FIELD=explode(';',$FIELDS);
        $FIELD_COUNT=count($FIELD);
        $_SESSION[ 'field' ] = $FIELD;
        $_SESSION[ 'field_count' ] = $FIELD_COUNT;
        $testing = 0;
        $oms_query2 = oci_parse($conn_oms,$QUERY);
        oci_execute($oms_query2);   
        if($result1 = oci_fetch_array($oms_query2) != null) {
            var_dump($result1);
            $IMPACTED++;
            if($FIELD[0]!=null) {
                $oms_query3 = oci_parse($conn_oms,$QUERY);
                oci_execute($oms_query3); 
                while($result = oci_fetch_array($oms_query3))
                    $testing++;

                echo'<tr><td height="100%" bgcolor = "Linen" align="center" valign="middle"><b>'.$QUERY_ID.'</b></td><td bgcolor = "Linen"><b>'.$QUERY_NAME.'</b></td><td bgcolor = "Linen"><b>'.$QUERY_TYPE.'</b></td> <td bgcolor = "Linen" align="center" valign="middle"><b>'.$testing.'</b></td></tr>';            
            }
            oci_free_statement($oms_query2);
        }
    }
}
like image 446
Leomel Avatar asked Nov 08 '22 17:11

Leomel


1 Answers

At least in this piece of code your '$QUERY' variable is not set, for this reason it could not be parsed, and therefore fetch cant be executed.

like image 146
Thiago Ryuuga Avatar answered Nov 15 '22 05:11

Thiago Ryuuga