Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Dynamic PL/SQL and boolean

Dynamic PL/SQL and boolean

From: Shaavik <shaavik_at_yahoo.com>
Date: Tue, 21 Nov 2000 02:06:51 +0100
Message-ID: <8vk9mj$17g$1@wanadoo.fr>

Hi,

I try to use dynamic SQL but I have a problem with boolean variable.

Can anyone explain me how to do this :

My pl/sql:

CREATE OR REPLACE FUNCTION ps_if( as_condition IN BOOLEAN, as_true IN VARCHAR2, as_false IN VARCHAR2 ) RETURN VARCHAR2

IS

    ls_retour VARCHAR2(2000);

    BEGIN         IF as_condition THEN

            ls_retour := as_true;

        ELSE             ls_retour := as_false;

        END IF;         RETURN ls_retour;

    EXCEPTION         WHEN OTHERS THEN             RETURN 'Error';

    END;
/

show errors;

My test :

set serveroutput on

/

BEGIN DECLARE li_cursor INTEGER;

li_dummy INTEGER;

ls_temp VARCHAR2(2000);

BEGIN li_cursor := dbms_sql.open_cursor;

dbms_sql.parse( li_cursor, 'SELECT ps_si(1''>''2, ''toto'', ''tata'') from dual', dbms_sql.V7);

dbms_sql.define_column( li_cursor, 1, ls_temp, 2000);

li_dummy := dbms_sql.execute_and_fetch( li_cursor, true);

dbms_sql.column_value( li_cursor, 1, ls_temp);

dbms_sql.close_cursor( li_cursor);

dbms_output.put_line( ls_temp);

end;

end;

/

show errors

/

RESULT: ORA-00907: missing right parenthesis

ORA-06512: at "SYS.DBMS_SYS_SQL", line 239

ORA-06512: at "SYS.DBMS_SQL", line 32

ORA-06512: at line 13 Received on Mon Nov 20 2000 - 19:06:51 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US