Page 1 of 1

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

Posted: Wed May 30, 2012 11:39 am
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

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

Posted: Wed May 30, 2012 11:41 am
by Celauran
Highclass wrote:i recieve an error
Could you be a bit more specific?

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

Posted: Thu May 31, 2012 2:50 am
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

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

Posted: Thu May 31, 2012 5:07 am
by Celauran
I'm no expert on working with Oracle, but shouldn't your execute() call come before you start fetching rows?

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

Posted: Thu May 31, 2012 5:45 am
by Highclass
.....u´re right....

ty =)