Grupa 1
Zadanie1. Omów typy tabelowe (kolekcje) PL/SQL.
Zadanie2:Omów poniższy fragment programu (czy poprawny - wskaż ewentualne poprawki, co robi ?)
CREATE OR REPLACE TYPE address AS OBJECT (street VARCHAR2(40),
city VARCHAR2(20),
state_code VARCHAR2(2),
zip VARCHAR2(13));
CREATE TABLE address_master OF address;
declare
cursor c1 is select * from address_master ;
v_add address_master%ROWTYPE;
v_address address :=address('19 J, Reading Rd','Rodsonar','NJ','08817');
BEGIN
v_add.city :='Warsaw';
IF (v_address IS NOT NULL) THEN
DBMS_OUTPUT.PUT_LINE('v_address is not null');
END IF;
open c1;
loop
fetch c1 into v_add;
exit when c1%notfound;
DBMS_OUTPUT.PUT_LINE (v_add. street );
end loop;
close c1;
end;
/
Grupa 2
Zadanie1. Omów typy tabelowe (kolekcje) PL/SQL.
Zadanie2: omów poniższy fragment programu (czy poprawny - wskaż ewentualne poprawki, co robi ?)
CREATE OR REPLACE TYPE address AS OBJECT
(line1 VARCHAR2(20),
line2 VARCHAR2(20),
city VARCHAR2(20),
state_code VARCHAR2(2),
zip VARCHAR2(13));
CREATE TABLE address_master OF address;
declare
cursor c1 is select * from address_master;
v_add address_master%ROWTYPE;
v_address address := address('27 Mine Brook Rd','#99-A','Edison','NJ','08820');
BEGIN
v_add.city :='Eartaw';
IF (v_address IS NOT NULL) THEN
DBMS_OUTPUT.PUT_LINE('v_address is not null');
END IF;
open c1;
loop
fetch c1 into v_add;
exit when c1%notfound;
DBMS_OUTPUT.PUT_LINE (v_add.line1);
end loop;
close c1;
end;
/