Home » SQL & PL/SQL » SQL & PL/SQL » ORA-06550: line 1, column 8: PLS-00103 (Oracle 10g, PHP)
ORA-06550: line 1, column 8: PLS-00103 [message #350409] Thu, 25 September 2008 00:04 Go to next message
wasimhc
Messages: 8
Registered: September 2008
Junior Member
I have got the following error:

Warning: oci_execute() [function.oci-execute]: ORA-06550: line 1, column 8: 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 E:\Web\WebServer\Apache2\htdocs\login5\test_bfile_select.php on line 48
1: /

My code is in PHP with oracle procedure as follows:

<?php
$conn = oci_connect('scott', 'tiger', '//localhost/orcl');

$sql = "SELECT
          id
        FROM
          mylobs
        WHERE
          -- Select only BFILES which are not null
          mybfile IS NOT NULL";

$stmt1 = oci_parse($conn, $sql);

oci_execute($stmt1)
    or die ("Unable to execute query\n");

$sql = "DECLARE
          locator BFILE;
          diralias VARCHAR2(30);
          filename VARCHAR2(30);
           
        BEGIN
          
          SELECT
            mybfile INTO locator
          FROM
            mylobs
          WHERE
            id = :id;
          
          -- Get the filename from the BFILE
          DBMS_LOB.FILEGETNAME(locator, diralias, filename);
          
          -- Assign OUT params to bind parameters
          :diralias:=diralias;
          :filename:=filename;
          
       END;";

$stmt2 = oci_parse($conn, $sql);

while ( $row = oci_fetch_assoc ($stmt1) ) {
    
    oci_bind_by_name($stmt2, ":id", $row['ID']);
    oci_bind_by_name ($stmt2, ":diralias", $diralias,30);
    oci_bind_by_name ($stmt2, ":filename", $filename,30);
    
    oci_execute($stmt2);
    print "{$row['ID']}: $diralias/$filename\n";
    
}
oci_close($conn);
?>


[Edit MC: add code tags]

[Updated on: Thu, 25 September 2008 01:19] by Moderator

Report message to a moderator

Re: ORA-06550: line 1, column 8: PLS-00103 [message #350441 is a reply to message #350409] Thu, 25 September 2008 01:23 Go to previous messageGo to next message
Michel Cadot
Messages: 68733
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
I don't see anything, can you execute the PL/SQL block in SQL*Plus.

Also, please read OraFAQ Forum Guide, especially "How to format your post?" section and about code tags.
Use the "Preview Message" button to verify.

Regards
Michel
Re: ORA-06550: line 1, column 8: PLS-00103 [message #352429 is a reply to message #350409] Tue, 07 October 2008 10:21 Go to previous messageGo to next message
wasimhc
Messages: 8
Registered: September 2008
Junior Member
This code is based on PHP and Oracle. Only the following code is PL/SQL based:

DECLARE
 locator BFILE;
 diralias VARCHAR2(30);
 filename VARCHAR2(30);
           
 BEGIN
          
 SELECT
   mybfile INTO locator
 FROM
   mylobs
 WHERE
   id = :id;
          
 -- Get the filename from the BFILE
 DBMS_LOB.FILEGETNAME(locator, diralias, filename);
          
 -- Assign OUT params to bind parameters
 :diralias:=diralias;
 :filename:=filename;
          
END;
Re: ORA-06550: line 1, column 8: PLS-00103 [message #352430 is a reply to message #352429] Tue, 07 October 2008 10:23 Go to previous messageGo to next message
Michel Cadot
Messages: 68733
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Quote:
Only the following code is PL/SQL based:

Yes, and can you execute it in SQL*Plus and post the result.

Regards
Michel
Re: ORA-06550: line 1, column 8: PLS-00103 [message #352445 is a reply to message #352429] Tue, 07 October 2008 13:14 Go to previous messageGo to next message
wasimhc
Messages: 8
Registered: September 2008
Junior Member
SP2-0552: Bind variable "FILENAME" not declared.
Re: ORA-06550: line 1, column 8: PLS-00103 [message #352488 is a reply to message #352445] Wed, 08 October 2008 01:06 Go to previous messageGo to next message
Michel Cadot
Messages: 68733
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
You didn't declare :XXXX variables before executing the PL/SQL block. Do it and retry.

Regards
Michel
Re: ORA-06550: line 1, column 8: PLS-00103 [message #352544 is a reply to message #352488] Wed, 08 October 2008 05:55 Go to previous messageGo to next message
wasimhc
Messages: 8
Registered: September 2008
Junior Member
Thanks for reply.

In this PL/SQL procedure, there are declared 3 variables (ID, FILENAME, DIRALIAS). ID is input variable and other 2 are output variables which contain results.

Do I have to DEFINE/DECLARE out parameters.

Regards,
Wasim
Re: ORA-06550: line 1, column 8: PLS-00103 [message #352555 is a reply to message #352544] Wed, 08 October 2008 06:41 Go to previous messageGo to next message
Michel Cadot
Messages: 68733
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Yes, you have to otherwise Oracle will not know where to put the output values.

Regards
Michel
Re: ORA-06550: line 1, column 8: PLS-00103 [message #354353 is a reply to message #352555] Sat, 18 October 2008 00:25 Go to previous messageGo to next message
wasimhc
Messages: 8
Registered: September 2008
Junior Member
I think I require more help. Long time I am not able to solve it.
Could you give me more details suggestions?
Thanks again.
Regards,
Wasim
Re: ORA-06550: line 1, column 8: PLS-00103 [message #413585 is a reply to message #354353] Thu, 16 July 2009 09:08 Go to previous message
dfox
Messages: 1
Registered: July 2009
Location: Buffalo, NY
Junior Member
Greetings,

Whenever I've run into this:
PHP Code generating
ORA-06550 and
Encountered the symbol "" in the error
and the PL/SQL code executes fine in something like SQL*PLUS.

The issue has been the dos vs unix end-of-line, carriage return/newline vs newline.

If you are on a Linux/Unix system I would suggest executing an:
od -cx {filename} on the PHP file and inspecting for that.
and/or
dos2unix {filename} to change the end-of-line to unix and
trying again.

Luck,
Dave
Previous Topic: ORA-02437
Next Topic: Connect by error
Goto Forum:
  


Current Time: Tue Feb 11 10:21:15 CST 2025