'Creates the SQL for this query. Returns the SQL string and list
of parameters.  This is overriden from the original Query class
to handle the additional SQL Oracle requires to emulate LIMIT
and OFFSET.
If \'with_limits\' is False, any limit/offset information is not
included in the query.'

def as_sql(self, with_limits=True, with_col_aliases=False):

    do_offset = (with_limits and ((self.query.high_mark is not None) or self.query.low_mark))
    if (not do_offset):
        (sql, params) = super(SQLCompiler, self).as_sql(with_limits=False, with_col_aliases=with_col_aliases)
    else:
        (sql, params) = super(SQLCompiler, self).as_sql(with_limits=False, with_col_aliases=True)
        high_where = ''
        if (self.query.high_mark is not None):
            high_where = ('WHERE    ROWNUM    <=    %d' % (self.query.high_mark,))
        sql = ('SELECT    *    FROM    (SELECT    ROWNUM    AS    "_RN",    "_SUB".*    FROM    (%s)    "_SUB"    %s)    WHERE    "_RN"    >    %d' % (sql, high_where, self.query.low_mark))
    return (sql, params)
