Q:

Write a PL/SQL program to check whether a given character is letter or digit

0

Write a PL/SQL program to check whether a given character is letter or digit.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

DECLARE
    get_ctr CHAR(1) := '&input_a_character';
BEGIN
    IF ( get_ctr >= 'A'
         AND get_ctr <= 'Z' )
        OR ( get_ctr >= 'a'
             AND get_ctr <= 'z' ) THEN
      dbms_output.Put_line ('The given character is a letter');
    ELSE
      dbms_output.Put_line ('The given character is not a letter');

      IF get_ctr BETWEEN '0' AND '9' THEN
        dbms_output.Put_line ('The given character is a number');
      ELSE
        dbms_output.Put_line ('The given character is not a number');
      END IF;
    END IF;
END; 
/

Sample Output:

SQL> /
Enter value for input_a_character: m
old   2:     get_ctr CHAR(1) := '&input_a_character';
new   2:     get_ctr CHAR(1) := 'm';
The given character is a letter

PL/SQL procedure successfully completed.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now