use substr in IF statement
SQL>
SQL>
SQL> DECLARE
2 lv_training_code_txt VARCHAR2(10) := 'T_Code';
3 lv_non_training_code_txt VARCHAR2(10) := 'TUSC';
4 PROCEDURE training_class_check (p_class_check VARCHAR) IS p_class_check1 VARCHAR2(10) := p_class_check;
5 BEGIN
6 IF SUBSTR(p_class_check1,1,2) = 'T_' THEN
7 p_class_check1 := 'T-' || SUBSTR(p_class_check1, 3);
8 END IF;
9 IF p_class_check1 LIKE 'T-%' THEN
10 DBMS_OUTPUT.PUT_LINE(p_class_check ||' is a Training Class');
11 ELSE
12 DBMS_OUTPUT.PUT_LINE(p_class_check ||' is a Non-Training Class');
13 END IF;
14 END training_class_check;
15
16 BEGIN
17 training_class_check(lv_training_code_txt);
18 training_class_check(lv_non_training_code_txt);
19 END;
20 /
PL/SQL procedure successfully completed.
SQL>
SQL>
Related examples in the same category