use of com.alibaba.druid.sql.ast.statement.SQLSelectStatement in project druid by alibaba.
the class OracleSampleClauseTest method test_1.
public void test_1() throws Exception {
String sql = "SELECT COUNT(*) * 10 FROM orders SAMPLE (10) SEED (1);";
String expected = "SELECT COUNT(*) * 10\n" + "FROM orders SAMPLE (10) SEED (1);\n";
OracleStatementParser parser = new OracleStatementParser(sql);
SQLSelectStatement stmt = (SQLSelectStatement) parser.parseStatementList().get(0);
String text = TestUtils.outputOracle(stmt);
Assert.assertEquals(expected, text);
System.out.println(text);
}
use of com.alibaba.druid.sql.ast.statement.SQLSelectStatement in project druid by alibaba.
the class OracleSampleClauseTest method test_0.
public void test_0() throws Exception {
String sql = "SELECT COUNT(*) * 10 FROM orders SAMPLE (10);";
String expected = "SELECT COUNT(*) * 10\n" + "FROM orders SAMPLE (10);\n";
OracleStatementParser parser = new OracleStatementParser(sql);
SQLSelectStatement stmt = (SQLSelectStatement) parser.parseStatementList().get(0);
String text = TestUtils.outputOracle(stmt);
Assert.assertEquals(expected, text);
System.out.println(text);
}
use of com.alibaba.druid.sql.ast.statement.SQLSelectStatement in project druid by alibaba.
the class OracleIntervalTest method test_interval_literal_3.
public void test_interval_literal_3() throws Exception {
String sql = "SELECT INTERVAL '6-11' YEAR TO MONTH FROM DUAL";
OracleStatementParser parser = new OracleStatementParser(sql);
SQLSelectStatement stmt = (SQLSelectStatement) parser.parseStatementList().get(0);
String text = TestUtils.outputOracle(stmt);
Assert.assertEquals("SELECT INTERVAL '6-11' YEAR TO MONTH\nFROM DUAL;\n", text);
System.out.println(text);
}
use of com.alibaba.druid.sql.ast.statement.SQLSelectStatement in project druid by alibaba.
the class OracleIntervalTest method test_interval_literal_5.
public void test_interval_literal_5() throws Exception {
String sql = "SELECT INTERVAL '30.12345' SECOND(2,4) FROM DUAL";
OracleStatementParser parser = new OracleStatementParser(sql);
SQLSelectStatement stmt = (SQLSelectStatement) parser.parseStatementList().get(0);
String text = TestUtils.outputOracle(stmt);
Assert.assertEquals("SELECT INTERVAL '30.12345' SECOND(2, 4)\nFROM DUAL;\n", text);
System.out.println(text);
}
use of com.alibaba.druid.sql.ast.statement.SQLSelectStatement in project druid by alibaba.
the class OracleIntervalTest method test_interval.
public void test_interval() throws Exception {
String sql = "SELECT (SYSTIMESTAMP - order_date) DAY(9) TO SECOND from orders WHERE order_id = 2458;";
OracleStatementParser parser = new OracleStatementParser(sql);
SQLSelectStatement stmt = (SQLSelectStatement) parser.parseStatementList().get(0);
String text = TestUtils.outputOracle(stmt);
Assert.assertEquals("SELECT (SYSTIMESTAMP - order_date) DAY(9) TO SECOND\n" + "FROM orders\n" + "WHERE order_id = 2458;\n", text);
System.out.println(text);
}
Aggregations