Topshiriqlar
1. Talaba jadvaliga ma’lumot kirituvchi protsedurani yaratish.
create table talaba(
tr number,
ism varchar2(14),
fam varchar2(14));
create or replace procedure kiritish
(tr in number, ism in varchar2,fam in varchar2)
as
begin
insert into talaba values(tr,ism,fam);
end;
/
set serveroutput on
set echo on
declare
begin
kiritish(1,'Baxtiyor','Rustamov');
kiritish(2,'Mexriddin','Raximov');
kiritish(3,'Gaipnazarov','Tohir');
kiritish(4,'Panjayev','Kenja');
end;
/
select * from talaba;
2. Berilgan oraliqdagi o'rtacha balni hisoblash funksiyasi.
create table im15( tr number,
ism varchar2(14),
ball number);
/
insert into im15 values(1,'Shaxboz',89);
insert into im15 values(2,'Shamshod',57);
insert into im15 values(3,'Said',75);
insert into im15 values(4,'Qosim',92);
create or replace function arifmet
(boshi in number,oxiri in number)
return number
as
x number:=0;
begin
select avg(ball) into x from im15
where tr between boshi and oxiri;
return x;
end;
/
set serveroutput on set echo on
declare begin
dbms_output.put_line(arifmet(2,3));
end;
Do'stlaringiz bilan baham: |