Mega Code Archive

 
Categories / Oracle PLSQL / Char Functions
 

Use instr in an if statement in PL SQL

SQL> SQL> declare   2    debug_procedure_name long := 'A';   3    list_of_debuggable_procs long := 'AA';   4  begin   5    if instr( list_of_debuggable_procs,debug_procedure_name ) <> 0 then   6      dbms_output.put_line( 'found it' );   7    else   8      dbms_output.put_line( 'did not find it' );   9    end if;  10    if instr( ',' || list_of_debuggable_procs || ',',  11              ',' || debug_procedure_name || ',' ) <> 0 then  12      dbms_output.put_line( 'found it' );  13    else  14      dbms_output.put_line( 'did not find it' );  15    end if;  16  end;  17  / found it did not find it PL/SQL procedure successfully completed. SQL> SQL> --