# Retrieving RAISERROR from Stored Procedure

**URL:** <https://forum.inductiveautomation.com/t/retrieving-raiserror-from-stored-procedure/16971>\
**Category:** Ignition\
**Tags:** ignition79, database, scripting\
**Created:** [February 13, 2018, 10:15pm UTC](https://forum.inductiveautomation.com/t/retrieving-raiserror-from-stored-procedure/16971 "2018-02-13T22:15:36Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![cesrom](https://avatars.discourse-cdn.com/v4/letter/c/ea666f/32.png) [@cesrom](https://forum.inductiveautomation.com/u/cesrom)\
**Post date:** [February 13, 2018, 10:15pm UTC](https://forum.inductiveautomation.com/t/retrieving-raiserror-from-stored-procedure/16971/1 "2018-02-13T22:15:36Z")

</div>

Hello,

I have a stored procedure where input parameters are being validated, in case one has an undesired value I use RAISERROR.

This is the SQL code:

```auto
IF @name IS NULL OR NULLIF(RTRIM(LTRIM(@name)), '') IS NULL 
BEGIN
    RAISERROR('Invalid parameter: @name cannot be NULL or empty.', 18, 0)
    RETURN
END

```

Is it possible to read this error message?

This is my [simplified] code:

```auto
try:
    call = system.db.createSProcCall(procedureName='save')
    call.registerInParam('name', system.db.VARCHAR, None)
    system.db.execSProcCall(call)
except java.lang.Exception:
    /* This is where I would like to print the error raised by the stored procedure. */
    print 'RAISERROR'

```

This is what I get when I run the stored procedure in SQL Server Management Studio:

```auto
Msg 50000, Level 18, State 0, Procedure save, Line 29
Invalid parameter: @name cannot be NULL or empty.

```

Please let me know if this is possible.

Thanks.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 13, 2018, 10:29pm UTC](https://forum.inductiveautomation.com/t/retrieving-raiserror-from-stored-procedure/16971/2 "2018-02-13T22:29:13Z")

</div>

Try this:

```auto
import java.lang.Exception
try:
    call = system.db.createSProcCall(procedureName='save')
    call.registerInParam('name', system.db.VARCHAR, None)
    system.db.execSProcCall(call)
except java.lang.Exception, e:
    /* This is where I would like to print the error raised by the stored procedure. */
    print e

```

---

<div class="post-metadata">

**Author:** ![cesrom](https://avatars.discourse-cdn.com/v4/letter/c/ea666f/32.png) [@cesrom](https://forum.inductiveautomation.com/u/cesrom)\
**Post date:** [February 13, 2018, 10:38pm UTC](https://forum.inductiveautomation.com/t/retrieving-raiserror-from-stored-procedure/16971/3 "2018-02-13T22:38:09Z")

</div>

I may have oversimplified the catch statement.

This is the code I have:

```auto
except(java.lang.Exception, Exception):
    print "An unexpected error occurred in %s:\n%s", % (get_function_name(), '\n'.join(traceback.format_exc().splitlines()))

```

And what I end up getting on the console is:

```auto
An unexpected error occurred in save. 
Traceback (most recent call last):
  File "<buffer>", line 59, in save
Exception: java.lang.Exception: Error executing system.db.execSProcCall()

```

I’m running the save function on the Script Console.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 13, 2018, 10:42pm UTC](https://forum.inductiveautomation.com/t/retrieving-raiserror-from-stored-procedure/16971/4 "2018-02-13T22:42:18Z")

</div>

Use separate catch clauses. One for java exceptions, one for python:

```auto
import java.lang.Exception
try:
    call = system.db.createSProcCall(procedureName='save')
    call.registerInParam('name', system.db.VARCHAR, None)
    system.db.execSProcCall(call)
except java.lang.Exception, e:
    /* Print exceptions originating in Java */
    print e
except Exception, e:
    /* Print other exceptions */
    print e

```

---

<div class="post-metadata">

**Author:** ![cesrom](https://avatars.discourse-cdn.com/v4/letter/c/ea666f/32.png) [@cesrom](https://forum.inductiveautomation.com/u/cesrom)\
**Post date:** [February 13, 2018, 11:17pm UTC](https://forum.inductiveautomation.com/t/retrieving-raiserror-from-stored-procedure/16971/5 "2018-02-13T23:17:49Z")

</div>

Whichever way I do not seem to get the error raised by the stored procedure.

The error reads:

```auto
java.lang.Exception: Error executing system.db.execSProcCall()

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 14, 2018, 2:13am UTC](https://forum.inductiveautomation.com/t/retrieving-raiserror-from-stored-procedure/16971/6 "2018-02-14T02:13:42Z")

</div>

Follow the chain of “caused by” nested exceptions.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 14, 2018, 2:15am UTC](https://forum.inductiveautomation.com/t/retrieving-raiserror-from-stored-procedure/16971/7 "2018-02-14T02:15:27Z")

</div>

Also, consider using a logger instead of print, and one of the logger methods that takes an exception. That’ll print a detailed backtrace.

---

<div class="post-metadata">

**Author:** ![cesrom](https://avatars.discourse-cdn.com/v4/letter/c/ea666f/32.png) [@cesrom](https://forum.inductiveautomation.com/u/cesrom)\
**Post date:** [February 14, 2018, 9:10pm UTC](https://forum.inductiveautomation.com/t/retrieving-raiserror-from-stored-procedure/16971/8 "2018-02-14T21:10:05Z")

</div>

I intend to read the error message from the stored procedure, but I have noticed that `system.db.execSProcCall` throws `java.lang.Exception`, and in my test I have yet to find a way to read it.

> [@pturmel](#):
>
> Follow the chain of "caused by" nested exceptions.

The "cause" is the RAISERROR from the stored procedure, but apparently is doesn't "bubble-up" as I was expecting.

> [@pturmel](#):
>
> ...consider using a logger instead of print...

A logger, in my case, is not a viable option since, as I said, my intention is to present the exception to the user.

I may need to do something else other than catching the `java.lang.Exception`, but my knowledge is not deep enough.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 14, 2018, 9:13pm UTC](https://forum.inductiveautomation.com/t/retrieving-raiserror-from-stored-procedure/16971/9 "2018-02-14T21:13:27Z")

</div>

> [@pturmel](#):
>
> Also, consider using a logger instead of print, and one of the logger methods that takes an exception. That'll print a detailed backtrace.

Do this for now so you can show us the whole exception. Or take it out of it's try/except block so that the client will display the exception. Then you can click on "full" on the details pane and paste it here.

---

<div class="post-metadata">

**Author:** ![cesrom](https://avatars.discourse-cdn.com/v4/letter/c/ea666f/32.png) [@cesrom](https://forum.inductiveautomation.com/u/cesrom)\
**Post date:** [February 14, 2018, 10:35pm UTC](https://forum.inductiveautomation.com/t/retrieving-raiserror-from-stored-procedure/16971/10 "2018-02-14T22:35:14Z")

</div>

Now I know what you meant by “caused by”.

This is the full stack trace from the exception:

```auto
Java Traceback:

	at org.python.core.Py.JavaError(Py.java:495)
	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:362)
	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.execSProcCall(AbstractDBUtilities.java:496)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java:186)
	at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction. __call__ (ScriptManager.java:429)
	at org.python.core.PyObject. __call__ (PyObject.java:387)
	at org.python.core.PyObject. __call__ (PyObject.java:391)
	at org.python.pycode._pyx53.save$1(<buffer>:73)
	at org.python.pycode._pyx53.call_function(<buffer>)
	at org.python.core.PyTableCode.call(PyTableCode.java:165)
	at org.python.core.PyBaseCode.call(PyBaseCode.java:120)
	at org.python.core.PyFunction. __call__ (PyFunction.java:307)
	at org.python.pycode._pyx53.f$0(<buffer>:109)
	at org.python.pycode._pyx53.call_function(<buffer>)
	at org.python.core.PyTableCode.call(PyTableCode.java:165)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.Py.runCode(Py.java:1275)
	at org.python.core.Py.exec(Py.java:1319)
	at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:215)
	at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:89)
	at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java:70)
	at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$InterpreterWorker.doInBackground(JythonConsole.java:476)
	at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$InterpreterWorker.doInBackground(JythonConsole.java:464)
	at javax.swing.SwingWorker$1.call(Unknown Source)
	at java.util.concurrent.FutureTask.run(Unknown Source)
	at javax.swing.SwingWorker.run(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.Exception: Error executing system.db.execSProcCall()
	... 32 more
Caused by: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Invalid parameter: @sid cannot be NULL.
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:341)
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:315)
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:268)
	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.invoke(GatewayInterface.java:894)
	at com.inductiveautomation.ignition.client.script.ClientDBUtilities._call(ClientDBUtilities.java:233)
	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.execSProcCall(AbstractDBUtilities.java:494)
	... 30 more
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid parameter: @sid cannot be NULL.
	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:196)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1454)
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:388)
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:338)
	at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4026)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1416)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:185)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:160)
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.execute(SQLServerPreparedStatement.java:320)
	at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:169)
	at com.inductiveautomation.ignition.gateway.datasource.SRConnectionWrapper$SRPreparedStatement.execute(SRConnectionWrapper.java:937)
	at com.inductiveautomation.ignition.gateway.script.GatewayDBUtilities._callSProc(GatewayDBUtilities.java:248)
	at com.inductiveautomation.ignition.gateway.servlets.gateway.functions.CallSProc.call(CallSProc.java:47)
	at sun.reflect.GeneratedMethodAccessor14.invoke(null)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(null)
	at java.lang.reflect.Method.invoke(null)
	at com.inductiveautomation.ignition.gateway.servlets.gateway.AbstractGatewayFunction.invoke(AbstractGatewayFunction.java:208)
	at com.inductiveautomation.ignition.gateway.servlets.Gateway.doPost(Gateway.java:405)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at com.inductiveautomation.ignition.gateway.bootstrap.MapServlet.service(MapServlet.java:85)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:837)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:583)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1160)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1092)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
	at org.eclipse.jetty.server.Server.handle(Server.java:518)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:308)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:244)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
	at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:246)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:156)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
	at java.lang.Thread.run(null)
