Search code examples
mysqlstored-proceduresout

Stored routine out parameter stub


I have a mysql 5.5 stored routine:

PROCEDURE get_stuff(IN po_id BIGINT, OUT po_name VARCHAR(32), OUT po_value VARCHAR(32)) ...

I want call this procedure from other routine, but I dont need all out parameters of previous routine:

PROCEDURE do_work(IN po_id BIGINT)
BEGIN
    DECLARE stuff_value VARCHAR(32) DEFAULT NULL;

    CALL get_stuff(po_id, /* dont need this out param */, stuff_value);
    ...

Is there a way to stub out parameter of stored routine?


Solution

  • Well, you can't set optional parameters in MySQL stored procedures. There isn't currently a way to define a default value for a parameter and therefore all parameters need to be passed a value.