Trying to connect to Orace 10g -ORA-24374 (oci_fetch_row)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Highclass
Forum Newbie
Posts: 3
Joined: Wed May 30, 2012 10:59 am

Trying to connect to Orace 10g -ORA-24374 (oci_fetch_row)

Post by Highclass »

Hey guys,

i recieve an error after executing the following code:

Code: Select all

	$db = '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =XXX)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME=AUGEO) ) )';
	$con = oci_connect("XXX","XXX",$db);
	
	$query = "SELECT STRUCTURE_NAME FROM IP.STRUCTURE";


	$s = oci_parse($con, $query);	
	
	while ($ergrow = oci_fetch_row($s)) {
		$result[] = $ergrow;
	};
	oci_execute($s, OCI_DEFAULT);
	print_r(OCIError($s));


	$committed = oci_commit($con);
	
	oci_free_statement($s);
	oci_close($con);
  	return $result;

I´ve tried the same code with oci_fetch_array but it didn´t work too. I´m lost at this point. The database connection returns true and the table/column exists 100%.

Can´t remeber where, but i think i saw the line

Code: Select all

while ($ergrow = oci_fetch_row($s))
written like that, somewhere on the web.

Code: Select all

while ($ergrow =@ oci_fetch_row($s))

googled that for like an hour but couldn´t find what it does. Code executes that way, but the fetched rows are empty.....



Greetings,
Highclass
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Trying to connect to Orace 10g -ORA-24374 (oci_fetch_row

Post by Celauran »

Highclass wrote:i recieve an error
Could you be a bit more specific?
Highclass
Forum Newbie
Posts: 3
Joined: Wed May 30, 2012 10:59 am

Re: Trying to connect to Orace 10g -ORA-24374 (oci_fetch_row

Post by Highclass »

Of course :D
The headline kinda includes the error, but here we go:

Warning: oci_fetch_array() [function.oci-fetch-array]: ORA-24374 define not done before fetch or execute and fetch
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Trying to connect to Orace 10g -ORA-24374 (oci_fetch_row

Post by Celauran »

I'm no expert on working with Oracle, but shouldn't your execute() call come before you start fetching rows?
Highclass
Forum Newbie
Posts: 3
Joined: Wed May 30, 2012 10:59 am

Re: Trying to connect to Orace 10g -ORA-24374 (oci_fetch_row

Post by Highclass »

.....u´re right....

ty =)
Post Reply