Skip to main content

Vertica Trigger

  • September 18, 2018
  • 1 reply
  • 2 views

JunaidKhan
Forum|alt.badge.img+1

Hi, Need support what is the syntax for vertica trigger,

for example i have the record with state=outstanding and i want to change it to closed so what will be the syntax, appreciate support.

1 reply

Jim_Knicely
Forum|alt.badge.img+2
  • Participating Frequently
  • September 18, 2018

Vertica is not an OLTP database and does not support triggers.

However, your example simply says " i have the record with state=outstanding and i want to change it to closed".

Wouldn't a simple UPDATE DML operation do that?

dbadmin=> CREATE TABLE no_trigger_needed (pk INT NOT NULL PRIMARY KEY ENABLED, state VARCHAR(11));
CREATE TABLE

dbadmin=> INSERT INTO no_trigger_needed SELECT 1, 'outstanding';
 OUTPUT
--------
      1
(1 row)

dbadmin=> SELECT * FROM no_trigger_needed;
 pk |    state
----+-------------
  1 | outstanding
(1 row)

dbadmin=> UPDATE no_trigger_needed SET state = 'closed' WHERE pk = 1 AND state = 'outstanding';
 OUTPUT
--------
      1
(1 row)

dbadmin=> COMMIT;
COMMIT

dbadmin=> SELECT * FROM no_trigger_needed;
 pk | state
----+--------
  1 | closed
(1 row)