56 lines
931 B
SQL
56 lines
931 B
SQL
/*
|
|
* This demonstrates how to declare the UDRs as part of a package
|
|
*
|
|
* ########### INCOMPLETE ###################
|
|
*/
|
|
set term ^;
|
|
|
|
create or alter package MyFirstUDRKit
|
|
-- -- optional - declare sql security as DEFINER to give access rights of owner to all users
|
|
-- sql security definer
|
|
as
|
|
begin
|
|
|
|
|
|
function div (
|
|
anumerator bigint, adenominator bigint
|
|
)
|
|
returns bigint;
|
|
|
|
function flagged (
|
|
flags integer, flag integer
|
|
)
|
|
returns integer;
|
|
|
|
|
|
end ^
|
|
|
|
|
|
recreate package body MyFirstUDRKit
|
|
as
|
|
begin
|
|
|
|
function div (
|
|
anumerator bigint, adenominator bigint
|
|
)
|
|
returns bigint
|
|
external name 'MyFirstUDRKit!MFK_div!Divide anumerator by adenominator' engine udr;
|
|
|
|
function flagged (
|
|
flags integer, flag integer
|
|
)
|
|
returns integer
|
|
external name 'MyFirstUDRKit!MFK_flagged!Check if flag is set in flags. flag is zero-based.' engine udr;
|
|
|
|
|
|
|
|
|
|
|
|
end ^
|
|
|
|
|
|
set term ;^
|
|
|
|
|
|
grant execute on package MyFirstUDRKit to public;
|