table :-
city name country code
abc 11
bcd 22
cde 232
def 33

write a procedure , so that when we give a phone no. eg -
1123456789 -
o/p sud be city name = abc

if phone no. - 2322345897 , o/p sud be =cde

note - bcd and cde city name sud be diff. as dey diff only
with th last no.

Pls ans. this questnion.

Answer Posted / pravellika

create or replace procedure check1 (num number)
is
cursor c1(id number) is select b.a,b.city,b.code from (
select instr(id,code,1,1) as a,city,code from t1 )b
where b.a=1;
v_id number;
v_code NUMBER;
v_city VARCHAR2(100);
begin
open c1(num);
loop
fetch c1 into v_id,v_city,v_code;
exit when c1%notfound;
dbms_output.put_line(v_city||' '||v_code);
end loop;
close c1;
end;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is break?

634


what are null values? : Sql dba

552


How do you create an update query?

536


What is data modelling in sql?

531


What is the use of non clustered index?

540






How do I pipe the output of one isql to another?

538


Is join same as left join?

541


What is the maximum number of rows in sql table?

555


What is the difference between subquery and correlated query?

541


How to start oracle sql developer?

568


What is the least restrictive isolation level? : Transact sql

573


What is a full join?

536


What are the types of sql commands?

559


Can we update views in sql?

543


How can we debug in PL/SQL?

671