On Wed, Oct 27, 2021 at 5:43 AM Dylan Camilleri <[email protected]> wrote:

> An update:
>
> This works and executes the procedure and "creates the customer"
>
> out_param = 0
>                 result =
> @@db.dataset.call_sproc(:update,"SpInsertCustomer",out_param,"Test
> Customer",99,18,2,"123456",nil)
>
> puts out_param >> 0 (no change)
> puts result >> nil (no return value)
>
> Basically the issue is I am not getting back the value from the executed
> procedure result:
>
> Oracle definition:
>
> PROCEDURE SpInsertCustomer(
>        *pCustomerID*  *OUT* NUMBER,
>        pTitle  VARCHAR2 ,
>        pProduct  IN NUMBER ,
>        pType  NUMBER ,
>        pStatus  NUMBER ,
>        pCustomerNo  VARCHAR2 ,
>        pPassword  VARCHAR2  DEFAULT NULL)
>

out_param will always be 0.  Integers are immutable in Ruby, and a method
call cannot change the value of a local variable of the caller.

You could try switching update to select and see if the return value
includes the OUT column.  If that doesn't work, you'll need to use the JDBC
API directly (see the JDBC documentation for how to do that):

@@db.synchronize do |conn|
  # conn is the JDBC connection object
end

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/CADGZSScu2vui2hKTEfQA_wUUkeO293eQj6e58Mr-zhnouPgvmQ%40mail.gmail.com.

Reply via email to