Alistair:

Yep. But we still have to define and populate that table. Not a big deal, but sometimes there's work populating the table which a syntax like below would handle in one line.

Sort of like a LISTOF() function for cursors.

'Muchly' appreciated

Bruce Chitiea
SafeSectors, Inc.
909.238-9012 Mobile

Symbol = TAFKAB "The American Formerly Known As Bruce"
(If "Prince" could get away with it ...)

------ Original Message ------
Sent: 2/16/2017 11:45:29 PM
Subject: Re: [RBASE-L] - DECLARE CURSOR Source Data Array
From: "Alastair Burr" <[email protected]>
To: "[email protected]" <[email protected]>
Cc:

Create a (temp) table?

Regards,
Alastair.

On 16/02/2017 16:26, Bruce Chitiea wrote:
Thanks, Karen.

That's pretty much what I've been doing. I've been stepping through incrementing values within nested loops, or using a loop inside a cursor.

Just wondering how one might replace that "inside" loop with a cursor.

Thinking of a syntax along the lines of:

DECLARE CursorName CURSOR (1,2,3,4,5)
or:
DECLARE CursorName CURSOR ARRAY(arg1,arg2,arg3)

where at their simplest:

arg1 = starting value
arg2 = ending value
arg3 = increment

Thinking major speed improvement and code simplification with a cursor.

Bruce

------ Original Message ------
Sent: 2/16/2017 8:17:46 AM
Subject: Re: [RBASE-L] - DECLARE CURSOR Source Data Array
From: "karentellef via RBASE-L" <[email protected]>
To: [email protected]
Cc:

Can you do a while loop with a ssub?

SET VAR vLoop INT = 1
SET VAR vList = (1,2,3,4,5)
WHILE 1 = 1 THEN
  SET VAR vText = (SSUB(.vList,.vLoop))
  IF vText IS NULL
    BREAK
  ENDIF

  -- Do something

  SET VAR vLoop = (.vLoop + 1)
ENDWHILE

Karen




-----Original Message-----
From: Bruce Chitiea <[email protected]>
To: rbase-l <[email protected]>
Sent: Thu, Feb 16, 2017 10:09 am
Subject: [RBASE-L] - DECLARE CURSOR Source Data Array

All:

Is there an "elegant" way to do this with a simple array of values:

DECLARE CursorName CURSOR FOR (1,2,3,4,5)

... where we're stepping through the array WITHOUT drawing upon a source table?

A long shot:

SELECT 1,2,3,4,5 FROM TableName LIMIT 1

... (where TableName is any table chosen arbitrarily to provide syntax) produces:

1 2 3 4 5

... instead of the needed:

1
2
3
4
5

Thoughts?

Bruce Chitiea
SafeSectors, Inc.
909.238.9012 Mobile


--
You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. For more options, visit https://groups.google.com/d/optout <https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout <https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout <https://groups.google.com/d/optout>.


--
You received this message because you are subscribed to the Google Groups "RBASE-L" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to