hi there. it's me again. i'm encountering some problems to determine the insert, update and delete process in a function.
currently i'm writing a function to update a column in a table called myflag. If the process is an INSERT then myflag will be udpated with 'I'. If the process is update, then myflag will be updated with 'U' and 'D' is for delete.
i have tried using the syntax below to determine it, but it doesn't seems to work.
if TG_OP = ''INSERT'' then
update myflag = 'I'
elsif TG_OP = ''UPDATE'' then
update myflag = 'U'
end if;
the problem i'm facing here is that, insert is actually update and update is actually insert. therefore the statement above is not working. can i know is there any other way that i cann use to determine the process whether it is an update, insert or delete?
currently i'm writing a function to update a column in a table called myflag. If the process is an INSERT then myflag will be udpated with 'I'. If the process is update, then myflag will be updated with 'U' and 'D' is for delete.
i have tried using the syntax below to determine it, but it doesn't seems to work.
if TG_OP = ''INSERT'' then
update myflag = 'I'
elsif TG_OP = ''UPDATE'' then
update myflag = 'U'
end if;
the problem i'm facing here is that, insert is actually update and update is actually insert. therefore the statement above is not working. can i know is there any other way that i cann use to determine the process whether it is an update, insert or delete?