Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## gudusoft.gsqlparser.stmt
Class TSelectSqlStatement

    java.lang.Object
      gudusoft.gsqlparser.nodes.TParseTreeNode
          gudusoft.gsqlparser.TCustomSqlStatement
              gudusoft.gsqlparser.stmt.TSelectSqlStatement

All Implemented Interfaces:
  Visitable

    public class TSelectSqlStatement

extends TCustomSqlStatement

A query specifies a result table. A query is a component of certain SQL statements.

The three forms of a query are:

- subselect
- fullselect
- select-statement

This class represents all three above forms of a query.

subselect

The subselect is a component of the fullselect.

A subselect specifies a result table derived from the tables, views or nicknames identified in the FROM clause.

The clauses of the subselect are processed in the following sequence:

- FROM clause
- WHERE clause
- GROUP BY clause
- HAVING clause
- SELECT clause
- ORDER BY clause
- FETCH FIRST clause

A subselect that contains an ORDER BY or FETCH FIRST clause cannot be specified:

- In the outermost fullselect of a view.
- In a materialized query table.
- Unless the subselect is enclosed in parenthesis.

Syntax:

>      select-clause from-clause [where-clause] [group-by-clause] [having-clause] [order-by-clause]

fullselect

The fullselect is a component of the select-statement, the INSERT statement, and the CREATE VIEW statement.

It is also a component of certain predicates which, in turn, are components of a statement.

A fullselect that is a component of a predicate is called a subquery, and a fullselect that is enclosed in parentheses is sometimes called a subquery.

The set operators UNION, EXCEPT, and INTERSECT correspond to the relational operators union, difference, and intersection.

A fullselect specifies a result table. If a set operator is not used,the result of the fullselect is the result of the specified subselect or values-clause.

Syntax:

>      {subselect|(fullselect)|values-clause}[UNION|UNION ALL|EXCEPT|EXCEPT ALL|INTERSECT|INTERSECT ALL {subselect|(fullselect)|values-clause}][,...n] [order-by-clause]

select-statement

The select-statement is the form of a query that can be directly specified in a DECLARE CURSOR statement, or prepared and then referenced in a DECLARE CURSOR statement.

the table specified by a select-statement is the result of the fullselect.

Syntax:

>      [WITH common-table-expression] fullselect [update-clause]

Field Summary
`static int` | `setOperator_except`
`static int` | `setOperator_exceptall`
`static int` | `setOperator_intersect`
`static int` | `setOperator_intersectall`
`static int` | `setOperator_minus`
`static int` | `setOperator_minusall`
`static int` | `setOperator_none`
`static int` | `setOperator_union`
`static int` | `setOperator_unionall`

Fields inherited from class gudusoft.gsqlparser.TCustomSqlStatement
`dbvendor, dummytag, joins, parser, plsqlparser, rootNode, sourcetokenlist, sqlstatementtype, tables`

Constructor Summary
`TSelectSqlStatement(EDbVendor dbvendor)`

Method Summary
`void` | `accept(TParseTreeVisitor v)`
`TOrderBy` | `addOrderBy(java.lang.String orderByStr)`
`TWhereClause` | `addWhereClause(java.lang.String condition)` This method must be override in select/delete/update statement
`int` | `doParseStatement(TCustomSqlStatement psql)`
`TComputeClause` | `getComputeClause()`
`TExpandOnClause` | `getExpandOnClause()`
`TForUpdate` | `getForUpdateClause()`
`TGroupBy` | `getGroupByClause()`
`THierarchical` | `getHierarchicalClause()` The hierarchical_query_clause lets you select rows in a hierarchical order.
`TIntoClause` | `getIntoClause()`
`TSelectSqlStatement` | `getLeftStmt()` Valid when `getSetOperator()` is not setOperator_none.
`TLimitClause` | `getLimitClause()` MySQL limit clause
`TPTNodeList<TLockingClause>` | `getLockingClauses()`
`java.lang.String` | `getOracleHint()`
`TOrderBy` | `getOrderbyClause()` Use the ORDER BY clause to order rows returned by the statement.
`TQualifyClause` | `getQualifyClause()`
`TSelectSqlStatement` | `getRightStmt()` Valid when `getSetOperator()` is not setOperator_none.
`TSampleClause` | `getSampleClause()` SQL Server sample clause
`TSelectDistinct` | `getSelectDistinct()`
`TSourceToken` | `getSelectToken()`
`int` | `getSetOperator()` The set operators UNION, EXCEPT, and INTERSECT correspond to the relational operators union, difference, and intersection.
`TTeradataWithClause` | `getTeradataWithClause()`
`TValueClause` | `getValueClause()` DB2 value clause
`TWindowClause` | `getWindowClause()`
`boolean` | `isCombinedQuery()`
`void` | `setSelectToken(TSourceToken selectToken)`

