Write a PL/SQL program to Captalize alternate Characters (aBcDeFgHiJkLmNoPqR) - Computer Programming

Latest

C C++ Java Python Perl Programs Examples with Output -useful for Schools & College Students

Thursday, October 5, 2017

Write a PL/SQL program to Captalize alternate Characters (aBcDeFgHiJkLmNoPqR)

 PL/SQL program to Captalize alternate Characters 

Program:

DECLARE
PROCEDURE sent_name(n VARCHAR2)
IS
extract_char VARCHAR2(10);
chk NUMBER := 0;
BEGIN
FOR i IN 1 .. LENGTH(n)
LOOP
extract_char := SUBSTR(n,i,1);
IF (i MOD 2) = 0 THEN
-- dbms_output.put(extract_char || ' This is Even');
dbms_output.put(UPPER(extract_char));
NULL;
ELSIF (i MOD 2) > 0 THEN
--dbms_output.put_line(extract_char || 'this is odd');
dbms_output.put((extract_char));
NULL;
END IF;
chk := chk +1;
END LOOP;
dbms_output.new_line;

END sent_name;
BEGIN
sent_name('abcdefghijklmnopqr');

END;

No comments:

Post a Comment