Welcome Guest! Log in

Topic-icon Question Call a procedure and get the return

More
02 Sep 2015 13:04 #1 by TAOUILI
Call a procedure and get the return was created by TAOUILI
Hi,

I'm trying to call a procedure in database (function) from stambia s18, I want get the parameters returned.
There is a way to make this.
Thanks in advance.

Please Log in or Create an account to join the conversation.

More
02 Sep 2015 14:27 #2 by Thomas BLETON
Replied by Thomas BLETON on topic Call a procedure and get the return
Hi,

Can you please specify more info on what you need to do :
- do you need to call this function from a mapping expression, a single call in a SqlOperation ?
- what rdbms are you working with ?
- do you have an example of the returned parameters and how you want to use them ?

Please Log in or Create an account to join the conversation.

More
02 Sep 2015 15:19 #3 by TAOUILI
Replied by TAOUILI on topic Call a procedure and get the return
I want to call this function not from a mapping but in sql operator.
I use Postgresql as RDBMS.


My function is just a simple one:
[


DECLARE
i integer;
BEGIN

select max(c1) into i from work.test;

insert into work.test (c1, c2) values (i+1, 'analytics');
RETURN 1 ;
END ;

]
The message error :
Calculator/SqlOperation
org.postgresql.util.PSQLException: Un résultat a été retourné alors qu'aucun n'était attendu.


By the way, how to get the result of select query.
Attachments:

Please Log in or Create an account to join the conversation.

More
02 Sep 2015 15:31 #4 by Thomas BLETON
Replied by Thomas BLETON on topic Call a procedure and get the return
Your SqlOperation is set to "DDL_DML" action type.
If you want to SELECT data, you need to set the action type to SELECT, and bind it to some action to treat the data.

If your need is to get the result in a process parameter, you can alternatively use a SqlToParameters action.

Please Log in or Create an account to join the conversation.