Examples of CREATE PACKAGE
-
Create a package header
CREATE PACKAGE APP_VAR
AS
BEGIN
FUNCTION GET_DATEBEGIN() RETURNS DATE DETERMINISTIC;
FUNCTION GET_DATEEND() RETURNS DATE DETERMINISTIC;
PROCEDURE SET_DATERANGE(ADATEBEGIN DATE,
ADATEEND DATE DEFAULT CURRENT_DATE);
END
-
With
DEFINERset for packagepk, userUSneeds only theEXECUTEprivilege onpk.If it were set forINVOKER, either the user or the package would also need theINSERTprivilege on tablet.create table t (i integer); set term ^; create package pk SQL SECURITY DEFINER as begin function f(i integer) returns int; end^ create package body pk as begin function f(i integer) returns int as begin insert into t values (:i); return i + 1; end end^ set term ;^ grant execute on package pk to user us; commit; connect 'localhost:/tmp/69.fdb' user us password 'pas'; select pk.f(3) from rdb$database;