cancel
Showing results for 
Search instead for 
Did you mean: 

SQL Script Numeric For Loop

Former Member
0 Kudos

Getting error - Cannot create catalog object:invalid identifier

I have written the following code but keep getting the above error and don't know where is the issue. Could you please assist to correct this code.

PROCEDURE"GARGM"."mgarg::IS_SKIPCOL"(INcolumnname VARCHAR, OUT v_result BOOLEAN )

LANGUAGESQLSCRIPT

AS

i INTEGER := 0;

BEGIN

/*****************************

Write your procedure logic

*****************************/

lt_skipcol = SELECT* FROM "GARGM"."mgarg::GLOBAL.lst_col" ;

FOR i IN lt_skipcol.First .. lt_skipcol.Last

DO

END FOR;

END;

Accepted Solutions (0)

Answers (1)

Answers (1)

pfefferf
Active Contributor
0 Kudos

Hello Manish,

you are using the column names "First" and "Last" of your local table "lt_skipcol" as integer start and end values for your FOR loop. The problem is that "lt_skipcol" is a table and the FOR loop does not know from which line the values have to be taken.

If, for instance, the values of the first line of your "lt_skipcol" table should be used, you could use for example the indexed based cell access like following:

FOR i IN :lt_skipcol.First[1] .. :lt_skipcol.Last[1] DO
... END FOR;

Regards,
Florian