====== pears.GenerateContactEventEmailLog ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create procedure "pears"."GenerateContactEventEmailLog"(
/* Application Maintained Function / Procedure - DO NOT EDIT*/
in "pcontacteventid" char(20),in "pWhenSent" timestamp default current timestamp,in "pRecipients" long varchar default null,
in "pAttachments" long varchar default null,in "pDirection" char(3) default 'OUT',in "pMethod" char(10) default 'EMAIL' )
begin
declare "column_not_found" exception for sqlstate value '52003';
insert into "ContactEventEmailLog"( "ContactEventEmailLogID","ContactEventID","WhenSent","Recipients","Attachments","Direction","Method" ) values
( "Uniquekey"("pContactEventID"),"pContactEventID","pWhenSent","pRecipients","pAttachments","pDirection","pMethod" )
exception
when "column_not_found" then
insert into "ContactEventEmailLog"( "ContactEventEmailLogID","ContactEventID","WhenSent","Recipients","Attachments" ) values
( "Uniquekey"("pContactEventID"),"pContactEventID","pWhenSent","pRecipients","pAttachments" )
when others then
resignal
end
go
COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."GenerateContactEventEmailLog" IS
{create procedure GenerateContactEventEmailLog
/* Application Maintained Function / Procedure - DO NOT EDIT*/
( in "pcontacteventid" CHAR(20) , in"pWhenSent" timestamp Default current timestamp,in"pRecipients" long varchar default null,
in"pAttachments" long varchar default null, in "pDirection" Char(3) default 'OUT', in "pMethod" char(10) Default 'EMAIL' )
begin
DECLARE column_not_found EXCEPTION FOR SQLSTATE '52003';
insert into ContactEventEmailLog ( ContactEventEmailLogID,ContactEventID,WhenSent,Recipients,Attachments,Direction,Method)
values(Uniquekey(pContactEventID),pContactEventID,pWhenSent,pRecipients,pAttachments,pDirection,pMethod);
EXCEPTION
WHEN column_not_found THEN
insert into ContactEventEmailLog ( ContactEventEmailLogID,ContactEventID,WhenSent,Recipients,Attachments)
values(Uniquekey(pContactEventID),pContactEventID,pWhenSent,pRecipients,pAttachments);
WHEN OTHERS THEN
RESIGNAL;
end
}