Page 1 of 1

Netezza for loop

Posted: Wed Sep 19, 2018 3:28 pm
by jackson.eyton
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:

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;
However when attempting something like this I get an error as follows:

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
I'm curious how one goes about doing this?

Posted: Thu Sep 20, 2018 6:06 am
by chulett
Probably best to post this in a dedicated Netezza support forum...

Posted: Thu Sep 27, 2018 2:56 pm
by jackson.eyton
Opened a case with IBM after the one and only netezza specific forum based site I posted on got no response. Seems like a dead site.... Stack Exchange I suppose could work but I've never been a fan of posting there. I will update this again once I get a solution from IBM.