Methods inherited from class gudusoft.gsqlparser.TCustomSqlStatement
`analyzeFromTable, analyzeJoin, analyzeTablename, checkNonQualifiedColumnReferenceInSubQueryOfUplevelStmt, getCteList, getErrorCount, getLabelName, getOutputClause, getParentStmt, getResultColumnList, getReturningClause, getStatements, getSymbolTable, getTargetTable, getTopClause, getTopStatement, getWhereClause, isnzplsql, isoracleplsql, ispgplsql, linkColumnReferenceToTable, locateVariableOrParameter, OracleStatementCanBeSeparatedByBeginEndPair, parsestatement, setCteList, setLabelName, setOutputClause, setParentStmt, setResultColumnList, setReturningClause, setTargetTable, setTopClause, setWhereClause`

Methods inherited from class gudusoft.gsqlparser.nodes.TParseTreeNode
`addAllMyTokensToTokenList, doParse, getColumnNo, getDummyTag, getEndToken, getGsqlparser, getLineNo, getNodeType, getStartToken, init, init, init, init, init, init, setDummyTag, setEndToken, setEndToken, setGsqlparser, setNodeType, setStartToken, setStartToken, setString, toString`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### setOperator_none

    public static final int setOperator_none

See Also:
  Constant Field Values

### setOperator_union

    public static final int setOperator_union

See Also:
  Constant Field Values

### setOperator_unionall

    public static final int setOperator_unionall

See Also:
  Constant Field Values

### setOperator_intersect

    public static final int setOperator_intersect

See Also:
  Constant Field Values

### setOperator_intersectall

    public static final int setOperator_intersectall

See Also:
  Constant Field Values

### setOperator_minus

    public static final int setOperator_minus

See Also:
  Constant Field Values

### setOperator_minusall

    public static final int setOperator_minusall

See Also:
  Constant Field Values

### setOperator_except

    public static final int setOperator_except

See Also:
  Constant Field Values

### setOperator_exceptall

    public static final int setOperator_exceptall

See Also:
  Constant Field Values

Constructor Detail

### TSelectSqlStatement

    public TSelectSqlStatement(EDbVendor dbvendor)

Method Detail

### setSelectToken

    public void setSelectToken(TSourceToken selectToken)

### getSelectToken

    public TSourceToken getSelectToken()

### getWindowClause

    public TWindowClause getWindowClause()

### getLockingClauses

    public TPTNodeList<TLockingClause> getLockingClauses()

### getSelectDistinct

    public TSelectDistinct getSelectDistinct()

### getIntoClause

    public TIntoClause getIntoClause()

  Returns:
    into clause of select statement if any.

### getOrderbyClause

    public TOrderBy getOrderbyClause()

  Use the ORDER BY clause to order rows returned by the statement.

  Returns:

### getQualifyClause

    public TQualifyClause getQualifyClause()

  Returns:
    teradata qualify clause

### getTeradataWithClause

    public TTeradataWithClause getTeradataWithClause()

### getSampleClause

    public TSampleClause getSampleClause()

  SQL Server sample clause

  Returns:

### getForUpdateClause

    public TForUpdate getForUpdateClause()

### getComputeClause

    public TComputeClause getComputeClause()

### getGroupByClause

    public TGroupBy getGroupByClause()

  Returns:
    TGroupBy includes group by clause and having clause.

### getHierarchicalClause

    public THierarchical getHierarchicalClause()

  The hierarchical_query_clause lets you select rows in a hierarchical order.

  Returns:

### getLimitClause

    public TLimitClause getLimitClause()

  MySQL limit clause

  Returns:

### getExpandOnClause

    public TExpandOnClause getExpandOnClause()

  Returns:
    Teradata expand on clause

### getSetOperator

    public int getSetOperator()

  The set operators UNION, EXCEPT, and INTERSECT correspond to the relational operators union, difference, and intersection.

  Returns:
    set operator of this statement.If a set operator is not used, setOperator_none will be returned. otherwise, set operand can be fetched by using getLeftStmt() and getRightStmt().

### getLeftStmt

    public TSelectSqlStatement getLeftStmt()

  Valid when `getSetOperator()` is not setOperator_none.

  Returns:
    left side statement of set operator.

### getRightStmt

    public TSelectSqlStatement getRightStmt()

  Valid when `getSetOperator()` is not setOperator_none.

  Returns:
    right side statement of set operator.

### getOracleHint

    public java.lang.String getOracleHint()

### getValueClause

    public TValueClause getValueClause()

  DB2 value clause

  Returns:

### doParseStatement

    public int doParseStatement(TCustomSqlStatement psql)

  Overrides:
    `doParseStatement` in class `TCustomSqlStatement`

### isCombinedQuery

    public boolean isCombinedQuery()

  Returns:
    true if set operators is not setOperator_none.

### accept

    public void accept(TParseTreeVisitor v)

  Specified by:
    `accept` in interface `Visitable`
  Overrides:
    `accept` in class `TParseTreeNode`

### addOrderBy

    public TOrderBy addOrderBy(java.lang.String orderByStr)

### addWhereClause

    public TWhereClause addWhereClause(java.lang.String condition)

  Description copied from class: `TCustomSqlStatement`
  This method must be override in select/delete/update statement

  Overrides:
    `addWhereClause` in class `TCustomSqlStatement`
  Returns:

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD