That's interesting. I haven't had to do too many queries with lots of
computed columns. I'll defer to you and double check my queries. On the
other hand, I have not run into any problems with truncated column data.

With regards to the server side cursors, why not send an anonymous PL/SQL
block? I don't suppose that it has to be a stored procedure...

Perhaps you're talking about the ability to output the result set from a
PL/SQL block to PHP. That's a curious puzzle. I haven't given it much
thought, mainly because I'm not too good at writing dynamic SQL in PL/SQL
(which is even less arbitrary, I believe, than the code I wrote below), but
what would happen if you built a PL/SQL table or array and bound that to a
PHP variable? Have you ever tried this?

It's nice to see someone with a lot of Oracle experience-- sometimes I think
that this is only for MySQL users!

Thanks,

Anthony Carlos

-----Original Message-----
From: Manuel Lemos [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 21, 2001 3:03 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] oracle (oci8) intro


Hello,

Anthony Carlos wrote:
>
> Here's what I'm using to do paged queries in Oracle:
>
> $min = minimum of range of records
> $max = maximum of range of records
> $field_list = the fields from the table separated by commas
> $table = the table from where you're selecting
> $where_clause and $order_by should be self-explanatory
>
> SELECT linenum, $field_list
>   FROM (SELECT rownum AS linenum, $field_list
>           FROM (SELECT $field_list
>                   FROM $table
>                  WHERE $where_clause
>                  ORDER BY $order_by))
>  WHERE linenum BETWEEN $min AND $max;

I afraid that this doesn't work well with arbitrary queries. I tried
this before and I recall there are problems with computed columns
(COUNT(), SUM(), etc...). If I am not mistaken there is also the problem
that Oracle truncates column names that are qualified with the table
names.

The right way to do that is using server side cursors, but I could not
figure how to return to the client side, a server side cursor that I
could use skip rows and get only those that I want.

Regards,
Manuel Lemos

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to