ocinewcollection
<<<
ocinewcursor ocinewdescriptor
>>>

8.85 Oracle 8
8 Référence des fonctions
 Manuel PHP

Introduction
Pré-requis
Installation
Configuration à l'exécution
Types de ressources
Constantes pré-définies
Exemples
oci_bind_by_name
oci_cancel
oci_close
OCI-Collection->append
OCI-Collection->assign
OCI-Collection->assignElem
OCI-Collection->getElem
OCI-Collection->free
OCI-Collection->max
OCI-Collection->size
OCI-Collection->trim
oci_commit
oci_connect
oci_define_by_name
oci_error
oci_execute
oci_fetch_all
oci_fetch_array
oci_fetch_assoc
oci_fetch_object
oci_fetch_row
oci_fetch
oci_field_is_null
oci_field_name
oci_field_precision
oci_field_scale
oci_field_size
oci_field_type_raw
oci_field_type
descriptor->free
oci_free_statement
oci_internal_debug
lob->append
lob->close
oci_lob_copy
lob->eof
lob->erase
lob->export
lob->flush
lob->import
oci_lob_is_equal
lob->load
lob->read
lob->rewind
lob->save
lob->seek
lob->size
lob->tell
lob->truncate
lob->writeTemporary
lob->write
oci_new_collection
oci_new_connect
oci_new_cursor
oci_new_descriptor
oci_num_fields
oci_num_rows
oci_parse
oci_password_change
oci_pconnect
oci_result
oci_rollback
oci_server_version
oci_set_prefetch
oci_statement_type
ocibindbyname
ocicancel
ocicloselob
ocicollappend
ocicollassign
ocicollassignelem
ocicollgetelem
ocicollmax
ocicollsize
ocicolltrim
ocicolumnisnull
ocicolumnname
ocicolumnprecision
ocicolumnscale
ocicolumnsize
ocicolumntype
ocicolumntyperaw
ocicommit
ocidefinebyname
ocierror
ociexecute
ocifetch
ocifetchinto
ocifetchstatement
ocifreecollection
ocifreecursor
ocifreedesc
ocifreestatement
lob->getBuffering
ociinternaldebug
ociloadlob
ocilogoff
ocilogon
ocinewcollection
->ocinewcursor
ocinewdescriptor
ocinlogon
ocinumcols
ociparse
ociplogon
ociresult
ocirollback
ocirowcount
ocisavelob
ocisavelobfile
ociserverversion
lob->setBuffering
ocisetprefetch
ocistatementtype
ociwritelobtofile
ociwritetemporarylob

8.85.107 ocinewcursor() Retourne un nouveau pointeur à utiliser pour lier les pointeurs de références

[ Exemples avec ocinewcursor ]   PHP 3>= 3.0.8, PHP 4 , PHP 5

resource  ocinewcursor ( resource   conn )

ocinewcursor alloue un nouveau pointeur de commande, pour la connexion conn .

Utiliser un REF CURSOR issue d'une procédure enregistrée

<?php   
// supposons que votre procédure stockée info.output retourne un curseur de référence dans :data

$conn = OCILogon("scott", "tiger");
$curs = OCINewCursor($conn);
$stmt = OCIParse($conn, "begin info.output(:data); end;");

ocibindbyname($stmt, "data", $curs, -1, OCI_B_CURSOR);
ociexecute($stmt);
ociexecute($curs);

while (
OCIFetchInto($curs, $data)) {
    
var_dump($data);
}

OCIFreeStatement($stmt);
OCIFreeCursor($curs);
OCILogoff($conn);
?>

Utiliser un REF CURSOR issue d'une commande SELECT

<?php   
echo '<html><body>';
$conn = OCILogon("scott","tiger");
$count_cursor = "CURSOR(select count(empno) num_emps from emp " .
                
"where emp.deptno = dept.deptno) as EMPCNT from dept";
$stmt = OCIParse($conn,"select deptno,dname,$count_cursor");

ociexecute($stmt);
echo
'<table>';
echo
'<tr>';
echo
'<th>DEPT NAME</th>';
echo
'<th>DEPT #</th>';
echo
'<th># EMPLOYEES</th>';
echo
'</tr>';

while (
OCIFetchInto($stmt,&$data,OCI_ASSOC)) {
    echo
'<tr>';
    
$dname  = $data["DNAME"];
    
$deptno = $data["DEPTNO"];
    echo
'<td>' . $dname . '</td>';
    echo
'<td>' . $deptno . '</td>';
    
ociexecute($data["EMPCNT"]);
    while (
OCIFetchInto($data["EMPCNT"],&$subdata,OCI_ASSOC)) {
        
$num_emps = $subdata["NUM_EMPS"];
        echo
'<td>' . $num_emps . '</td>';
    }
    echo
'</tr>';
}
echo
'</table>';
echo
'</body></html>';
OCIFreeStatement($stmt);
OCILogoff($conn);
?>

Note

Cette fonction a été renommée en oci_new_cursor pour PHP version 5.0.0 et plus récent. Pour la compatibilité ascendante, ocinewcursor peut toujours être utilisée. Toutefois, elle est obsolète.

<< ocinewcursor >>
ocinewcollection Oracle 8 ocinewdescriptor