0

Does r2dbc currently supports calling Stored proc in my sql with in/out parameters ?

I am trying to call Stored Proc using databaseClient which returns a String.But I am getting the below exception.Do I have to add anything to call SP from r2dbc.My stored procedure looks like this.How to call SP using database-client

CREATE PROCEDURE usp_get_data(in someId varchar(255),
in someName varchar(255),
out email varchar(255))
BEGIN
    SELECT email  FROM products where id=:someId and name=:someName LIMIT 1;
END //

Below is my code.

 String STORED_PROC = "call usp_get_data(:someId,:someName)"

 def result = databaseClient.execute(STORED_PROC)
                .bindNull("someId","someId")
                .bindNull("someName", "someName")
                .as(String.class)
                .fetch().one()
 Incorrect number of arguments for PROCEDURE usp_get_data expected 3, got 2))
Arnold
  • 73
  • 8

1 Answers1

1

Forgot to add @out in the call stored procedure statement.

modifying my execution below worked.

 String STORED_PROC = "call usp_get_data(:someId,:someName,@email);
Select @email"
Arnold
  • 73
  • 8