Retrieves rows from database objects. You can issue this command either as language command or a CT-Library cursor request.
select select_list [from [[database.]owner.]{table_name |view_name} [,[[database.]owner.]{table_name|view_name}]...] [where search_conditions]
is one or more of the following items:
A list of column names in the order in which you want them returned
An aggregate function
Any combination of the items listed previously
indicates the particular tables and views to use in the select statement.
lists tables and views used in the select statement. If more than one table or view is in the list, their names are separated by commas. Table names and view names are given correlating names. This is done by providing the table or view name, then a space, then the correlation name, such as:
select * from publishers t1, authors t2
sets the conditions for the rows that are retrieved. A search condition can include column names, constants, joins, the keywords is null, is not null, or, like, and, or any combination of these items.
finds a value for each group. These values appear as new columns in the results, rather than as new rows.
sorts the results by columns.
sets conditions for the group by clause, similar to the way that where sets conditions for the select clause. There is no limit on the number of conditions that can be included.
returns a single result set that combines the results of two or more queries. Duplicate rows are eliminated from the result set unless the all keyword is specified.
indicates that the cursor is a read-only cursor, and that updates cannot be applied to rows made current by it.
indicates that the cursor is an updatable cursor, and that the rows it makes current can be deleted or updated.
select count(*) from publishers for read only
select pub_id, pub_name, city, state from publishers for read only
select pub_name, pub_id from publishers
select type, price from titles where price > @p1 for update of price
select stor_id, stor_name from sales union select stor_id, stor_name from sales_east
The TEXTPTR() function cannot appear in the select list.
All Adaptive Server 10.x aggregate functions are supported:
sum ( distinct )
avg ( distinct )
count ( distinct )
count (*)
max (expression)
min (expression)
The DB2 access service does not transform correlation names.
You can issue the select command either as a language command or a client-based cursor request.
If a cursor is passed a new set of parameters before it is opened, it can be reused multiple times.
If passed as a cursor command, the data values used in the where clause search conditions are passed as cursor parameters. These parameters use the datatype associated with the column.
Cursor parameters are indicated with an @ (at) symbol.
Refer to sp_capabilities for specific functions that the DB2 access service supports.
Copyright © 2005. Sybase Inc. All rights reserved. |