How to break cycles in Snowflake when running recursive queries

Viewed 461

I am running a hierarchical query in snowflake using the CONNECT BY clause in the form of

SELECT
       CONNECT_BY_ROOT field_a
     , field_a
     , SYS_CONNECT_BY_PATH (field_b, '/') AS path_
FROM my_table
START WITH field_a 
CONNECT BY  PRIOR  field_b =  field_a;

The problem is my table has some loops and snowflake is stopping after 100 iterations or never finishing the query. Is there anyway to break cycles like Oracle does with the NOCYCLE clause?

1 Answers
Related