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
Why do we use joins?
Is merge a dml statement?
What are the types of triggers in sql?
What is a unique key and primary key and foreign key?
Can we group by two columns in sql?
What is the difference between clustered and non-clustered index in sql?
What is sql and how does it work?
What is the primary key?
What is a full join sql?
Can we use ddl statements in stored procedure?
How can you maintain the integrity of your database on instances where deleting an element in a table result in the deletion of the element(s) within another table?
Why do we create stored procedures & functions in pl/sql and how are they different?
What are different types of sql?
What is a left join?
How does an execution block start and end in pl sql?