TOTVS CRM | SFA - 12.1.2501
.public
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
putlocalemail(integer, character varying, integer, character varying)
Parameters
Name
Type
Mode
internalid
integer
IN
email
character varying
IN
idnpadrao
integer
IN
externalid
character varying
IN
Definition
declare idlocalemail_ integer; begin if idnpadrao is null then RAISE EXCEPTION 'idnpadrao = %', idnpadrao USING HINT = 'Field idnpadrao must be not null'; end if; select into idlocalemail_ idlocalemail from localemail where idlocalemail = internalid ; IF NOT FOUND THEN RAISE EXCEPTION 'idlocalemail = %', internalid USING HINT = 'There is no idlocalemail in localemail'; end if; update localemail set email = case when PutLocalEmail.email = 'NOVALUEWS' then localemail.email else PutLocalEmail.email end, idnpadrao = case when PutLocalEmail.idnpadrao = -99999 then localemail.idnpadrao else PutLocalEmail.idnpadrao end, codigoerp = case when externalid = 'NOVALUEWS' then localemail.codigoerp else externalid end where idlocalemail = internalid ; return query select internalid; END;