2

Is it possible to call a procedure from a function in MySQL? I get the error "not allowed to return a result set from a function." I want the results of the procedure call to be inserted into the function variables the same as if I had done a SELECT INTO directly in the function.

The function is (simplified) defined as

create function my_function()
   returns int deterministic
   begin
     declare some_parameter int;
     declare the_result int;

     call my_procedure(some_parameter, the_result)

     return the_result;

   end;

The procedure is (simplified) defined as:

create procedure my_procedure(in my_parameter int, out my_result int)
    begin
        select 1 
        from dual;
   end;

1 Answer 1

1

In essence, no. Functions are looking for a datatype, not a record (which is what is returned from the procedure).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.