# Calling PostegreSQL 11 Stored Procedures

**URL:** <https://forum.inductiveautomation.com/t/calling-postegresql-11-stored-procedures/23786>\
**Category:** Ignition\
**Created:** [April 2, 2019, 2:15pm UTC](https://forum.inductiveautomation.com/t/calling-postegresql-11-stored-procedures/23786 "2019-04-02T14:15:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![pgmo](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@pgmo](https://forum.inductiveautomation.com/u/pgmo)\
**Post date:** [April 2, 2019, 2:15pm UTC](https://forum.inductiveautomation.com/t/calling-postegresql-11-stored-procedures/23786/1 "2019-04-02T14:15:43Z")

</div>

Maybe my question is more about JDBC. This is my first project with PostgreSQL, after 4+ years MS SQL Server projects. Ignition is version 7.9.10, PostgreSQL server v. 11, JDBC driver is `postgresql-42.2.5.jar` (instead of the `postgresql-9.1-901.jdbc4.jar` which comes with the standard Ignition installation - I had some issues defining users).  
Trying to call a stored procedure in the MS SQL Server way, i.e. something like that

```auto
call = system.db.createSProcCall("logs.usp_log_steps")
call.registerInParam(1, system.db.INTEGER, nr_caldera)
call.registerInParam(2, system.db.INTEGER, prev_step)
call.registerInParam(3, system.db.INTEGER, curr_step)
system.db.execSProcCall(call)

```

I’m getting the following exception:

```auto
Caused by: org.postgresql.util.PSQLException: ERROR: logs.usp_log_steps(integer, integer, integer) is a procedure
  Suggerimento: To call a procedure, use CALL.

```

I then revert to the following code:

```auto
query="call logs.usp_log_steps(?,?,?)"
args=[nr_caldera,prev_step,curr_step]
system.db.runPrepUpdate( query, args)

```

and all is working correctly.  
A couple of questions:

- is it really not possible to call a procedure as in the first example?
- If I have `OUT` parameters and I’m forced to go the second way, how can I get the returnig values back?
- Going this second way, how can I define _parameters types_? Are they inferred from the Python variables types? As I can see, that could be a problem: a procedure of mine has a `smallint` parameter, but the calling python code wants that parameter to be of type `integer`, causing an exception to be thrown.

Thanks in advance, regards

---

<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:** [April 2, 2019, 3:44pm UTC](https://forum.inductiveautomation.com/t/calling-postegresql-11-stored-procedures/23786/2 "2019-04-02T15:44:57Z")

</div>

> [@pgmo](#):
>
> is it really not possible to call a procedure as in the first example?

Seems like a bug. { I haven't deployed any pg11 yet.... }

---

<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:** [July 18, 2020, 3:45am UTC](https://forum.inductiveautomation.com/t/calling-postegresql-11-stored-procedures/23786/3 "2020-07-18T03:45:58Z")

</div>

I found a bug when inserting DECIMAL types; most likely is the MSSQL JDBC’s fault.

So I created a very simple proof of concept where I call `system.db.runPrepUpdate`, `system.db.runUpdateQuery`, and `system.db.execSProcCall` for MSSQL, MySQL, and PostgreSQL.

The value that gets truncated when calling `system.db.execSProcCall` is of type DECIMAL(15, 8). Something like this:

```auto
call = system.db.createSProcCall(procedureName="[dbo].[decimal_test_insert]", database=MSSQL")
call.registerInParam("val", system.db.DECIMAL, 0.00060606)
system.db.execSProcCall(call)

```

That call inserts `0.0006`, not the whole number. But when I set the type to `system.db.FLOAT`, it inserts the full number.

I found no issue on MySQL when calling the stored procedure and passing `DECIMAL` as type.

So, to my point.

I am no PostgreSQL expert, but I was expecting I would be able to use the same code to call a procedure using the same functions. Instead I get the following error:

```auto
Traceback (most recent call last):
  File "<event:actionPerformed>", line 3, in <module>
java.lang.Exception: java.lang.Exception: Error executing system.db.execSProcCall()

	caused by Exception: Error executing system.db.execSProcCall()
	caused by GatewayException: Method org.postgresql.jdbc.PgCallableStatement.setObject(String,Object,int) is not yet implemented.
	caused by SQLFeatureNotSupportedException: Method org.postgresql.jdbc.PgCallableStatement.setObject(String,Object,int) is not yet implemented.

Ignition v8.0.14 (b2020062220)
Java: Azul Systems, Inc. 11.0.6

```

The code I use for calling the procedure is the same as the first snippet.

As @pgmo pointed out, runnig a `system.db.run[Prep]Update[Query]` does work, but not `system.db.execSProcCall`.

Code that works:

```auto
system.db.runUpdateQuery(
	query="call public.decimal_test_insert(?)".format(0.00060606),
	database="POSTGRESQL"
)

```

Any clues?

---

<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:** [July 18, 2020, 1:40pm UTC](https://forum.inductiveautomation.com/t/calling-postegresql-11-stored-procedures/23786/4 "2020-07-18T13:40:13Z")

</div>

Jython doesn’t have its own decimal type, so any constants in your code that have decimal points will first be treated as `double`. Then converted in the JDBC driver. Consider constructing a true java [BigDecimal](https://docs.oracle.com/javase/8/docs/api/java/math/BigDecimal.html) object to be your test constant. That is undoubtedly what the JDBC driver expects as the native java type corresponding to the SQL DECIMAL type.

---

<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:** [July 19, 2020, 9:17pm UTC](https://forum.inductiveautomation.com/t/calling-postegresql-11-stored-procedures/23786/5 "2020-07-19T21:17:54Z")

</div>

I have tried the following:

```auto
from java.math import BigDecimal, BigInteger
bigint= BigInteger('60606')
scale = 8
val = BigDecimal(bigint, scale)
call = system.db.createSProcCall(procedureName="[dbo].[decimal_test_insert]", database="MSSQL")
call.registerInParam("val", system.db.DECIMAL, val)
call.registerInParam("method", system.db.VARCHAR, "execSProcCall - DECIMAL")
system.db.execSProcCall(call)

```

The inserted value remains the same; `0.0006`.

On the Script Console the same code calling `BigDecimal` produces the expected number to be inserted:

```auto
from java.math import BigDecimal, BigInteger

print BigDecimal(BigInteger('60606'), 8)

# Output
>>>
0.00060606
>>>

```

Raw view of the db table:

```auto
val method
--------------------------------------- --------------------------------------------------
0.00060606 runPrepUpdate - INSERT
0.00060606 runUpdateQuery - calling sproc
0.00060000 execSProcCall - DECIMAL
0.00060606 execSProcCall - FLOAT

```

I have a ticket open with Support for this issue, and another over at GitHub for the JDBC driver, just to cover all possible sources.

Thanks!

---

<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:** [July 21, 2020, 2:47am UTC](https://forum.inductiveautomation.com/t/calling-postegresql-11-stored-procedures/23786/6 "2020-07-21T02:47:47Z")

</div>

So. Is it all possible to call a PostgreSQL Procedure from Ignition?

Table definition:

```sql
-- Table: public.decimal_test

-- DROP TABLE public.decimal_test;

CREATE TABLE public.decimal_test
(
    val numeric(15,8),
    src character varying(50) COLLATE pg_catalog."default"
)

TABLESPACE pg_default;

ALTER TABLE public.decimal_test
    OWNER to postgres;

```

Procedure with named arguments:

```sql
-- PROCEDURE: public.decimal_test_insert(numeric, character varying)

-- DROP PROCEDURE public.decimal_test_insert(numeric, character varying);

CREATE OR REPLACE PROCEDURE public.decimal_test_insert(
	val numeric,
	src character varying)
LANGUAGE 'sql'
AS $BODY$
	INSERT INTO public.decimal_test (
		val,
		src
	)
	VALUES (
		val,
		src
	);
$BODY$;

```

When registering input parameters by name, like this:

```python
from java.math import BigDecimal, BigInteger

bigint= BigInteger('80808')
scale = 8
val = BigDecimal(bigint, scale)

call = system.db.createSProcCall(procedureName="public.decimal_test_insert", database="MBAPOSTGRESQL")
call.registerInParam("val", system.db.DECIMAL, val)
call.registerInParam("src", system.db.VARCHAR, "execSProcCall - DECIMAL")
system.db.execSProcCall(call)

```

I get the following:

```auto
Caused by: java.sql.SQLFeatureNotSupportedException: Method org.postgresql.jdbc.PgCallableStatement.setObject(String,Object,int) is not yet implemented.

```

Full traceback:

```auto
Java Traceback:
Traceback (most recent call last):
  File "<input>", line 10, in <module>
	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:362)

	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.execSProcCall(AbstractDBUtilities.java:497)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.base/java.lang.reflect.Method.invoke(Unknown Source)

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

	at org.python.core.Py.JavaError(Py.java:552)

	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:362)

	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.execSProcCall(AbstractDBUtilities.java:497)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.base/java.lang.reflect.Method.invoke(Unknown Source)

	at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java:188)

	at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction. __call__ (ScriptManager.java:524)

	at org.python.core.PyObject. __call__ (PyObject.java:480)

	at org.python.core.PyObject. __call__ (PyObject.java:484)

	at org.python.pycode._pyx59.f$0(<input>:10)

	at org.python.pycode._pyx59.call_function(<input>)

	at org.python.core.PyTableCode.call(PyTableCode.java:171)

	at org.python.core.PyCode.call(PyCode.java:18)

	at org.python.core.Py.runCode(Py.java:1614)

	at org.python.core.Py.exec(Py.java:1658)

	at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:276)

	at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:131)

	at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:605)

	at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:593)

	at java.desktop/javax.swing.SwingWorker$1.call(Unknown Source)

	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)

	at java.desktop/javax.swing.SwingWorker.run(Unknown Source)

	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

	at java.base/java.lang.Thread.run(Unknown Source)

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

	... 26 more

Caused by: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Method org.postgresql.jdbc.PgCallableStatement.setObject(String,Object,int) is not yet implemented.

	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:351)

	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:325)

	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:278)

	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.invoke(GatewayInterface.java:934)

	at com.inductiveautomation.ignition.client.script.ClientDBUtilities._call(ClientDBUtilities.java:345)

	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.execSProcCall(AbstractDBUtilities.java:495)

	... 24 more

Caused by: java.sql.SQLFeatureNotSupportedException: Method org.postgresql.jdbc.PgCallableStatement.setObject(String,Object,int) is not yet implemented.

	at org.postgresql.Driver.notImplemented(Driver.java:692)

	at org.postgresql.jdbc.PgCallableStatement.setObject(PgCallableStatement.java:786)

	at org.apache.commons.dbcp2.DelegatingCallableStatement.setObject(DelegatingCallableStatement.java:1236)

	at org.apache.commons.dbcp2.DelegatingCallableStatement.setObject(DelegatingCallableStatement.java:1236)

	at com.inductiveautomation.ignition.gateway.datasource.SRConnectionWrapper$SRCallableStatement.setObject(SRConnectionWrapper.java:1641)

	at com.inductiveautomation.ignition.gateway.datasource.query.SQLType.setParam(SQLType.java:178)

	at com.inductiveautomation.ignition.gateway.script.GatewayDBUtilities._callSProc(GatewayDBUtilities.java:296)

	at com.inductiveautomation.ignition.gateway.servlets.gateway.functions.CallSProc.call(CallSProc.java:42)

	at jdk.internal.reflect.GeneratedMethodAccessor50.invoke(null)

	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(null)

	at java.lang.reflect.Method.invoke(null)

	at com.inductiveautomation.ignition.gateway.servlets.gateway.AbstractGatewayFunction.invoke(AbstractGatewayFunction.java:225)

	at com.inductiveautomation.ignition.gateway.servlets.Gateway.doPost(Gateway.java:414)

	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:86)

	at org.eclipse.jetty.servlet.ServletHolder$NotAsyncServlet.service(ServletHolder.java:1391)

	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:760)

	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:547)

	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)

	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:590)

	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)

	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)

	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1607)

	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)

	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1297)

	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)

	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:485)

	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1577)

	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)

	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1212)

	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)

	at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:59)

	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)

	at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:322)

	at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:59)

	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)

	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)

	at org.eclipse.jetty.server.Server.handle(Server.java:500)

	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383)

	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:547)

	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)

	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:270)

	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)

	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)

	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)

	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)

	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)

	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)

	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129)

	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:388)

	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)

	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)

	at java.lang.Thread.run(null)

Traceback (most recent call last):
  File "<input>", line 10, in <module>
	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:362)

	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.execSProcCall(AbstractDBUtilities.java:497)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.base/java.lang.reflect.Method.invoke(Unknown Source)

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

```

When registering by index, like this:

```auto
from java.math import BigDecimal, BigInteger

bigint= BigInteger('80808')
scale = 8
val = BigDecimal(bigint, scale)

call = system.db.createSProcCall(procedureName="public.decimal_test_insert", database="MBAPOSTGRESQL")
call.registerInParam(1, system.db.DECIMAL, val)
call.registerInParam(2, system.db.VARCHAR, "execSProcCall - DECIMAL")
system.db.execSProcCall(call)

```

I get this error:

```auto
Caused by: org.postgresql.util.PSQLException: ERROR: public.decimal_test_insert(numeric, character varying) is a procedure
  Hint: To call a procedure, use CALL.
  Position: 15

```

Full traceback:

```auto
Java Traceback:
Traceback (most recent call last):
  File "<input>", line 10, in <module>
	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:362)

	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.execSProcCall(AbstractDBUtilities.java:497)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.base/java.lang.reflect.Method.invoke(Unknown Source)

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

	at org.python.core.Py.JavaError(Py.java:552)

	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:362)

	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.execSProcCall(AbstractDBUtilities.java:497)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.base/java.lang.reflect.Method.invoke(Unknown Source)

	at org.python.core.PyReflectedFunction. __call__ (PyReflectedFunction.java:188)

	at com.inductiveautomation.ignition.common.script.ScriptManager$ReflectedInstanceFunction. __call__ (ScriptManager.java:524)

	at org.python.core.PyObject. __call__ (PyObject.java:480)

	at org.python.core.PyObject. __call__ (PyObject.java:484)

	at org.python.pycode._pyx67.f$0(<input>:10)

	at org.python.pycode._pyx67.call_function(<input>)

	at org.python.core.PyTableCode.call(PyTableCode.java:171)

	at org.python.core.PyCode.call(PyCode.java:18)

	at org.python.core.Py.runCode(Py.java:1614)

	at org.python.core.Py.exec(Py.java:1658)

	at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:276)

	at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:131)

	at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:605)

	at com.inductiveautomation.ignition.designer.gui.tools.jythonconsole.JythonConsole$ConsoleWorker.doInBackground(JythonConsole.java:593)

	at java.desktop/javax.swing.SwingWorker$1.call(Unknown Source)

	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)

	at java.desktop/javax.swing.SwingWorker.run(Unknown Source)

	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

	at java.base/java.lang.Thread.run(Unknown Source)

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

	... 26 more

Caused by: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: ERROR: public.decimal_test_insert(numeric, character varying) is a procedure
  Hint: To call a procedure, use CALL.
  Position: 15

	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.newGatewayException(GatewayInterface.java:351)

	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:325)

	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.sendMessage(GatewayInterface.java:278)

	at com.inductiveautomation.ignition.client.gateway_interface.GatewayInterface.invoke(GatewayInterface.java:934)

	at com.inductiveautomation.ignition.client.script.ClientDBUtilities._call(ClientDBUtilities.java:345)

	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.execSProcCall(AbstractDBUtilities.java:495)

	... 24 more

Caused by: org.postgresql.util.PSQLException: ERROR: public.decimal_test_insert(numeric, character varying) is a procedure
  Hint: To call a procedure, use CALL.
  Position: 15

	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2532)

	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2267)

	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:312)

	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:448)

	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:369)

	at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:153)

	at org.postgresql.jdbc.PgCallableStatement.executeWithFlags(PgCallableStatement.java:77)

	at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:142)

	at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:94)

	at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:94)

	at com.inductiveautomation.ignition.gateway.datasource.SRConnectionWrapper$SRPreparedStatement.execute(SRConnectionWrapper.java:995)

	at com.inductiveautomation.ignition.gateway.script.GatewayDBUtilities._callSProc(GatewayDBUtilities.java:310)

	at com.inductiveautomation.ignition.gateway.servlets.gateway.functions.CallSProc.call(CallSProc.java:42)

	at jdk.internal.reflect.GeneratedMethodAccessor50.invoke(null)

	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(null)

	at java.lang.reflect.Method.invoke(null)

	at com.inductiveautomation.ignition.gateway.servlets.gateway.AbstractGatewayFunction.invoke(AbstractGatewayFunction.java:225)

	at com.inductiveautomation.ignition.gateway.servlets.Gateway.doPost(Gateway.java:414)

	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:86)

	at org.eclipse.jetty.servlet.ServletHolder$NotAsyncServlet.service(ServletHolder.java:1391)

	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:760)

	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:547)

	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)

	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:590)

	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)

	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)

	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1607)

	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)

	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1297)

	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)

	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:485)

	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1577)

	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)

	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1212)

	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)

	at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:59)

	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)

	at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:322)

	at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:59)

	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)

	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)

	at org.eclipse.jetty.server.Server.handle(Server.java:500)

	at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383)

	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:547)

	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)

	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:270)

	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)

	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)

	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)

	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)

	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)

	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)

	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129)

	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:388)

	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)

	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)

	at java.lang.Thread.run(null)

Traceback (most recent call last):
  File "<input>", line 10, in <module>
	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.error(AbstractDBUtilities.java:362)

	at com.inductiveautomation.ignition.common.script.builtin.AbstractDBUtilities.execSProcCall(AbstractDBUtilities.java:497)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

	at java.base/java.lang.reflect.Method.invoke(Unknown Source)

java.lang.Exception: 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:** [July 21, 2020, 10:56am UTC](https://forum.inductiveautomation.com/t/calling-postegresql-11-stored-procedures/23786/7 "2020-07-21T10:56:53Z")

</div>

What version of the PostgreSQL JDBC driver are you using?

---

<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:** [July 21, 2020, 6:02pm UTC](https://forum.inductiveautomation.com/t/calling-postegresql-11-stored-procedures/23786/8 "2020-07-21T18:02:24Z")

</div>

PostgreSQL JDBC 4.2 Driver, 42.2.14
