Re: Problem with Oracle

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In Oracle you would write: insert into pts (pid, txt) values (1,'502a');

But in PHP you are going to do the following:

$conn = oci_connect('scott','tiger','my_db');
$sql = "insert into pts (pid, txt) values (1,'502a')";
$cursor = oci_parse($conn, $sql);
if (! $cursor)
{ $err = oci_error($conn);
  print htmlentities($e['message']);
   exit;
}
$results = oci_execute($cursor);
oci_commit($conn);
oci_close($conn);

The difference is that in PHP it appends a command seperator during the 
parsing.  A simple thing is to remove the trailing comma from the parsed 
SQL or remove it from the file.

Roy A. Jones 




"Rosen" <rosen@xxxxxxxxxxxxxx> 
23-Oct-2006 19:21
 
To
php-db@xxxxxxxxxxxxx
cc

Subject
 Problem with Oracle






Hi,
I have a problem with PHP and Oracle 10 Database.
I read sql script from file and execute it.
Files are something like this:

insert into pts (pid, txt) values (1,'502a');
insert into pts (pid, txt) values (2,'502b');
.....

I receive a message: "ORA-00911: invalid character"
When I remove manually the ";" from the end of every row and execute 
separate every command
everything is ok.
I have and script files fo creating procedures/functions and there in not 
a 
problem with ";".

Where is the problem ? Why can not be used ";" as command separator from 
PHP 
?

Thanks in advance!
Rosen

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux