2 Replies Latest reply on Aug 1, 2012 2:27 PM by Mark Addleman Branched from an earlier discussion.

    Re: Continuous request against Procedure Execution

    Mark Addleman Master

      Hi,

       

      I think I'm in need of some basic SQL tutorial.

       

      Ideally, I would like to issue a continuous query of the form:

      WITH timerange AS (select * from TABLE(call Times.timerange(start, end, period)))

            SELECT * FROM table_with_time_element t WHERE t.timestamp BETWEEN timerange.start AND timerange.end

       

      It seems to be a concise and meaningful query that, in effect, causes Teiid to re-execute the inner select on a periodic basis.  What is bugging me is the semantics of the WITH clause:  Everywhere I read about WITH, it indicates that it effectively creates a temp table.  If so, even though the timerange stored proc is a reusable execution, my guess is that Teiid only queries it for values once, creates its temp table and then executes the inner SELECT continuously.  Of course, this isn't what I wanted but WITH may be the wrong way of going about it.