diff --git a/parser/sql/dialect/oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/statement/OracleStatementVisitor.java b/parser/sql/dialect/oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/statement/OracleStatementVisitor.java index ca737d7d20cf2..5480eb38c10df 100644 --- a/parser/sql/dialect/oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/statement/OracleStatementVisitor.java +++ b/parser/sql/dialect/oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/statement/OracleStatementVisitor.java @@ -1000,7 +1000,11 @@ public ASTNode visitCursorFunction(final CursorFunctionContext ctx) { @Override public ASTNode visitToDateFunction(final ToDateFunctionContext ctx) { - return new FunctionSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), ctx.TO_DATE().getText(), getOriginalText(ctx)); + FunctionSegment result = new FunctionSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), ctx.TO_DATE().getText(), getOriginalText(ctx)); + if (null != ctx.STRING_()) { + ctx.STRING_().forEach(each -> result.getParameters().add(new LiteralExpressionSegment(each.getSymbol().getStartIndex(), each.getSymbol().getStopIndex(), each.getSymbol().getText()))); + } + return result; } @Override diff --git a/test/it/parser/src/main/resources/case/dml/insert.xml b/test/it/parser/src/main/resources/case/dml/insert.xml index 224f5948cfd7b..18336e0d69017 100644 --- a/test/it/parser/src/main/resources/case/dml/insert.xml +++ b/test/it/parser/src/main/resources/case/dml/insert.xml @@ -2575,41 +2575,77 @@ - + + + + + + + + TO_DATE('2009', 'YYYY') + - + + + + + + + + TO_DATE('2009', 'YYYY') + - + - + + + + + + + + TO_DATE('2009', 'YYYY') + - - - + + + + + + + + TO_DATE('2009', 'YYYY') + - - year - to - MONTH - - + - + + + + + + + + TO_DATE('2009', 'YYYY') + - - - + + + + + + + + TO_DATE('2009', 'YYYY') + - - DAY - TO - SECOND - diff --git a/test/it/parser/src/main/resources/case/dml/select.xml b/test/it/parser/src/main/resources/case/dml/select.xml index 38059feba3ec8..9dd07a52faf19 100644 --- a/test/it/parser/src/main/resources/case/dml/select.xml +++ b/test/it/parser/src/main/resources/case/dml/select.xml @@ -6839,7 +6839,21 @@ TO_DATE('Febuary 15, 2016, 11:00 A.M.' DEFAULT 'January 01, 2016 12:00 A.M.' ON CONVERSION ERROR, 'Month dd, YYYY, HH:MI A.M.') - + + + + + + + + + + TO_DATE('Febuary 15, 2016, 11:00 A.M.' DEFAULT 'January 01, 2016 12:00 A.M.' ON CONVERSION ERROR, 'Month dd, YYYY, HH:MI A.M.') @@ -6851,7 +6865,7 @@