Traceback (most recent call last):
  File "<buffer>", line 105, in <module>
  File "<buffer>", line 62, in save
  File "<buffer>", line 62, in save
	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:362)
	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.execSProcCall(AbstractDBUtilities.java:496)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)

java.lang.Exception: java.lang.Exception: Error executing system.db.execSProcCall()

```

Buried in the Traceback I **am** getting the error message from `RAISERROR`:

```auto
Caused by: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Invalid parameter: @sid cannot be NULL.

```

…and…

```auto
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Invalid parameter: @sid cannot be NULL.

```

But all I’m reading is:

```auto
java.lang.Exception: java.lang.Exception: Error executing system.db.execSProcCall()

```

Suggestions?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 14, 2018, 11:02pm UTC](https://forum.inductiveautomation.com/t/retrieving-raiserror-from-stored-procedure/16971/11 "2018-02-14T23:02:45Z")

</div>

Look at the [Docs for java.lang.Exception](https://docs.oracle.com/javase/8/docs/api/java/lang/Exception.html). Notice the `getCause()` method. Follow that from outermost to innermost to get what you need. Also note that a [SQLException](https://docs.oracle.com/javase/8/docs/api/java/sql/SQLException.html) has additional detail.

---

<div class="post-metadata">

**Author:** ![cesrom](https://avatars.discourse-cdn.com/v4/letter/c/ea666f/32.png) [@cesrom](https://forum.inductiveautomation.com/u/cesrom)\
**Post date:** [February 14, 2018, 11:51pm UTC](https://forum.inductiveautomation.com/t/retrieving-raiserror-from-stored-procedure/16971/12 "2018-02-14T23:51:03Z")

</div>

```auto
try:
    ....
