Write a PL/SQL program to Count the Number of Characters in a word - 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 Count the Number of Characters in a word

Count the Number of Characters in a word Using PL/SQL Program

Program:

DECLARE
PROCEDURE count_no_o(c VARCHAR2)
IS
cnt NUMBER := 0;
val NUMBER := 0;
inc NUMBER := 1;
BEGIN

LOOP
FOR i IN 1 .. inc
LOOP
val := INSTR(c,'o',1,inc);
END LOOP;

IF val = 0 THEN
dbms_output.put_line('No of O IS :' || cnt);
END IF;

EXIT WHEN val = 0;
cnt := cnt +1;
inc := inc + 1;
END LOOP;

END;

BEGIN
count_no_o('snoooooooooopy');

END;

No comments:

Post a Comment