-
Hi check this out if it works
declare
v_id city.cityID%TYPE;
v_city city.city%TYPE;
v_sid student.studentID%TYPE;
begin
for s_rec in (select * from student )
loop
for c_rec in (select * from city )
loop
v_sid := s_rec.studentID;
v_city := '%'||c_rec.city||'%';
select min(cityid) into v_id from student s, city c where trim(city) = trim(c_rec.city) and s_rec.addresss like v_city ;
if v_id is not null then
dbms_output.put_line( s_rec.studentid||chr(9)||s_rec.s_name ||chr(9)||v_id ||chr(9)||c_rec.city);
end if;
end loop;
end loop;
--exception
--When others then
-- dbms_output.put_line( 'Exception_occured at ID ' || v_sid);
end;
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|