FROM clause: Database and remote subquery syntax

Retrieves data from a relational database, public window, or another remote source, directly into a CCL query.

Syntax

FROM { { db_sub> | rem_sub>} { , | [LEFT OUTER] JOIN } stream [[AS] alias ] } | { stream [[AS] alias ] { , | [RIGHT OUTER] JOIN} { db_sub> | rem_sub>} }
Components

db_sub

A database subquery. See Database Subquery for more information.

rem_sub

A remote subquery. See Remote Subquery for more information.

stream

The name of a data stream.

alias

An alias for the stream.

Usage

Use this specialized form of the FROM clause to send requests for information directly to an external relational database, public window, or other external source. This data is retrieved directly into the CCL query. Two types of specialized subqueries are used for this purpose in the FROM clause.

Note:

These subqueries are distinct from CCL subqueries, which are described in CCL Subqueries in the FROM Clause.

A database subquery sends SQL statements to an external relational database or Sybase CEP Engine project containing a public window and retrieves rows from tables in the database, or public windows contained in the project. A remote subquery sends Remote Function Calls (RFCs) using one of a variety of available protocols to another external non-CCL data source, and retrieves the resulting data into a CCL query.

Before using either the database subquery or the remote subquery, configure Sybase CEP Engine for communication with the external database, project containing the public window, or other data source. For instructions on configuring Sybase CEP Engine for use with external services, see the Sybase CEP Installation Guide .

Both the database subquery and the remote subquery perform only information retrieval; neither of these clauses modifies the external data sources. The database and remote subqueries each have a CCL statement counterpart, however, that is used to modify external data sources. The Database statement writes to tables in an external relational database (but not to a CCL public window). The Remote Procedure statement executes procedures on external services.

The database subquery or remote subquery is always joined in the FROM clause to a single data stream. The join between the database or remote subquery and the stream can be an inner join or a right or left outer join, but not a full join.

JOIN or comma (,)

Specifies an inner join

All possible combinations of rows from the intersection of the data stream and the database subquery or remote subquery (limited by the selection condition, if specified) are published.

LEFT OUTER JOIN

Specifies a left outer join (data stream must be on left)

All possible combinations of rows from the intersection of the data stream and the database subquery or remote subquery (limited by the selection condition, if specified) are published. All other rows from the data stream are published as well. Unmatched columns in the database subquery or remote subquery publish a value of Null.

RIGHT OUTER JOIN

Specifies a right outer join (data stream must be on right)

As for LEFT OUTER JOIN

The ON clause is not used with this type of join.

Queries that use the database subquery or remote subquery variety of the FROM clause execute only when a row arrives in the data stream.

For more detailed information about the database subquery and remote subquery usage see Database Subquery and Remote Subquery.