Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: How to create oracle procedure??
Josef wrote :
>How can I create a stored procedure? The procedure
>have to select
>the last column(datum) of the table. I' m using Oracle 7.3!!
You can create a simple procedure that returns simple result this way :
Create or replace procedure Get_Datum (aParam in <Your DataType>, aDatum out
Date) IS
BEGIN
SELECT Datum INTO aDatum FROM WetterDaten WHERE criteria_column =
aParam;
END;
/
And if you want to receive a set of data you can use packages:
Create or Replace PACKAGE MyPack IS
procedure Get_Datum (aParam in <Your DataType>, aDatum in out DatumList);
END;
/
Create Or Replace PACKAGE BODY MyPack IS Procedure Get_Datum (aParam in <Your DataType>, aDatum in out DatumList) IS
CURSOR DatumCur IS
SELECT Datum FROM WetterDaten
WHERE criteria_column = aParam;
i NUMBER;
CurDate Date;
BEGIN
i := 0;
Open DatumCur;
While True Loop
Fetch DatumCur INTO CurDate; if DatumCur%NotFound then Exit; end if; i := i + 1; aDatum(i) := CurDate;
END;
END;
/
Regards. Maxim. maximka_kr_at_usa.net Received on Tue May 05 1998 - 06:41:06 CDT