Adsense Ad

Saturday, 20 July 2019

Oracle PLSQL: Vowel searching program

declare
VOWEL VARCHAR2(10) :='AEIOU' ;
INPUT VARCHAR2(2000) :='&WRITE_WORD' ;
UPINPUT VARCHAR2(2000) := UPPER(INPUT);
RESULT VARCHAR2(2000);
CHECKV VARCHAR2(2000);
CHECKI VARCHAR2(2000);
CNTR NUMBER:=LENGTH(UPINPUT);
TCNTR NUMBER:=0;


CNTRA NUMBER:=0;
POSA VARCHAR2(2000);
VA VARCHAR2(2):='A';

CNTRE NUMBER:=0;
POSE VARCHAR2(2000);
VE VARCHAR2(2):='E';

CNTRI NUMBER:=0;
POSI VARCHAR2(2000);
VI VARCHAR2(2):='I';

CNTRO NUMBER:=0;
POSO VARCHAR2(2000);
VO VARCHAR2(2):='O';

CNTRU NUMBER:=0;
POSU VARCHAR2(2000);
VU VARCHAR2(2):='U';

BEGIN

FOR V IN 1..5 LOOP
CHECKV := SUBSTR(VOWEL,V,1);

FOR I IN 1..CNTR LOOP
CHECKI := SUBSTR(UPINPUT,I,1);

IF CHECKV='A' AND CHECKV=CHECKI THEN
CNTRA:=CNTRA+1;
POSA:=POSA ||', '||I||' POSTION';

ELSIF CHECKV='E' AND CHECKV=CHECKI THEN
CNTRE:=CNTRE+1;
POSE:=POSE ||', '||I||' POSTION';

ELSIF CHECKV='I' AND CHECKV=CHECKI THEN
CNTRI:=CNTRI+1;
POSI:=POSI ||', '||I||' POSTION';

ELSIF CHECKV='O' AND CHECKV=CHECKI THEN
CNTRO:=CNTRO+1;
POSO:=POSO ||', '||I||' POSTION';

ELSIF CHECKV='U' AND CHECKV=CHECKI THEN
CNTRU:=CNTRU+1;
POSU:=POSU ||', '||I||' POSTION';


END IF;

END LOOP;


END LOOP;
TCNTR:=CNTRA+CNTRE+CNTRI+CNTRO+CNTRU;

DBMS_OUTPUT.PUT_LINE(
'============================================================================');
DBMS_OUTPUT.PUT_LINE(
'YOUR INPUT HAVE '||CNTR||' LENGTH, AND IT CONTAINS '||TCNTR||' VOWELS'); 
DBMS_OUTPUT.PUT_LINE('-------------------------------------------------------');
DBMS_OUTPUT.PUT_LINE(' VOWELS '||'  QTY '||'   POSITONS'); 
DBMS_OUTPUT.PUT_LINE('-------------------------------------------------------');
DBMS_OUTPUT.PUT_LINE('--'||VA||'--->   '||CNTRA||'---> '||POSA);
DBMS_OUTPUT.PUT_LINE('--'||VE||'--->   '||CNTRE||'---> '||POSE);
DBMS_OUTPUT.PUT_LINE('--'||VI||'--->   '||CNTRI||'---> '||POSI);
DBMS_OUTPUT.PUT_LINE('--'||VO||'--->   '||CNTRO||'---> '||POSO);
DBMS_OUTPUT.PUT_LINE('--'||VU||'--->   '||CNTRU||'---> '||POSU);
END;

1 comment:

Anonymous said...

Dear when i changed it in database ,but i install oracle apex also so when i changed the character as you said,then the oracle apex front end interface shows garbage mean encrypted so please solve this issue