Trigger before insert and before update

9 views
Skip to first unread message

pablo sanchez

unread,
Apr 28, 2023, 2:07:46 PM4/28/23
to firebir...@googlegroups.com
I'm not getting this, this  time ...
I have a table with CDOCUMENTO (like id Card)

CREATE TABLE CLIENTE
(
  NCLIENTE ENTERO NOT NULL,
  DNOMBRE CHAR_100CI,
  DDIRECCION CHAR_100CI,
  ...
  XCOMISION NUMERIC(7,3),
  XCOMREC NUMERIC(7,3),
  FHING T_STAMP,
  LACTIVO L_BOOL,
  LTIPO CHAR_01,
  DRSOCIAL CHAR_100CI,
  CTIPODOC CHAR_10,
  CDOCUMENTO CHAR_50CI,
  ......
)

On this update trigger I'm missing something ..
SET TERM ^ ;
ALTER TRIGGER DUPE_DOC_UPD ACTIVE
BEFORE UPDATE POSITION 0
AS
DECLARE VARIABLE IDCLIENTE INTEGER;
BEGIN
   SELECT NCLIENTE
   FROM CLIENTE
   WHERE CDOCUMENTO = NEW.CDOCUMENTO
   INTO :IDCLIENTE;
   IF (IDCLIENTE != NEW.NCLIENTE) THEN
      EXCEPTION CLIENTE_DUPE_DOC;
END
^
SET TERM ; ^

I'm expecting that searching for a record with that CDOCUMENTO that is not the same I'm updating , should be fine,
but I cannot pass NCLIENTE  as a parameter .

Regards
Pablo





pablo sanchez

unread,
Apr 28, 2023, 3:54:00 PM4/28/23
to firebir...@googlegroups.com
Sorry, wrong list.
I'll post where it belongs...

Regards

Pablo
--
You received this message because you are subscribed to the Google Groups "firebird-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebird-deve...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebird-devel/u2h21a%247s2%241%40ciao.gmane.io.

pablo sanchez

unread,
Apr 28, 2023, 3:55:04 PM4/28/23
to firebir...@googlegroups.com
Sorry, wrong list.
I'll post where it belongs...

Regards

Pablo
On 4/28/23 15:07, pablo sanchez wrote:

pablo sanchez

unread,
Apr 28, 2023, 4:00:06 PM4/28/23
to firebir...@googlegroups.com
Sorry, wrong list.
I'll post where it belongs...

Regards

Pablo
On 4/28/23 15:07, pablo sanchez wrote:

pablo sanchez

unread,
Apr 28, 2023, 4:10:04 PM4/28/23
to firebir...@googlegroups.com
Sorry, wrong list.
I'll post where it belongs...

Regards

Pablo
On 4/28/23 15:07, pablo sanchez wrote:
Reply all
Reply to author
Forward
0 new messages