Hi guys. I have the following PLSQL procedure prototype as follows:

PROCEDURE validate_user ( p_event IN EVENT, p_user IN valid_users.userid%TYPE, p_password_only IN boolean, v_return_string OUT VARCHAR2)


My driver script for this is very simple:

#!/usr/bin/perl use DBI; $ENV{'ORACLE_HOME'} = '/space/oracle/app/oracle/product/8.1.5'; my $dbh = DBI->connect('my dsn',"bla bla","bla bla") or die("Can't con +nect to Oracle database: $DBI::errstr\n"); my $sql = "BEGIN campaign.validate_user(?, ?, ?, ?); END;"; my $sth = $dbh->prepare($sql); $sth->bind_param(1, 'V2001'); $sth->bind_param(2, 'billy'); $sth->bind_param(3, TRUE); my $error_string; my $return_code; $sth->bind_param_inout(4, \$return_code,1000); $sth->execute() or die("Execution error: $DBI::errstr\n"); print $error_string." : ".$return_code."\n"; $dbh->disconnect;


I'm having trouble with passing the value TRUE to the PLSQL procedure as perl seems to want to send it as a string which the procedure complains about.

The error returned is:

DBD::Oracle::st execute failed: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'VALIDATE_USE +R' ORA-06550: line 1, column 7: PL/SQL: Statement ignored (DBD ERROR: OCIStmtExecute) at ./nmsd.pl lin +e 27. Execution error: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'VALIDATE_USE +R' ORA-06550: line 1, column 7: PL/SQL: Statement ignored (DBD ERROR: OCIStmtExecute)


A way around it would be to change the stored procedure to accept a value 0 or 1 and interpret it as false and true, but I would rather sort this out on the perl end if possible :-)
Thanks for any help in advance.
Billy.

In reply to Passing boolean value to PLSQL procedure by Billy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.