dotConnect for Oracle Documentation
Devart.Common Namespace / SelectStatement Class
Members Example

In This Topic
    SelectStatement Class
    In This Topic
    Composes, modifies and parses SELECT statements.
    Syntax
    'Declaration
     
    Public Class SelectStatement 
    public class SelectStatement 
    Remarks

    The SelectStatement class is designed for easy manipulation of SQL SELECT statements. It allows you to perform the following tasks:

    • Construct SELECT statements in run time;
    • Modify the statements with object-oriented interface;
    • Parse the statements from strings.
    The SelectStatement class exposes SELECT, ORDER BY and GROUP BY clauses as collections of SelectColumn objects (SelectColumnCollection), and FROM clause as collection of SelectTable objects (SelectTableCollection). The WHERE and HAVING clauses are represented as string expressions.

    To obtain the statement text use the ToString method.

    Instances of this class cannot be created directly. To use its functionality, one needs to create an object of a descendant class, like OracleSelectStatement.

    Example

    This example illustrates how to construct in run time a SelectStatement object the represents the following query:

    SELECT Test.td.dname AS Department,td.loc AS Location,te.ename AS Name 
    FROM Test.dept AS td,emp AS te 
    GROUP BY te.empno
    ORDER BY te.ename
    
    SelectStatement stmt = (SelectStatement) new OracleSelectStatement();      
    
    stmt.Columns.Add(new SelectColumn("test", "td", "dname", "Department"));
    stmt.Columns.Add(new SelectColumn("", "td", "loc", "Location"));
    stmt.Columns.Add(new SelectColumn("", "te", "ename", "Name"));
    
    stmt.Tables.Add(new SelectTable("test", "dept", "td"));
    stmt.Tables.Add(new SelectTable("", "emp", "te"));
    
    stmt.GroupBy.Add(new SelectColumn("", "te", "empno", ""));
    
    stmt.OrderBy.Add(new SelectColumn("", "te", "ename", ""));
    Dim stmt As SelectStatement = New OracleSelectStatement()
    
    stmt.Columns.Add(New SelectColumn("test", "td", "dname", "Department"))
    stmt.Columns.Add(New SelectColumn("", "td", "loc", "Location"))
    stmt.Columns.Add(New SelectColumn("", "te", "ename", "Name"))
    
    stmt.Tables.Add(New SelectTable("test", "dept", "td"))
    stmt.Tables.Add(New SelectTable("", "emp", "te"))
    
    stmt.GroupBy.Add(New SelectColumn("", "te", "empno", ""))
    
    stmt.OrderBy.Add(New SelectColumn("", "te", "ename", ""))
    Inheritance Hierarchy

    System.Object
       Devart.Common.SelectStatement
          Devart.Data.Oracle.OracleSelectStatement

    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also