Windows + php + oracle PL/SQL = ORA-06550
| From: | Martin Jerga | Date: | Thu, 13 Mar 2008 17:29:30 +0000 |
| Subject: | Windows + php + oracle PL/SQL = ORA-06550 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-271529@lists.php.net to get a copy of this message | ||
Hello everyone,
I just installed Zend Core 2.5.0 (simply apache + php 5) with oracle instant client. I enabled the oracle extension. Everything works ok, but I ran into one strange problem.
I can connect to the oracle server without problems, I can also perform SELECTs,INSERTs, etc. The problems start when I try to execute a PL/SQL script. E.g.
Lets have these 2 oracle tables.
CREATE TABLE TABLE_A
(
AID NUMBER,ADATA VARCHAR2(255 BYTE) ) CREATE TABLE TABLE_B (
BID NUMBER, AID NUMBER,BDATA VARCHAR2(255 BYTE) ) INSERT INTO TABLE_A (AID) VALUES (0) INSERT INTO TABLE_B (BID) VALUES (0) lets try to execute very simple PL/SQL DECLARE AAID NUMBER; BEGIN SELECT MAX(AAID)+1 INTO AAID FROM TABLE_A; INSERT INTO TABLE_A ( aid,adata) VALUES ( AAID , 'table_a data'); INSERT INTO TABLE_B ( bid, aid,bdata) VALUES ( (SELECT MAX(bid)+1 FROM TABLE_B) ,AAID , 'table_b data'); END; I can execute this script through TOAD or using simple Java script. But if I try to execute this script using the next php on the Zend Core, I get this warning. Quote: PHP Warning: oci_execute(): ORA-06550: line 1, column 21: PLS-00103: Encountered the symbol "" when expecting one of the following: begin function package pragma procedure subtype type use <an identifier> <a double-quoted delimited-identifier> form current cursor in C:\Program Files\Zend\Apache2\htdocs\coreLib\get_event_itm\test.php on line 21 Here is the very simplified code I'm using <?php error_reporting ( E_ALL ); $link = oci_connect("USER","PASSWORD","HOST"); $query = "DECLARE AAID NUMBER; BEGIN SELECT MAX(AAID)+1 INTO AAID FROM TABLE_A; INSERT INTO TABLE_A ( aid,adata) VALUES ( AAID , 'table_a data'); INSERT INTO TABLE_B ( bid, aid,bdata) VALUES ( (SELECT MAX(bid)+1 FROM TABLE_B) ,AAID , 'table_b data'); END;"; $result = oci_parse ( $link, $query ); $status = oci_execute ( $result ); ?> Note: When I deployed this script onto the production server, running php5 on RH4, it finnished without problems. To be honest, I don't even have an idea where the problem can be. I would be very thankful for any suggestions. thank you Martin