Fellow Monks,
I have a webpage that access a Oracle database, retrieves information and displays it. The sql is stored in the Perl scripts and executed and it all works really nicely.
However I want the Sql to be removed form the Perl, and use PL/SQL stored procedures instead. I've written the PL/SQL procedure and it compiles fine and works nicely.
I then took out the code for executing the sql script and replaced with code to execute a PL/SQL procedure.
I recieve the following error
ORA-00900: invalid SQL statement (DBD ERROR: OCIStmtExecute)
The code looks like this in the main Perlscript.($login_id is defined higher up.)
my $sth = $dbh_conn->run_query('check_user', 'exec Mrf_Maint.check_use
+r ?', $login_id);
run_query is another sub routine in a Perl module and looks like this.
sub run_query {
my $self = shift;
my $name = shift;
my $query = shift;
my $sth = $self->{'_conn'}->prepare($query) || print $DBI::errstr;
+
$sth->execute(@_) || print $DBI::errstr;
return $sth;
}
Please note I want this sub routine to be used from several webpages/applications so I don't know how many params will be coming in for each call, therefore I pass in @_ to the execute which then binds the params automamtically for me.
Why does the code work for a SQL script embedded into the Perl but not work for a stored procedure call. I've also granted all the the PL/SQL stored procedure.
Any pointers really will be appreciated. Thanks in advance.
Ant
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.