Skip to content
Advertisement

How do I get rid of this SQL error from the end of my query when inserting within a procedure?

Not sure if this is even possible but im getting a weird error at the end of my query. Any idea why?

Here is the code:

ERROR: syntax error at or near “;” LINE 15: END; ^ SQL state: 42601 Character: 727

Advertisement

Answer

You need to terminate the IF statement with END IF;. Also to check a variable against NULL, you need IS NULL rather than = NULL.

This types of errors are easier to spot if you properly indent the code.

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