sqlgoogle-bigquery

Call BigQuery Stored Procedure by naming parameters


I have a BigQuery stored procedure that is defined like this:

CREATE OR REPLACE PROCEDURE proc_name(
    param_1 INT64,
    param_2 INT64,
    param_3 DATE
)
BEGIN
//CODE
END

When I call the procedure by doing something like this, I have no issues:

CALL proc_name(1,1,'2022-11-23')

However, I'd like to be able to call it by naming the parameters as I can't always ensure the order they are passed through in is the same order they are declared, for example:

CALL proc_name(
  param_2 = 10
  param_3 = '2022-11-23'
  param_1 = 5
)

I've tried the above and had no success - Query error: Unrecognized name: param_2 at [2:3]

Is there a way of doing what I want?


Solution

  • I am not sure it is possible. According to documentation about procedure calling the syntax should follow:

    CALL procedure_name (procedure_argument[, …])
    

    So, at this moment I don't see any permissive ways to use the argument names explicitly in the procedure call.