Home > Contents > Index >
Template Tags TOC | Alpha TOC | Tag Family TOC | Purpose TOC | Annotated TOC | Index
ics:selectto
Executes a simple query from a table.
Syntax
<ics:selectto table="table name" [what="what criteria"] listname="output list" [where="where criteria"] [orderby="orderby expression"] [limit="max number of results"]/>Parameters
table (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.cacheResultsproperty is enabled.
what (optional)- List of columns to return. This parameter accepts a comma-separated list of column names.
listname (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
wherestring, the value of the corresponding variable is used to construct a SQLwhereclause. All the elements in the comma-separated list must be variables. When you specify a datetime field as thewhere criteria, Sites uses thecc.datepictureproperty to convert the supplied datetime to the proper format.
orderby (optional)- Orders the rows returned by the query. The format of
orderbyis 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
limitparameter is omitted or is less than or equal to 0, then no limit exists and the entire recordset is returned.
Description
The
ics:selecttotag executes a simple query from a table. The results are stored in a list.Error Numbers
The possible values of
errnoinclude:
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
RSfor later use.<ics:selectto table="SystemInfo" what="*" listname="RS" />The next example demonstrates a comma-separated list. It selects records in the visitor table where
firstname = Fredandlastname = Smith. It then loops through the list if the list is created and has records.<ics:setvar name="firstname" value="Fred"/> <ics:setvar name="lastname" value="Smith"/> <ics:setvar name="tablename" value="visitor"/> <ics:selectto table="<%=ics.GetVar("tablename")%>" what="*" listname="VisitorList" where="firstname, lastname"/> <ics:if condition='<%=ics.GetErrno() != -101%>'> <ics:then> <ics:listloop listname="VisitorLst"> FOUND MATCH:<ics:listget listname="VisitorList" fieldname="firstname"/> <ics:listget listname="VisitorList" fieldname="lastname"/> <br> </ics:listloop> </ics:then> <ics:else> No records found. </ics:else> </ics:if>See Also
Home > Contents > Index > ![]()
Oracle JSP Tag Reference
Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.