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.DAXTRADeDuplicate ====== <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"."DAXTRADeDuplicate"( in "paramsp" char(20) ) returns long varchar begin declare "RVal" long varchar; declare "fname" char(100); declare "lname" char(100); declare "filter" long varchar; declare "sel" long varchar; declare "maxrecs" integer; set "maxrecs" = 5; set "filter" = ' where surname = lname'; select "dvalue" into "lname" from "DAXTRAParams" where "ID" = "paramsp" and "dname" = 'LASTNAME'; if(select "count"() from "person" where "surname" = "lname") > 5 then select "dvalue" into "fname" from "DAXTRAParams" where "ID" = "paramsp" and "dname" = 'FIRSTNAME'; set "filter" = "string"("filter",' and substring(forenames,1,locate(forenames||'' '','' '')-1) = fname'); if(select "count"() from "person" where "surname" = "lname" and "substring"("forenames",1,"locate"("forenames" || ' ',' ')-1) = "fname") > 5 then -- poss more filtering end if end if; set "sel" = "string"('select list(string(personid,''~'',name,''~'',surname, ''<p>''),"char"(13)+"char"(10)) into RVal from person',"filter"); execute immediate "sel"; return "RVal" end </code> database/functions/pears_daxtradeduplicate.txt Last modified: 2026/08/07 19:24by 127.0.0.1