Skip to Content
avatar image
Former Member

SQL Script Numeric For Loop

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;

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Oct 30, 2016 at 03:23 PM

    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

    Add comment
    10|10000 characters needed characters exceeded