Show pageOld revisionsBacklinksExport to PDFFold/unfold allBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== pears.SetPersonWillingness ====== <WRAP center round info> Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. </WRAP> ===== Original SQL ===== <code sql> create function "pears"."SetPersonWillingness"( /* Application Maintained Function / Procedure - DO NOT EDIT*/ in @PersonID char(20),in @Willingness smallint default null ) returns smallint begin -- return codes: 0 = success, 1 = no such PersonID, 2 = no Willingness record for PersonID, 3 = other error -- call with only PersonID to remove existing Willingness Record begin try if @Willingness is not null then insert into "pears"."PersonWillingness"( "PersonID","Willingness" ) on existing update defaults off values ( @PersonID,@Willingness ) else delete from "pears"."PersonWillingness" where "PersonID" = @PersonID end if; if @@rowcount = 1 then return(0) elseif @Willingness is null and not exists(select "PersonID" from "PersonWillingness" where "PersonID" = @PersonID) and exists(select "PersonID" from "Person" where "PersonID" = @PersonID) then return(2) elseif @Willingness is null and not exists(select "PersonID" from "Person" where "PersonID" = @PersonID) then return(1) else return(3) end if end try begin catch if not exists(select "PersonID" from "Person" where "PersonID" = @PersonID) then return(1) else return(3) end if end catch end </code> database/functions/pears_setpersonwillingness.txt Last modified: 2026/08/07 19:24by 127.0.0.1