The Vertica Forum recently got a makeover! Let us know what you think by filling out this short, anonymous survey.

Vertica Trigger

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.

Comments

  • Jim_KnicelyJim_Knicely Administrator

    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)
    

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.