Yes, of course is this sql producing an error. The point is, I want to trap the error and handle it. Here in this case I set the variable l_state and l_message.
Doh! Of course. Sorry about that. What happens when you explicitly catch the 42601 sql state or the syntax_error condition instead of 'others?'