Calling oracle script from PHP

mooey1232003

Well-Known Member
Joined
Nov 29, 2005
Messages
212
Reaction score
1
Location
Cape Town
I'm having trouble executing a sql script from PHP. I have the following code on the PHP site
Code:
$SQLString = " Begin report_customer.sql ($CustNum)";

The script works because i execute it in sql cmdline. In the cmdline i use
Code:
START report_customer.sql 100

I just don't know what to put in the $SQLString on the site.
 
change your sqlstring to this:

"begin report_customer.sql($CustNum); end;"

It's essentially a PL/SQL block, so the ending semi colon and end statement are required.
 
I changed it to that but then i get this error
"Warning: oci_execute() [function.oci-execute]: ORA-06550: line 1, column 23: PLS-00103: Encountered the symbol "SQL" when expecting one of the following: <an identifier> <a double-quoted delimited-identifier> delete exists prior The symbol "<an identifier> was inserted before "SQL" to continue. in C:\public_html\DS\ReportClass.php on line 152"

So then i take the .sql away to make it "begin report_customer($CustNum); end;" Then i get this error
"Warning: oci_execute() [function.oci-execute]: ORA-06550: line 1, column 7: PLS-00201: identifier 'REPORT_CUSTOMER' must be declared ORA-06550: line 1, column 7: PL/SQL: Statement ignored in C:\public_html\DS\ReportClass.php on line 152"
 
Are you logging into the correct schema when you connect to Oracle in PHP? If not, try prefixing the call with the schema name, ie. "yourschema.report_customer.sql", or create a synonym for the package in whatever schema you are connecting to.
 
Thanks for the help but i think i'm just going to use normal select statements in the PHP code and make tables.
 
Top
Sign up to the MyBroadband newsletter
X