Hi, I have a question regarding the functions. The...
# help
d
Hi, I have a question regarding the functions. There is scenario that I want to update one table(EX: profile), and after that I want to delete one row in another table(todo). Both table have no reference to each other. Is there a way to do it in function triggers ? Like when I call update profile in code can pass some arguments which is not belongs to update profile logic, but can be used in the function to delete one row in todo.(pass todo id) or I have to update profile and delete one row in todo table from code ? thanks
g
A trigger function gets NEW and OLD record data depending on type of trigger. You can execute any SQL within that function though. So you can select from other tables and/or update them.
d
so new and old record is the profile data in my case which does not have todo id required to delete one todo.
g
Oh sorry, missed that detail... if you can use sql to get the info then yes. Otherwise no not with a trigger. BUT you could call an RPC function with a parameter to do the update to profile and also modify another table with the parameter.
d
Thanks, I just look at RPC, I think I can do it with PRC. Really appreciated.