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
What is trigger and how to use it in sql?
How to select unique records from a table?
Can we use views in stored procedure?
What is set serveroutput on in pl sql?
how is exception handling handled in mysql? : Sql dba
What is structural independence and why is it important?
Is grant a ddl statement?
What are the query optimization techniques?
What are different types of queries in sql?
What is Difference Between Unique and Primary Key Constraints?
How do I write a cron which will run a sql query and mail the results to agroup?
Which column of the user triggers data dictionary view displays the database event that will fire the trigger?
What's the difference between inner join and left join?
what is the difference between cluster and non cluster index? : Sql dba
Which command is used to call a stored procedure?