Answer Posted / dinesh
// in SQL:------------------------------------------
Select length('hello')-length(replace('hello','l','')) From
DUAL;
// IN PL/SQL:-------------------------------------------
create or replace Procedure count_char(name varchar2,c varchar2) IS
m number(11):=0;
d number(11);
a number(11);
b number(11):=1;
BEGIN
a:=length(name);
for i in 1..a
LOOP
IF INSTR(NAME,c,b)>=1 THEN
d:=INSTR(NAME,c,b);
m:=m+1;
b:=d;
END IF;
b:=b+1;
END LOOP;
DBMS_OUTPUT.PUT_LINE('count of '||' '||c ||' '||'is'||' '|| m||' '||'in'||' '||name);
end;
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
How do I view stored procedures?
How is sql used in oracle?
What is a left join?
What is sql key?
How do you pronounce sql?
Can a composite key be null?
How to pipe multiline string to isql?
What is a rank in sql?
Can unique keys be null?
What is the use of index in sql?
What is difference between my sql and sql?
what are myisam tables? : Sql dba
what is the difference between rownum pseudo column and row_number() function? : Sql dba
What are types of indexes in sql?
how would you write a query to select all teams that won either 2, 4, 6 or 8 games? : Sql dba