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
Which is faster joins or subqueries?
What are the types of join and explain each?
How do you delete data from a table?
How can I delete duplicate rows?
Is it mandatory for the primary key to be given a value when a new record is inserted?
What are the different dcl commands in sql?
Can we want to pass a parameter payroll_id to this external pl/sql function, how do we do it?
Can a select statement fire a trigger?
What is minus?
Can instead of triggers be used to fire once for each statement on a view?
Which are the different types of indexes in sql?
How do you sort in sql?
How many indexes can be created on a table in sql?
What is the use of index in hive?
How we can create a table in pl/sql block. Insert records into it? Is it possible by some procedure or function? Please give example?