MyTetra Share
Делитесь знаниями!
Country name по id локации без использования функции
Время создания: 05.11.2017 09:34
Раздел: PL/SQL - Задачник - CURSORS - Параметризованный курсор
Запись: xintrea/mytetra_db_mcold/master/base/150986368579m1vlxp1e/text.html на raw.githubusercontent.com

Вывести имя города и страны при помощи обхода 2-ух курсоров:

locations

countries


declare

loc_cur sys_refcursor;

n_loc_id integer;

c_id countries.country_id%TYPE;

c_name countries.country_name%TYPE;

rec_loc locations%ROWTYPE;

cursor c_location is

select l.country_id

, l.city

from locations l;

cursor c_country(c_id countries.country_id%TYPE) is

select c.country_name

from countries c

where c.country_id = c_id;

begin

for rec in c_location loop

c_id := rec.country_id;

open c_country(c_id);

fetch c_country into c_name;

close c_country;

dbms_output.put_line(rec.city);

dbms_output.put_line(c_name);

dbms_output.put_line('------------');

end loop;


end;


Так же в этом разделе:
 
MyTetra Share v.0.59
Яндекс индекс цитирования