Guest User

Untitled

a guest
Jun 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. CREATE OR REPLACE FUNCTION cleanNoteEventConnections() RETURNS TRIGGER AS $$
  2. DECLARE
  3. BEGIN
  4. EXECUTE 'update invoice set "noteEvent"=null where "noteEvent"=' || OLD.id;
  5. RETURN NULL;
  6. END;
  7. $$ LANGUAGE 'plpgsql';
  8.  
  9. CREATE TRIGGER cleanNoteEventConnections BEFORE DELETE ON note_event FOR EACH ROW EXECUTE PROCEDURE cleanNoteEventConnections();
  10.  
  11. delete from note_event where id=34
  12. result: Query returned successfully: 0 rows affected, 11 msec execution time.
Add Comment
Please, Sign In to add comment