testbestellins.sql:
create or replace procedure testbestellins(
autor char,
titel char,
jahr integer,
text1 char,
text2 char,
text3 char) is
Begin
insert into testbestellungen(bestnr,autor,titel,jahr,text1,text2,text3)
values (nr.nextval,autor,titel,jahr,text1,text2,text3);
commit;
htp.p('Bestellung erfasst.' || '<target=list>');
EXCEPTION
when OTHERS then
htp.p('Eingabe fehlerhaft!' || '<target=list>');
htp.p(SQLERRM);
End;
/
show errors
grant execute on testbestellins to hr;
grant insert on testbestellungen to hr;
commit;
testbuchsuche.sql:
create or replace procedure testbuchsuche
(aut varchar,
tit varchar) is
Cursor c is
Select invnr,sachgebiet, autor, titel, jahr
from testinventar
where autor like aut or titel like tit
order by invnr;
Begin
htp.p('<BODY BGCOLOR=#ffffff>');
htp.p('<table border=5>');
for i in c
loop
htp.tableRowOpen;
htp.tableData(i.invnr);
htp.tableData(i.sachgebiet);
htp.tableData(i.autor);
htp.tableData(i.titel);
htp.tableData(i.jahr);
htp.tableRowClose;
end loop;
htp.tableClose;
End;
/
show errors
grant execute on testbuchsuche to hr;
grant select on testinventar to hr;
commit;
testbestellbrief.sql
create or replace procedure testbestellbrief
is
Cursor c is
select sysdate as datum, autor, titel, text1,
text2, text3, jahr from testbestellungen
where brief is null;
Cursor datum is
select sysdate as dat from testbestellungen where bestnr=0;
Begin
htp.p('<BODY BGCOLOR=#ffffff>');
htp.p('<br><br><br><br><br>');
htp.p('An die'); htp.p('<br>');
htp.p('Servicebetriebe'); htp.p('<br>');
htp.p('z.Hd. Frau Popp'); htp.p('<br>');
htp.p('im Haus'); htp.p('<br><br><br><br>');
for i in datum loop
htp.p('<DIV ALIGN=right><P>');
htp.p(i.dat);
htp.p('</P></DIV>');
htp.p('<br><br>');
end loop;
htp.p('Sehr geehrte Frau Popp!'); htp.p('<br><br>');
htp.p('Ich möchte für das Extraordinariat Angewandte Informatik (Prof
.Panny) folgende Werke bestellen:'); htp.p('<br><br>');
for i in c loop
htp.p('<LI>');
htp.p(i.autor);htp.p(',');
htp.p(i.titel);htp.p(',');
htp.p(i.text1);
htp.p(i.text2);
htp.p(i.text3);htp.p(',');
htp.p(i.jahr);
htp.p('<br>');
end loop;
htp.p('<br><br><br>');
htp.p('Mit freundlichem Gruß'); htp.p('<br><br><br><br><br><br>');
htp.p('Dr. Alexander Kaiser');
update testbestellungen set brief=1,
bestelldatum=SYSDATE where brief is NULL;
commit;
end;
/
show errors
grant execute on testbestellbrief to hr;
grant select on testbestellungen to hr;
grant update on testbestellungen to hr;
testinventarbuch.sql
create or replace procedure testinventarbuch
is
Cursor c is
select invnr,sachgebiet,autor, titel, text1,
text2, text3, jahr from testinventar
order by invnr;
Begin
htp.p('<BODY BGCOLOR=#ffffff>');
for i in c loop
htp.bold(i.invnr);
htp.bold('E/');
htp.bold(i.sachgebiet);
htp.p(i.autor);
htp.p(i.titel);
htp.p(i.text1);
htp.p(i.text2);
htp.p(i.text3);
htp.p(i.jahr);
htp.p('<br>');
end loop;
end;
/
show errors
grant execute on testinventarbuch to hr;
grant select on testinventar to hr;
testinvins.sql
create or replace procedure testinvins
(bestellnr char,
inventarnr char,
sachgeb char) is
Cursor c is
Select invnr,sachgebiet, autor, titel, jahr
from testinventar where invnr=inventarnr;
Begin
insert into testinventar(invnr,autor,titel,jahr,text1,text2,text3)
select 0,autor,titel,jahr,text1,text2,text3 from testbestellungen
where bestnr=bestellnr;
update testinventar set invnr=inventarnr, sachgebiet=sachgeb
where invnr=0;
delete from testbestellungen where bestnr=bestellnr;
commit;
htp.p('Der neue Eintrag im Inventarbuch:');
htp.p('<BODY BGCOLOR=ffffff#>');
htp.p('<br>');
for i in c
loop
htp.p(i.invnr);
htp.p(i.sachgebiet);
htp.p(i.autor);
htp.p(i.titel);
htp.p(i.jahr);
end loop;
End;
/
show errors
grant execute on testinvins to hr;
grant insert on testinventar to hr;
grant update on testinventar to hr;
grant delete on testbestellungen to hr;
commit;
testinvsel.sql
create or replace procedure testinvsel
is
Cursor c is
select bestnr, autor, titel from testbestellungen
where bestnr <> 0
order by autor;
Begin
htp.p('<BODY BGCOLOR=#ffffff>');
htp.p('<table border=5>');
htp.tableRowOpen;
htp.tableData('<b>Bestellnummer</b>');
htp.tableData('<b>Autor</b>');
htp.tableData('<b>Titel</b>');
htp.tableRowClose;
for i in c loop
htp.tableRowOpen;
htp.tableData(i.bestnr);
htp.tableData(i.autor);
htp.tableData(i.titel);
htp.tableRowClose;
end loop;
htp.tableClose;
end;
/
show errors
grant execute on testinvsel to hr;
grant select on testbestellungen to hr;
testinvsel2.sql
create or replace procedure testinvsel2
is
Cursor c is
select bestnr, autor, titel,bestelldatum from testbestellungen
where bestnr <> 0
order by bestelldatum;
Begin
htp.p('<BODY BGCOLOR=#ffffff>');
htp.p('<table border=5>');
htp.tableRowOpen;
htp.tableData('<b>Bestellnummer</b>');
htp.tableData('<b>Autor</b>');
htp.tableData('<b>Titel</b>');
htp.tableRowClose;
for i in c loop
htp.tableRowOpen;
htp.tableData(i.bestnr);
htp.tableData(i.autor);
htp.tableData(i.titel);
htp.tableRowClose;
end loop;
htp.tableClose;
end;
/
show errors
grant execute on testinvsel to hr;
grant select on testbestellungen to hr;