65 lines
1.1 KiB
SQL
65 lines
1.1 KiB
SQL
/*
|
|
* This demonstrates how to declare the IDRs as part of a package
|
|
*/
|
|
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;
|
|
|
|
-- function LoadBlobFromFile (
|
|
-- afilename varchar(8191),
|
|
-- ablob BLOB
|
|
-- )
|
|
-- returns bigint;
|
|
|
|
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!How is this function used?' engine udr;
|
|
|
|
|
|
-- function LoadBlobFromFile (
|
|
-- afilename varchar(8191),
|
|
-- ablob BLOB
|
|
-- )
|
|
-- returns bigint
|
|
-- external name 'MyFirstUDRKit!MFK_Load_Blob_From_File!Load file and save to Blob' engine udr;
|
|
|
|
|
|
|
|
end ^
|
|
|
|
|
|
set term ;^
|
|
|
|
|
|
grant execute on package MyFirstUDRKit to public;
|