Skip to content
Advertisement

Is it possible to pass a built in function as an argument to a trigger?

I ask this question in light of the following trigger producing this error:

The trigger in question:

The problem seems to be arising due to the fact that I passed a concatenation function as my second argument, or rather, that I did not pass it correctly. Would appreciate your assistance in identifying which of the two is the cause of the problem.

Advertisement

Answer

Sometimes it turns out the easiest/cleanest way to do something is — well not to do it. This seems to be the case here. The issue you are having deal with passing a message into a trigger function, that getting it properly formatted. Well since a trigger function must defined without parameters.

A trigger procedure is created with the CREATE FUNCTION command, declaring it as a function with no arguments and a return type of trigger.

Don’t do it. Build the message in the trigger function. It actually makes the code there easier (IMO). You didn’t provide much detail so just a minimal example:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement