Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2003
    Posts
    71

    Unanswered: display boolean in procedure

    i have a out parameter of boolean type in stored procedure for which i am not able to display by dbms_output.

    can someone assist as to why bool variable is not displayed?

  2. #2
    Join Date
    Jan 2004
    Location
    North Haven, CT
    Posts
    110

    Re: display boolean in procedure

    Originally posted by skd
    i have a out parameter of boolean type in stored procedure for which i am not able to display by dbms_output.

    can someone assist as to why bool variable is not displayed?
    I think you basicly can only display charaters with dbms_output.
    Implicit conversion happens if you want to display other data types.
    There is no implicit available between boolean and varchar:

    declare
    b boolean := true;
    c varchar2(10);
    begin
    c := b;
    end;

    execute above code you will hit:
    ORA-06550: line 5, column 8:
    PLS-00382: expression is of wrong type
    ORA-06550: line 5, column 3:
    PL/SQL: Statement ignored

    So the workround is use if statement.

  3. #3
    Join Date
    Jan 2004
    Location
    India
    Posts
    62
    declare
    bool_exp boolean;
    begin
    bool_exp : =True;
    dbms_output.put_line (' The val is '|| bool_exp);
    end;
    Try this. It should work.
    or you can write IF/ELSE statement.
    if bool_exp = true then

    dbms_output.put_line ('TRUE');
    else

    dbms_output.put_line ('FALSE');

    end if;

    Another reason may be, the boolean variable might not be getting proper value when you return it from the procedure.
    So before you print it, just check it's value by some other method.
    Regards,

    Rushi

  4. #4
    Join Date
    Sep 2003
    Posts
    71
    Thanks Lynden, I had tested couple different ways and was coming to conlcusion that boolean can NOT be displayed using DBMS_OUTPUT.

    Just wanted to make sure ..


    Rushi, I am using almost similar way that you are suggesting to check return(out parameter,here) by manupulating if-else.

    Thanks to both of you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •