Netezza for loop
Posted: Wed Sep 19, 2018 3:28 pm
Hey guys, I have been reading up on for loops as I am hoping to simplify one of our cleanup tasks. I started reviewing here:
http://dwgeek.com/netezza-nzplsql-contr ... ures.html/
and attempted to run a for loop straight up and this fails miserably, nzsql and aginity are expecting something before the FOR. Continuing my reading I've come across several examples such as this:
However when attempting something like this I get an error as follows:
I'm curious how one goes about doing this?
http://dwgeek.com/netezza-nzplsql-contr ... ures.html/
and attempted to run a for loop straight up and this fails miserably, nzsql and aginity are expecting something before the FOR. Continuing my reading I've come across several examples such as this:
Code: Select all
CREATE OR REPLACE PROCEDURE generateTime(integer)
LANGUAGE NZPLSQL RETURNS varchar(255) AS
BEGIN_PROC
DECLARE
p_abc integer;
p_bcd integer;
p_var1 ALIAS FOR $1;
BEGIN
p_bcd := ISNULL(p_var1, 10);
raise notice 'p_bcd=%',p_bcd;
FOR p_abc in 0..(p_bcd)
LOOP
raise notice 'Hello World %', p_abc;
END LOOP;
END;
END_PROC;
Code: Select all
ERROR: 'CREATE OR REPLACE PROCEDURE generateTime(integer) LANGUAGE NZPLSQL RETURNS varchar(255) AS BEGIN_PROC DECLARE p_abc integer'
error ^ found "" (at char 91) unterminated BEGIN_PROC string