recursive function

Database

recursive function

Hi

One of my SQL is failing with the below error.I tried using cast function also.But it is not working.here the coli1,col2,col3 are CHAR fileds and the id is DECIMAL(38,0).

Can any one help me to resolve this.

ERROR:

 *** Failure 2616 Numeric overflow occurred during computation.

                Statement# 1, Info =0

 *** Total elapsed time was 17 seconds.

SQL:

INSERT INTO  tableA

           ( col1,

            col2

          , id

          ,col3

    )

 WITH RECURSIVE  recursive_tbl

               ( col 1,

                 col 2

    ,recurselevel

    ,col 3

                )

             AS

               ( SELECT  Table B

             col1 ,

col2,

                 1  ,

                 '' ,

                    FROM  Table c

               UNION ALL

                  SELECT

               Col1 ,

                                Col 2,

                                 r.recurselevel + 1,

                                 ''

                     FROM recursive_tbl AS r

                 )

            SEL

                Col1,

                Col 2,

                 recurselevel    ,

                col3

           FROM  recursive_tb

1 REPLY
Enthusiast

Re: recursive function

you need to specify end confition for your recursive loop. it should not loop infinitly.