Closed MarcTerrasson closed 1 month ago
The above @Procedure
query works as expected. In addition to your input parameters, Integer createImport(…);
also registers an out parameter for the return value. If you switch to void
, then you will see only three parameters.
Ok it seems I fail to see how to call a stored procedure with 3 parameters and a returned value like the following (I also complete the original post with it)
DELIMITER $$
CREATE PROCEDURE `import.SP_CreateImport`(IN `categoryCode` VARCHAR(10), IN `typeCode` VARCHAR(10), IN `name` VARCHAR(10), OUT `result` INT)
Select 1$$
DELIMITER ;
@Procedure(procedureName = "import.SP_CreateImport")
Integer createImport(String categoryCode, String typeCode, String name);
I though it would works. Could you help me please ?
This is not a general Q&A forum and not a gound for exploring how your tooling is supposed to work.
You can get it to work with the following SQL declaration:
CREATE PROCEDURE SP_CreateImport(@categoryCode VARCHAR(10), @typeCode VARCHAR(10), @name VARCHAR(10), @result INT OUT)
AS
BEGIN
SET @result = 123;
END
Note that as soon you return a result set (SELECT 1
), you're no longer able to obtain a return value.
Hi,
I used @Procedure annotation to call a stored procedure in a MS SQL-Server and it create one argument too many. I tried with @Query and it's ok.
Here is the stored procedure declaration
With @Procedure
result in
With @Query
result in
I still have work to do but the last issue lies in my SQL stored procedure, not in Java.