Considere o esquema, a seguir, de um banco de dados referente ao Conselho de Controle de Atividades Financeiras (COAF), órgão criado pela Lei nº 9.613, de 03 de março de 1998, e que tem a finalidade de disciplinar, aplicar penas administrativas, receber, examinar e identificar as ocorrências suspeitas de atividades ilícitas.
Correntista (cid: integer, cnome: string, sexo: string, cpf: string, profissao: string, salario: numeric)
Depositante (did: integer, dnome: string, sexo: string, cpf: string, profissao: string, salario: numeric)
Beneficiario (beid: integer, benome: string, sexo: string, cpf: string, profissao: string)
Banco (bid: integer, bnome: string)
Agencia (bid: integer, aid: integer, anome: string, cidade: string)
Conta (bid: integer, aid: integer, numero: string, saldo: numeric, tipo: string, cid: integer)
Deposito (bid: integer, aid: integer, numero: string, instante: datetime, valor: numeric, cpf_depositante: string)
Saque (bid: integer, aid: integer, numero: string, instante: datetime, valor: numeric)
Cheque (bid: integer, aid: integer, numero: string, numero_cheque: string, valor: numeric, data: date, cpf_beneficiario, instante_processamento: datetime)
Alerta (bid: integer, aid: integer, numero: string)
OBS: Os campos sublinhados constituem a chave primária das relações. Um correntista pode ter diversas contas.
Seja a função a seguir:
CREATE OR REPLACE FUNCTION inserirAlerta( )
RETURNS TRIGGER AS
$$
BEGIN
IF( new.valor > 50000 OR new.valor = 50000) then
INSERT INTO Alerta(bid, aid, numero) VALUES(NEW.bid, NEW.aid,
NEW.numero); RETURN NEW;
ELSE
RETURN NULL;
END IF;
END;
$$
Language 'plpgsql';
Pode-se afirmar, em relação à função dada, que: