Referring to Jelly Views

To refer to a Jelly View, or its attributes in the query, an explicit SQL alias should be used for the particular Jelly View. In order to refer to its name and attributes the Jelly View's schema should be used. The schema is provided by the External Matching (tp-argument and table-predicate entities in Figure 8.3).

For example, having following query (assuming that there is the following Jelly View schema defined: jelly(first,second)):

  SELECT * 
  FROM jelly(,2), 
       other_relation
  WHERE jelly.first > 4
  ;
The reference jelly.first will apply to the appropriate Jelly Table, because the query will be rewritten as follows:
  SELECT * 
  FROM jelly, 
       other_relation
  WHERE jelly.first > 4
  ;

In order to distinguish Jelly Views with different arguments a SQL relation aliases have to be used. For example (assuming that there is the same Jelly View schema - the External Matching - as before):

  SELECT * 
  FROM jelly(,2) AS j1, 
       jelly(,3) AS j2, 
       other_relation
  WHERE j1.first > 4, 
        j2.first < 5
  ;
It will be rewritten as:
  SELECT * 
  FROM jelly AS j1, 
       jelly1 AS j2, 
       other_relation
  WHERE j1.first > 4, 
        j2.first < 5
  ;

Jelly View aliases enable to use the same Jelly View with different arguments as many times, as it is needed.



Igor Wojnicki 2005-11-07