I found a previous post (Cursors in BigQuery) where there exists a way to declare cursors on bigquery. This works well and good when the cursor subquery is not present as a parameter.
Currently I was going through FOR..IN EXECUTE
construct in Netezza. It behaves extactly like a cursor construct except here, the sql present is a dynamic sql. This dynamic sql is first executed, after that the construct boils down to a simple cursor statement.
Consider the following use case, where the sub-query is present as a parameter.
CREATE or replace PROCEDURE myproc(varchar(256))
RETURNS INT4
LANGUAGE NZPLSQL
AS
BEGIN_PROC
declare
sqlstr alias for $1; ---- sqlStr is a parameter
r1 record;
begin
FOR r1 IN EXECUTE sqlstr ---- sqlStr is evaluated after that it boils down to cursor statement.
loop
insert into t1 values r1.c1;
end loop;
end;
END_PROC@
Is there a similiar way to declare cursors with subquery as a parameter on BigQuery ?