Hi Victor,
> I see 2 problems with this query:
> 1) CTE is just a named subquery, in your query I see no reference to
> the “upd_code” CTE.
> Therefore it is never gets called;
So, in conclusion, my misconception about CTE in general was that all CTE get called without being referenced.
Thank you much for the explanation.
-Kong