except java.lang.Exception, e:
    print e.getCause()

```

In this case it prints:

```auto
com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Invalid parameter: @sid cannot be NULL.

```

Which is a little bit clearer than the bare java.lang.Exception.

Thanks!

---

<div class="post-metadata">

**Author:** ![Ryan\_Shaw](https://avatars.discourse-cdn.com/v4/letter/r/dbc845/32.png) [@Ryan\_Shaw](https://forum.inductiveautomation.com/u/Ryan_Shaw)\
**Post date:** [March 12, 2025, 5:33pm UTC](https://forum.inductiveautomation.com/t/retrieving-raiserror-from-stored-procedure/16971/13 "2025-03-12T17:33:18Z")

</div>

My google search led me here. The topic of this post is relevant to my problem, but the discussion isn't helpful because the user was just struggling with passing in bad arguments. I am also using 8.1, not 7.9. But since other people will end up reading this post when they have my problem I'll go ahead and revive this.

My MSSQL stored procedure explicitly raises an error, but this error is not raised by the gateway. Here is my MSSQL code snippet

```python
IF EXISTS (SELECT 1 FROM @errorMessages) BEGIN
		
	SELECT @errorMessage = STRING_AGG(errorMessage, ',') FROM @errorMessages
	RAISERROR (@errorMessage, 16, 1)
	RETURN

