note 25988 deleted from function.ora-do by danbrown

From: Date: Fri, 26 Sep 2008 16:43:08 +0000
Subject: note 25988 deleted from function.ora-do by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-144806@lists.php.net to get a copy of this message
Note Submitter: bakerst at ctt dot com ---- 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?

« previous php.notes (#144806) next »