Netezza for loop

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
jackson.eyton
Premium Member
Premium Member
Posts: 145
Joined: Thu Oct 26, 2017 10:43 am

Netezza for loop

Post 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?
-Me
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Probably best to post this in a dedicated Netezza support forum...
-craig

"You can never have too many knives" -- Logan Nine Fingers
jackson.eyton
Premium Member
Premium Member
Posts: 145
Joined: Thu Oct 26, 2017 10:43 am

Post 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.
-Me
Post Reply