adspace


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

how to start mysql server? : Sql dba

1267


how to escape special characters in sql statements? : Sql dba

1114


What is your daily office routine?

2346


what are aggregate and scalar functions? : Sql dba

1129


Can delete statement be rollbacked?

1054


Does group by remove duplicates?

1112


define sql insert statement ? : Sql dba

1098


Can we use distinct and group by together?

1133


what is collation? : Sql dba

1229


what is dbms? : Sql dba

1061


If a cursor is open, how can we find in a pl/sql block?

1238


how many tables will create when we create table, what are they? : Sql dba

1144


what are the advantages of sql ? : Sql dba

1142


What is the current version of sql?

1094


What is the current version of postgresql?

1178