2023-01-23 15:31:22 +01:00
|
|
|
/*
|
|
|
|
* This demonstrates how to declare the IDRs as part of a package
|
|
|
|
*/
|
2023-01-23 13:42:02 +01:00
|
|
|
set term ^;
|
|
|
|
|
|
|
|
create or alter package my_first_udr_kit
|
|
|
|
-- optional - declare sql security as DEFINER to give access rights of owner to all users
|
|
|
|
-- sql security definer
|
|
|
|
as
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
function div (
|
|
|
|
anumerator integer, adenominator integer
|
|
|
|
)
|
2023-01-23 15:04:59 +01:00
|
|
|
returns double precision;
|
2023-01-23 13:42:02 +01:00
|
|
|
|
|
|
|
function flagged (
|
|
|
|
flags integer, flag integer
|
|
|
|
)
|
|
|
|
returns integer;
|
|
|
|
|
|
|
|
|
|
|
|
end ^
|
|
|
|
|
|
|
|
|
|
|
|
recreate package body my_first_udr_kit
|
|
|
|
as
|
|
|
|
begin
|
|
|
|
|
|
|
|
function div (
|
|
|
|
anumerator integer, adenominator integer
|
|
|
|
)
|
2023-01-23 15:04:59 +01:00
|
|
|
returns double precision
|
2023-01-23 15:31:22 +01:00
|
|
|
external name 'udf_compat!UC_div!Divide anumerator by adenominator' engine udr;
|
2023-01-23 13:42:02 +01:00
|
|
|
|
|
|
|
function flagged (
|
|
|
|
flags integer, flag integer
|
|
|
|
)
|
|
|
|
returns integer
|
2023-01-23 15:31:22 +01:00
|
|
|
external name 'my_first_udr_kit!MFK_flagged!How is this function used?' engine udr;
|
2023-01-23 13:42:02 +01:00
|
|
|
|
|
|
|
end ^
|
|
|
|
|
|
|
|
|
|
|
|
set term ;^
|
2023-01-23 15:43:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
grant execute on package my_first_udr_kit to public;
|