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
What is the use of desc in sql?
What are the differences between implicit and explicit cursors?
how to select first 5 records from a table? : Sql dba
Mention what is the use of function "module procedure" in pl/sql?
How do you use join?
what is foreign key? : Sql dba
what is offset-fetch filter in tsql? : Transact sql
What is an example of translating a date into julian format?
State few characteristics of pl/sql?
What is scalar data type in pl sql?
How to call a javascript function from pl sql?
Can there be 2 primary keys in a table?
How do I truncate a word?
How would you convert date into julian date format?
Explain correlated query work?