The script then deletes * the selected rows using the ROWID and commits after each * set of $commitsize rows. (Use with care, there is no rollback) * / $conn = OCILogon($user, $password); $stmt = OCIParse($conn ,"select rowid from $table $where"); $rowid = OCINewDescriptor($conn,OCI_D_ROWID); OCIDefineByName($stmt ,"ROWID", $rowid); OCIExecute($stmt); while (OCIFetch($stmt)) {$nrows = OCIRowCount($stmt); $delete = OCIParse($conn ,"delete from $table where ROWID = :rid"); OCIBindByName($delete ,":rid", $rowid,-1,OCI_B_ROWID); OCIExecute($delete); print "$nrows\n"; if (($nrows% $commitsize) == 0) {OCICommit($conn);}} $nrows = OCIRowCount($stmt); print "$nrows deleted...\n"; OCIFreeStatement($stmt); OCILogoff($conn);?
?php / * Ce script est fait pour être appelé dans un formulaire HTML * Il attends les variables $user, $password, $table, $where, et $commitsize * Le script efface alors les lignes sélectionnées avec ROWID et valide * l'effacement après chaque groupe de $commitsize lignes. * (Utilisez avec prudence, car il n'y a pas d'annulation possible). * / $conn = ociLogon($user, $password); $stmt = ociparse($conn ,"select rowid from $table $where"); $rowid = ociNewDescriptor($conn,oci_D_ROWID); ociDefineByName($stmt ,"ROWID", $rowid); ociexecute($stmt); while (ociFetch($stmt)) {$nrows = ociRowCount($stmt); $delete = ociparse($conn ,"delete from $table where ROWID = :rid"); ociBindByName($delete ,":rid", $rowid,-1,oci_B_ROWID); ociexecute($delete); print "$nrows\n"; if (($nrows% $commitsize) == 0) {ociCommit($conn);}} $nrows = ociRowCount($stmt); print "$nrows effacées...\n"; ociFreeStatement($stmt); ociLogoff($conn);?