diff --git a/parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/BaseRule.g4 b/parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/BaseRule.g4
index 327a850c566ef..385a3b837dec4 100644
--- a/parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/BaseRule.g4
+++ b/parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/BaseRule.g4
@@ -775,7 +775,11 @@ leadLagInfo
specialFunction
: castFunction | charFunction | extractFunction | formatFunction | firstOrLastValueFunction | trimFunction | featureFunction
- | setFunction | translateFunction | cursorFunction | toDateFunction
+ | setFunction | translateFunction | cursorFunction | toDateFunction | approxRank
+ ;
+
+approxRank
+ : APPROX_RANK LP_ queryPartitionClause? orderByClause RP_
;
toDateFunction
diff --git a/parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/OracleKeyword.g4 b/parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/OracleKeyword.g4
index f9d6f4ca486f8..8297e15532967 100644
--- a/parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/OracleKeyword.g4
+++ b/parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/OracleKeyword.g4
@@ -1751,6 +1751,10 @@ APPLY
: A P P L Y
;
+APPROX_RANK
+ : A P P R O X UL_ R A N K
+ ;
+
MAXIMIZE
: M A X I M I Z E
;
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 c17be79e6cf2d..21715d6181eed 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
@@ -27,6 +27,7 @@
import org.apache.shardingsphere.sql.parser.autogen.OracleStatementBaseVisitor;
import org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.AggregationFunctionContext;
import org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.AnalyticFunctionContext;
+import org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.ApproxRankContext;
import org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.BitExprContext;
import org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.BitValueLiteralsContext;
import org.apache.shardingsphere.sql.parser.autogen.OracleStatementParser.BooleanLiteralsContext;
@@ -976,8 +977,17 @@ public final ASTNode visitSpecialFunction(final SpecialFunctionContext ctx) {
if (null != ctx.toDateFunction()) {
return visit(ctx.toDateFunction());
}
+ if (null != ctx.approxRank()) {
+ return visit(ctx.approxRank());
+ }
throw new IllegalStateException(
- "SpecialFunctionContext must have castFunction, charFunction, extractFunction, formatFunction, firstOrLastValueFunction, trimFunction, toDateFunction or featureFunction.");
+ "SpecialFunctionContext must have castFunction, charFunction, extractFunction, formatFunction, firstOrLastValueFunction, trimFunction, toDateFunction, approxCount"
+ + " or featureFunction.");
+ }
+
+ @Override
+ public ASTNode visitApproxRank(final ApproxRankContext ctx) {
+ return new FunctionSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), ctx.APPROX_RANK().getText(), getOriginalText(ctx));
}
@Override
diff --git a/test/it/parser/src/main/resources/case/dml/select-aggregate.xml b/test/it/parser/src/main/resources/case/dml/select-aggregate.xml
index 2a861341fd3e9..bd6a047454284 100644
--- a/test/it/parser/src/main/resources/case/dml/select-aggregate.xml
+++ b/test/it/parser/src/main/resources/case/dml/select-aggregate.xml
@@ -461,4 +461,33 @@
+
diff --git a/test/it/parser/src/main/resources/sql/supported/dml/select-aggregate.xml b/test/it/parser/src/main/resources/sql/supported/dml/select-aggregate.xml
index 5abe97537d5a0..829b875778654 100644
--- a/test/it/parser/src/main/resources/sql/supported/dml/select-aggregate.xml
+++ b/test/it/parser/src/main/resources/sql/supported/dml/select-aggregate.xml
@@ -33,4 +33,7 @@
+