use of com.alibaba.druid.sql.ast.statement.SQLSelectStatement in project druid by alibaba.
the class OracleAnyTest method test_any.
public void test_any() throws Exception {
String sql = "SELECT country, prod, year, s FROM sales_view " + "MODEL PARTITION BY (country) " + "DIMENSION BY (prod, year) MEASURES (sale s) " + "IGNORE NAV " + "UNIQUE DIMENSION RULES UPSERT SEQUENTIAL ORDER (s[ANY, 2000] = 0) " + "ORDER BY country, prod, year;";
String expect = "SELECT country, prod, year, s\n" + "FROM sales_view\n" + "MODEL\n" + "\tPARTITION BY (country)\n" + "\tDIMENSION BY (prod, year)\n" + "\tMEASURES (sale s)\n" + "\tIGNORE NAV\n" + "\tUNIQUE DIMENSION\n" + "\tRULES UPSERT SEQUENTIAL ORDER (s[ANY, 2000] = 0)\n" + "ORDER BY country, prod, year;\n";
OracleStatementParser parser = new OracleStatementParser(sql);
SQLSelectStatement stmt = (SQLSelectStatement) parser.parseStatementList().get(0);
String text = TestUtils.outputOracle(stmt);
Assert.assertEquals(expect, text);
System.out.println(text);
}
use of com.alibaba.druid.sql.ast.statement.SQLSelectStatement in project druid by alibaba.
the class OraclePriorTest method test_oracle.
public void test_oracle() throws Exception {
String sql = "SELECT employee_id, last_name, manager_id FROM employees CONNECT BY PRIOR employee_id = manager_id;";
String expect = "SELECT employee_id, last_name, manager_id\n" + "FROM employees\n" + "CONNECT BY PRIOR employee_id = manager_id;\n";
OracleStatementParser parser = new OracleStatementParser(sql);
SQLSelectStatement stmt = (SQLSelectStatement) parser.parseStatementList().get(0);
String text = TestUtils.outputOracle(stmt);
Assert.assertEquals(expect, text);
System.out.println(text);
}
use of com.alibaba.druid.sql.ast.statement.SQLSelectStatement in project druid by alibaba.
the class OracleEXTRACTTest2 method test_Extract.
public void test_Extract() throws Exception {
String sql = "SELECT warehouse_name, EXTRACT(warehouse_spec, '/Warehouse/Docks')\n" + " \"Number of Docks\"\n" + " FROM warehouses\n" + " WHERE warehouse_spec IS NOT NULL;";
String expect = "SELECT warehouse_name, EXTRACT(warehouse_spec, '/Warehouse/Docks') AS \"Number of Docks\"\n" + "FROM warehouses\n" + "WHERE warehouse_spec IS NOT NULL;\n" + "";
OracleStatementParser parser = new OracleStatementParser(sql);
SQLSelectStatement stmt = (SQLSelectStatement) parser.parseStatementList().get(0);
String text = TestUtils.outputOracle(stmt);
assertEquals(expect, text);
}
use of com.alibaba.druid.sql.ast.statement.SQLSelectStatement in project druid by alibaba.
the class OracleFlashbackQueryTest method test_isEmpty.
public void test_isEmpty() throws Exception {
String sql = "SELECT salary FROM employees AS OF TIMESTAMP (SYSTIMESTAMP - INTERVAL '1' DAY) WHERE last_name = 'Chung';";
String expect = "SELECT salary\n" + "FROM employees\n" + "AS OF TIMESTAMP (SYSTIMESTAMP - INTERVAL '1' DAY)\n" + "WHERE last_name = 'Chung';\n";
OracleStatementParser parser = new OracleStatementParser(sql);
SQLSelectStatement stmt = (SQLSelectStatement) parser.parseStatementList().get(0);
String text = TestUtils.outputOracle(stmt);
Assert.assertEquals(expect, text);
System.out.println(text);
}
use of com.alibaba.druid.sql.ast.statement.SQLSelectStatement in project druid by alibaba.
the class OracleNumberLiteralTest method test_number_literal_2.
public void test_number_literal_2() throws Exception {
String sql = "SELECT BINARY_FLOAT_INFINITY FROM DUAL";
OracleStatementParser parser = new OracleStatementParser(sql);
SQLSelectStatement stmt = (SQLSelectStatement) parser.parseStatementList().get(0);
String text = TestUtils.outputOracle(stmt);
Assert.assertEquals("SELECT BINARY_FLOAT_INFINITY\nFROM DUAL;\n", text);
System.out.println(text);
}
Aggregations