note 16671 deleted from ref.oci8 by sixd
| From: | sixd@php.net | Date: | Thu, 10 Apr 2008 22:41:26 +0000 |
| Subject: | note 16671 deleted from ref.oci8 by sixd | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-138171@lists.php.net to get a copy of this message | ||
Note Submitter: 85276 at gmx dot net
----
<?
// offset and limit feature for oracle 8 database selects
$conn = OCILogon("user","pw","server.world");
$sql="
declare
type c_type is ref cursor;
c_data c_type;
c_null tab.row_id%type;
begin
open :c_data for
select row_id from tab order by row_id;
while :c_data%rowcount < :c_init loop
fetch :c_data into c_null;
end loop;
end;
";
$stmt=OCIParse($conn, $sql);
$curs=OCINewCursor($conn);
$offset=100; // dont fetch the first 100 rows
$limit=10; // we want exactly 10 rows
OCIBindByName($stmt,":c_init",$offset,32);
OCIBindByName($stmt,":c_data",$curs,-1,OCI_B_CURSOR);
OCIExecute($stmt);
OCIExecute($curs);
for ($i=0;$i<$limit&&OCIFetchinto($curs,$cols,OCI_ASSOC);$i++)
print $cols[ROW_ID]."\n";
OCIFreeStatement($stmt);
OCIFreeCursor($curs);
OCILogoff($conn);
?>