Discussion
· Sep 14, 2020

Embedded SQL error handling

Hi Developers!

How do you handle errors with &sql a.k.a. embedded SQL?
I think I found a universal error-handling template which works in any situation:

&sql(SELECT * FROM Sample.Person)

if SQLCODE < 0 throw ##class(%Exception.SQL).CreateFromSQLCODE(SQLCODE,"Context description")

What is your choice?

Discussion (4)2
Log in or sign up to continue