Обсуждение: Reference to NEW, OLD values in TRIGGER

Поиск
Список
Период
Сортировка

Reference to NEW, OLD values in TRIGGER

От
Andrey Mosienko
Дата:
Hello All!

How can I access NEW or OLD fields in trigger with variable?
I need it to create more universal function to work with tables
when I don't know the table structure.

Example:

Now:
IF NEW.empname ISNULL THEN
             RAISE EXCEPTION ''empname cannot be NULL value'';
END IF;


As I wish. or something like that:
DECLARE
    str text;
BEGIN
    str := 'empname';
IF NEW.''str'' ISNULL THEN
    ^^^^^^
             RAISE EXCEPTION ''empname cannot be NULL value'';
END IF;
END;