/    Sign up×
Community /Pin to ProfileBookmark

Encountered the symbol "" when expecting one of..

i am calling a procedure from my php page, this is the code:

$sql=”Begin insert_input_file(‘$bat_no’,$stat,’$fullfill’,’$type’,$total,trunc(Sysdate),$iccid,$imsi,$s_msisdn,’$user_name’,$loop,
‘$graph’); End;”;

it works fine if i call it manully in oracle. but give me error message in my php page, this is the error message:

ORA-06550: line 1, column 127: PLS-00103: Encountered the symbol “” when expecting one of the following: ( – + case mod new not null others <an identifier> <a double-quoted delimited-identifier> <a bind variable> avg count current exists max min prior sql stddev sum variance execute forall merge time timestamp interval date <a string literal with character set specification> <a number> <a single-quoted SQL string> pipe <an alternatively-quoted string literal with character set specifi in ..

if anyone can help me in this regard.
thanks in advance.

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@zimonyiOct 19.2010 — Have you tried to call the stored procedure with hard coded values? The same ones as when you try to call the procedure from within the db.

I am not at all sure what happens when stored procedures are called via PHP (meaning I do not know if it also calls other DB functions before calling the stored procedure) but you have the:

trunc(Sysdate)

as an argument to your stored procedure. Will that call trunc() before your stored procedure or will that simply the the value of the argument to your stored procedure (as opposed to the truncated date you want)?

Archie
Copy linkTweet thisAlerts:
@momerauthorOct 19.2010 — yeah i did try it in that way. it was successfully run.

trunc(Sysdate) is simply an argument value to my procedure.


regards
Copy linkTweet thisAlerts:
@zimonyiOct 19.2010 — Have you tried to print all variables in PHP to see that they have values before you call the stored procedure? Could be some sort of null thing (or perhaps a special character thing).

Also, have you tried printing all the variables in the stored procedure (before the rest of the procedure logic)?

Archie
Copy linkTweet thisAlerts:
@momerauthorOct 19.2010 — Nothing is wrong in printing the values in both PHP before calling the procedure and in the stored procedure ;

i just tried it gives me output.
Copy linkTweet thisAlerts:
@zimonyiOct 19.2010 — So in your PHP script, it works with printing the values of the variables before you call the stored procedure.

You can call the stored procedure and you also print the same values you just sent in via the PHP script, but afterwards it crashes?

Very odd indeed.

I must say I am a little stumped.

Archie
Copy linkTweet thisAlerts:
@bene20Mar 12.2015 — It happens because the line breaks in you code.

You have two ways to solve this error:

1) You can remove the line breaks from your $sql variable before execute it, just like this:

$sql="Begin insert_input_file('$bat_no',$stat,'$fullfill','$type',$total,trunc(Sysdate),$iccid,$imsi,$s_msisdn,'$user_name',$loop,

'$graph'); End;";

$sql = preg_replace("/n/", "", $sql);

$sql = preg_replace("/r/", "", $sql);

... Then you execute you sql command...

2) Or you can eliminate the line break directly in you $sql variable assignment, by modifying your code into a single line, just like this:

$sql="Begin insert_input_file('$bat_no',$stat,'$fullfill','$type',$total,trunc(Sysdate),$iccid,$imsi,$s_msisdn,'$user_name',$loop, '$graph'); End;";
×

Success!

Help @momer spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...