Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Need to check whether first two characters of a string is Alphabets or not

Siva.VJul 8 2013 — edited Jul 8 2013

Hi,

Need to check whether first two characters of a string is alphabet or not.

Lets say for Ex,

String as 'DE123456' i need to check whether first  character is non-numeric and then second character as non numeric.

kindly help me on this.

                IF length(trim(p_parserec(31))) = 22 AND p_parserec(31) LIKE 'DE%'  THEN

                    AUFTRAGGEBERKONTONR := trim(p_parserec(31)) ;

                 ELSIF  (length(trim(p_parserec(31))) > 22 AND length(trim(p_parserec(31))) < 35)  AND p_parserec(31) NOT LIKE 'DE%'  THEN

                   AUFTRAGGEBERKONTONR := lpad(trim(p_parserec(31)), 34, 0) ;
                 ELSIF length(trim(p_parserec(31))) > 10 AND ascii(substr(p_parserec(31), 1, 2)) between 48 and 57 THEN

                   AUFTRAGGEBERKONTONR := lpad(trim(p_parserec(31)), 10, 0) ;

                 ELSE
                    p_errorcd   := sqlcode ;
                    p_errordata := sqlerrm ;
               END IF ;

Note : In the third else if condition the character should be greater than 10 and first 2 characters should not be alphabets.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 5 2013
Added on Jul 8 2013
5 comments
10,510 views