next up previous
Next: Variablen in PL/SQL-Prozeduren Up: PL/SQL und SQL*Plus von Previous: PL/SQL und SQL*Plus von

Aufbau von PL/SQL-Procedures

CREATE OR REPLACE Procedure name
(Variablenname Variablentyp,
Variablenname Variablentyp,
...) IS
Exceptiondefinitionen
Cursordefinitionen
BEGIN
Anweisungen
...
END;
/
show errors
grant execute on
name to hr;
grant ...

Hier nun ein Beispiel für eine Prozedur in PL/SQL:

create or replace procedure ProjektAusgabeName is
  Cursor c is select * from projekt order by bezeichnung;      
  Begin
    htp.p('<BODY BGCOLOR=#ffffff>');
    htp.p('<table border=5>');
    htp.tableRowOpen;
    htp.tableData('<b>Nummer');
    htp.tableData('<b>Bezeichnung');
    htp.tableRowClose;
    for i in c loop
      htp.tableRowOpen;
      htp.tableData(i.nr);
      htp.tableData(i.bezeichnung);
      htp.tableRowClose;
    end loop;
    htp.tableClose;
  End;
/
show errors
grant execute on ProjektAusgabeName to hr;
grant select on projekt to hr;


 
next up previous
Next: Variablen in PL/SQL-Prozeduren Up: PL/SQL und SQL*Plus von Previous: PL/SQL und SQL*Plus von

Lehrveranstaltung Living Lectures - Virtual University
Abteilung Angewandte Informatik insbesondere Betriebsinformatik, WU-Wien
10/17/1997