Trigger Problem

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

Trigger Problem

От:
"Ramesh PAtel " <ramesh@banas.guj.nic.in>
Дата:
Hi All


i have problem in Trigger functoin




when trigger  fire then ERROR 
massage is


ERROR :  Attribute 'UNDEF00' 
not found
PostgreSQL status:PGRES_FATAL_ERROR


here UNDEF00 is by defult value of 
po_no
TRIGGER IS


CREATE TRIGGER add_stock_gr_trig  AFTER 
UPDATE on gr FOR EACH 
ROW execute procedure add_stock_gr_fun();      
my function is this


create function add_stock_gr_fun() 
returns opaque as'
DECLARE
    rec RECORD; 
    txtpo varchar; 
BEGIN


IF NEW.po_no <> "UNDEF00" 
THEN   
            SELECT 
INTO rec  gr_no, noofbags, final_wt, matl_cd 
            FROM 
po p, gr g
            WHERE 
g.po_no=p.po_no and g.gr_no=NEW.gr_no;   


            IF 
OLD.po_no #= "UNDEF00" THEN
                        UPDATE 
matl_mst 
                        SET 
bal_bag = bal_bag + rec.noofbags,  
                        bal_kg = bal_kg + rec.final_wt  
                        WHERE 
matl_mst.matl_cd = rec.matl_cd; 
            ELSE
                        UPDATE 
matl_mst 
                        SET 
bal_bag = bal_bag + NEW.noofbags - OLD.noofbags,    
                        bal_kg = bal_kg + NEW.final_wt  - 
OLD.final_wt
                        WHERE 
matl_mst.matl_cd = rec.matl_cd; 
                        
            END 
IF;
END IF;


return NULL;    








END;'  language 'plpgsql';      








please Help me




Ramesh Patel

Re: Trigger Problem

От:
Dani Oderbolz <oderbolz@ecologic.de>
Дата:
Hi Ramesh,

just a guess:

try

IF NEW.po_no <> 'UNDEF00'

(Single quote), since you are referring to a Literal, not to a coulmn name.

Regards, Dani

--
Dani Oderbolz
IT Admin
Ecologic (www.ecologic.de)

FAQ