Projekt z predmetu DSDS

PL/SQL

 

Vytvor tabuľku TAB s atribútmi a, b, c, kde a = cena ubytovania, b = cena procedúr a c = celková cena pobytu.

create table TAB(
a integer,
b integer
);

insert into TAB values (861,574);
insert into TAB values (100,108);
insert into TAB values (56,335);
insert into TAB values (60,246);
insert into TAB values (54,45);
insert into TAB values (104,163);
insert into TAB values (92,320);
insert into TAB values (1460,1119);
insert into TAB values (516,478);
insert into TAB values (105,301);
insert into TAB values (468,335);
insert into TAB values (328,555);
insert into TAB values (399,262);

 

 


alter table TAB
add c integer;

update TAB
set c='0';


Vytvor tri premenné x, y, z. Načítaj z tabuľky hodnoty a, b a v prípade,
že =861, vlož súčet x+y.

declare
x integer;
y integer;
z integer;
begin
loop
select a, b, c into x, y, z from TAB where a=861;
z:=x+y;
insert into TAB values (x,y,z);
exit when x<1500;
end loop;
end;
.
run;

Vyhľadávanie

© 2009 Všetky práva vyhradené.