OCI error

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
lipun4u
Forum Commoner
Posts: 82
Joined: Wed Jul 01, 2009 3:35 am
Location: Mumbai
Contact:

OCI error

Post by lipun4u »

Kindly check the following code...

Code: Select all

<?php
	$conn = oci_connect("hr","hrpassword", "XE");
	if(!$conn)
	{
		$e = oci_error();
		echo $e['message'];
	}
	
	$p1 = 'TCS';
	$stid = oci_parse($conn, "select * from stock_comment where upper(stc_comment) like %:p1%");
	oci_bind_by_name($stid, ':p1', $p1);
	
	oci_execute($stid);
	
	echo "<table border='1'>\n";
	
	while($row = oci_fetch_array($stid,  OCI_ASSOC+OCI_RETURN_NULLS))
	{
		echo "<tr>\n";
		foreach($item as $row)
		{
			echo "<td>" . $item . "</td>\n";
		}
		echo "</tr>\n";
	}
	echo "</table>\n";
		
	
	oci_free_statement($stid);
	oci_close($conn);
?>
when i run the code, the following error comes...


Warning: oci_execute() [function.oci-execute]: ORA-00911: invalid character in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\ora2.php on line 13

Warning: oci_fetch_array() [function.oci-fetch-array]: ORA-24374: define not done before fetch or execute and fetch in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\ora2.php on line 17


Can somebody tell me what is the error at line 13 ?
mikosiko
Forum Regular
Posts: 757
Joined: Wed Jan 13, 2010 7:22 pm

Re: OCI error

Post by mikosiko »

Code: Select all

        $stid = oci_parse($conn, "select * from stock_comment where upper(stc_comment) like %:p1%");
Invalid SQL sentence ....

Code: Select all

LIKE '%<variable-here>%'
lipun4u
Forum Commoner
Posts: 82
Joined: Wed Jul 01, 2009 3:35 am
Location: Mumbai
Contact:

Re: OCI error

Post by lipun4u »

thanx a lot....
Post Reply