On Fri, 18 Jul 2003 16:37:39 -0400 "Shao, Chunning" <[EMAIL PROTECTED]> wrote:

> How could I pass a boolean value to the database through perl?

Note that "true" != TRUE in PL/SQL.  DBD::Oracle will only pass
NUMBER, VARCHAR, or CHAR values.

   $dbh -> {RaiseError} = 1;
   my $sth = $dbh -> prepare( <<END_SQL );
DECLARE
   bool_val BOOLEAN;
BEGIN
   IF :cascade = 0 THEN bool_val := FALSE; 
   ELSE                 bool_val := TRUE;
   END IF;

   -- Do Something

   IF bool_val THEN :cascade := 1;
   ELSE             :cascade := 0;
   END IF;
END;
END_SQL

   $sth -> bind_param_inout( ":cascade", 1 );
   $sth -> execute();

-- 
Mac :})
** I usually forward private questions to the appropriate mail list. **
Ask Smarter: http://www.catb.org/~esr/faqs/smart-questions.html
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.

Reply via email to