END

```

Here is the procedure called from SSMS

```python
EXEC test_proc 
    @p1 = -1,
    @p2 = NULL,
    @p3 = NULL;

```

and the expected output when no parameters are passsed in

```python
Msg 50000, Level 16, State 1, Procedure test_proc, Line 56 [Batch Start Line 0]
p1 was not provided.,p2 was not provided.,p3 was not provided.

```

Here is my Ignition code called from the script console

```python
    call = system.db.createSProcCall('test_proc', 'Ignition')

    call.registerInParam('p1', system.db.INTEGER, -1)
    call.registerInParam('p2', system.db.INTEGER, None)
    call.registerInParam('p3', system.db.INTEGER, None)

    system.db.execSProcCall(call)

```

the output in the script console is empty (\>\>\>), but I'm expecting a traceback error with my RAISERROR message.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 12, 2025, 6:23pm UTC](https://forum.inductiveautomation.com/t/retrieving-raiserror-from-stored-procedure/16971/14 "2025-03-12T18:23:40Z")

</div>

Ignition only does vanilla JDBC, as a consequence of its multi-vendor connection pool design. I'm pretty sure you can only get the output of RAISEERROR via SQL Server extensions in their customized driver.

Don't use vendor-specific JDBC extensions in Ignition.

---

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [March 12, 2025, 6:31pm UTC](https://forum.inductiveautomation.com/t/retrieving-raiserror-from-stored-procedure/16971/15 "2025-03-12T18:31:29Z")

</div>

What happens when you create a named query, then for the query body you put your procedure call

```sql
EXEC test_proc :p1, :p2, :p3

```

The `:p1, :p2, :p3` are your named query parameters. Then, test it out with a script console `system.db.runNamedQuery("test_proc_query", parameters = {...})`.

Where I work, we use stored procedures heavily, but never using the `system.db.create/execSProcCall()` interface - just using named queries. I don't know whether or not this is explicitly supported by the JDBC driver, but its worked for me for hundreds of procedures and many, many projects with this setup.

[Again, I'm not saying this is what you should do - I'm just curious if you'll get the exception you're expecting - I'm suspecting you might]

---

<div class="post-metadata">

**Author:** ![Ryan\_Shaw](https://avatars.discourse-cdn.com/v4/letter/r/dbc845/32.png) [@Ryan\_Shaw](https://forum.inductiveautomation.com/u/Ryan_Shaw)\
**Post date:** [March 12, 2025, 9:52pm UTC](https://forum.inductiveautomation.com/t/retrieving-raiserror-from-stored-procedure/16971/16 "2025-03-12T21:52:24Z")

</div>

```python
query = """
EXEC test_proc
	@p1 = -1,
	@p2 = NULL,
	@p3 = NULL
"""
system.db.runUpdateQuery(query, 'Ignition')

```

Does in fact produce the error message I'm expecting. Another alternative is to have @errorMessage be an output parameter in my stored procedure, and then I can retrieve it and check if it is NULL or an empty string. I like that idea. It was also suggested to me that Ignition might catch the error if I use THROW instead of RAISERROR. I didn't look into that, but someone else having this problem might try that.

Thank you for your replies, @pturmel@YF129701

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [March 13, 2025, 11:14am UTC](https://forum.inductiveautomation.com/t/retrieving-raiserror-from-stored-procedure/16971/17 "2025-03-13T11:14:27Z")

</div>

If you insist on using the `executeSPCall()` (I wouldn’t I find it finicky and infuriating) you’ll probably have to, at a minimum, define a return parameter.

For what it’s worth I would just use a Named query.
