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);
}
use of com.alibaba.druid.sql.ast.statement.SQLSelectStatement in project druid by alibaba.
the class OracleIntervalTest method test_interval_literal_2.
public void test_interval_literal_2() throws Exception {
String sql = "SELECT INTERVAL '5-3' YEAR TO MONTH + INTERVAL'20' MONTH FROM DUAL";
OracleStatementParser parser = new OracleStatementParser(sql);
SQLSelectStatement stmt = (SQLSelectStatement) parser.parseStatementList().get(0);
String text = TestUtils.outputOracle(stmt);
Assert.assertEquals("SELECT INTERVAL '5-3' YEAR TO MONTH + INTERVAL '20' 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 OracleIsASetTest method test_is_a_set.
public void test_is_a_set() throws Exception {
String sql = "SELECT customer_id, cust_address_ntab FROM customers_demo WHERE cust_address_ntab IS A SET;";
OracleStatementParser parser = new OracleStatementParser(sql);
SQLSelectStatement stmt = (SQLSelectStatement) parser.parseStatementList().get(0);
String text = TestUtils.outputOracle(stmt);
Assert.assertEquals("SELECT customer_id, cust_address_ntab\n" + "FROM customers_demo\n" + "WHERE cust_address_ntab IS A SET;\n", text);
System.out.println(text);
}
use of com.alibaba.druid.sql.ast.statement.SQLSelectStatement in project druid by alibaba.
the class OracleIsEmptyTest method test_isEmpty.
public void test_isEmpty() throws Exception {
String sql = "SELECT product_id, TO_CHAR(ad_finaltext) FROM print_media WHERE ad_textdocs_ntab IS NOT EMPTY;";
String expect = "SELECT product_id, TO_CHAR(ad_finaltext)\n" + "FROM print_media\n" + "WHERE ad_textdocs_ntab IS NOT EMPTY;\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);
}
Aggregations