Home > Contents > Index >
SELECTTO
Executes a simple query from a table.
Syntax
<SELECTTO FROM="CATALOG_NAME" [WHAT="WHAT_CRITERIA"] LIST="OUTPUT_LIST" [WHERE="WHERE_CRITERIA"] [ORDERBY="ORDERBY_EXPRESSION"] [LIMIT="MAX_NO_RESULTS"]/>Parameters
FROM (required)
- Name of the Sites table to query. The table must be registered in the SystemInfo table. This table verifies security and caches result sets when the
cc.cacheResults
property is enabled.
WHAT (optional)
- List of columns to return. The format of
WHAT_CRITERIA
is a comma-separated list of column names.
LIST (required)
- Name of the list to contain the resultset.
WHERE (optional)
- Comma-separated list of table columns to select against. For each item in the
WHERE
string, the value of the corresponding variable is used to construct a SQL WHERE clause. All the elements in the comma-separated list must be variables. When you specify a datetime field in theWHERE_CRITERIA
, Sites uses thecc.datepicture
property to convert the supplied datetime to the proper format.
ORDERBY (optional)
- Orders the rows returned by the query. The format of
ORDERBY_EXPRESSION
is a comma-separated list of column names. You can also override the default sort order by specifying ascending/descending with a (potentially) database specific command like:
ORDERBY="colname1 desc,colname2 asc"
LIMIT (optional)
- Maximum number of rows to return.
- Note that if the
LIMIT
parameter is omitted or is less than or equal to 0, then no limit exists and the entire recordset is returned.
Description
The
SELECTTO
tag executes a simple query from a table. The results are stored in a list.Error Numbers
The possible values of
errno
include:
Value Description -101 No search results. -106 One of the elements in the WHERE clause was not a variable. (All elements in the WHERE clause must be variables.)Example
The following example selects all columns from the SystemInfo table and puts the results into a list called
RS
for later use.
<SELECTTO FROM="SystemInfo" WHAT="*" LIST="RS" />
The next example demonstrates a comma-separated list. It selects records in the visitor table where
firstname = Fred
andlastname = Smith
. It then loops through the list if the list is created and has records.
<SETVAR
NAME="firstname" VALUE="Fred"/> <SETVAR
NAME="lastname" VALUE="Smith"/> <SETVAR
NAME="tablename" VALUE="visitor"/> <SELECTTO FROM="Variables.tablename" WHAT="*" WHERE="firstname, lastname" LIST="VisitorLst" /> <SETVAR
NAME="CurErr" VALUE="Variables.errno"/> <IF COND="IsList.Visitor=true"> <THEN> <IF
COND="Variables.CurErr!=-101"> <THEN> <LOOP LIST="VisitorLst"> <CSVAR
NAME="FOUND MATCH: VisitorLst.firstname,VisitorLst.lastname" /> </LOOP> </THEN> <ELSE> <CSVAR
NAME="NO RECORD FOUND matching, Variables.firstname Variables.lastname" /> </ELSE> </IF> </THEN> <ELSE> Error creating list<BR/> <!-- put error handling code here --> </ELSE> </IF>See Also
Home > Contents > Index > ![]()
Oracle XML Tag Reference
Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.