====== pears.GetPayOrCharge ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create function "pears"."GetPayOrCharge"(
/* Application Maintained Function / Procedure - DO NOT EDIT*/
in "PayOrCharge" char(1),in "PlacOrVac" char(1),in "ID" char(20) )
returns char(20)
begin
declare "pay" double;
declare "istemp" smallint;
if "placorvac" = 'P' then
select "isnull"("temp",0),"salary" into "istemp","pay" from "placement" where "placementid" = "id"
else
select "isnull"("temp",0),"salary" into "istemp","pay" from "vacancy" where "vacancyid" = "id"
end if;
if "istemp" = 0 then
if "payorcharge" = 'P' then
return "commathousands"("pay")
else
return ''
end if
else return "trim"("str"("gettemprate"("payorcharge","placorvac","id"),20,2))
end if
end