note 25988 added to function.ora-do
| From: | bakerst at ctt dot com | Date: | Mon, 14 Oct 2002 16:55:37 +0000 |
| Subject: | note 25988 added to function.ora-do | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-38058@lists.php.net to get a copy of this message | ||
As far as I'm concerned, this ora_do function should not be used in most cases. I was unable to
catch errors when using this function, b/c it does the first fetch for you before you can even check
if there's anything to fetch. Therefore, if there's a chance you won't get records
back when running your query, using this function will not make it any easier for you. The best way
to retrieve your data is to use this process:
$strThis = ora_logon("username@sid", "password");
$my_cursor = ora_open($my_db_conn);
ora_parse($my_cursor, $my_query, 0);
ora_exec($my_cursor);
then, so you don't get the "NO DATA FOUND" error from oracle when trying to fetch 0
records, check if it is possible to fetch the first record:
if (ora_fetch($my_cursor)) {
do soemthing;
} else {
raise an error (query returned no records);
}
don't forget, when you do the check, if the result is true, then you just fetched the first
record. so if you try to do another fetch afterwards, that will not be the first record, it will be
the second record. so use this method if it works for you.
easy, huh?
--
http://www.php.net/manual/en/function.ora-do.php
http://master.php.net/manage/user-notes.php?action=edit+25988
http://master.php.net/manage/user-notes.php?action=delete+25988
http://master.php.net/manage/user-notes.php?action=reject+25988