ThanoshanMV commented on a change in pull request #10253:
URL: https://github.com/apache/shardingsphere/pull/10253#discussion_r630288626



##########
File path: 
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-oracle/src/main/antlr4/imports/oracle/DDLStatement.g4
##########
@@ -1421,3 +1421,258 @@ leadCdbUriClause
 propertyClause
     : PROPERTY (SET | REMOVE) DEFAULT_CREDENTIAL EQ_ qualifiedCredentialName
     ;
+
+alterSystem
+    : ALTER SYSTEM alterSystemOption
+    ;
+
+alterSystemOption
+    : archiveLogClause
+    | checkpointClause
+    | checkDatafilesClause
+    | distributedRecovClauses
+    | flushClause
+    | endSessionClauses
+    | switchLogfileClause
+    | suspendResumeClause
+    | quiesceClauses
+    | rollingMigrationClauses
+    | rollingPatchClauses
+    | alterSystemSecuriyClauses
+    | affinityClauses
+    | shutdownDispatcherClause
+    | registerClause
+    | setClause
+    | resetClause
+    | relocateClientClause
+    | cancelSqlClause
+    | flushPasswordfileMetadataCacheClause
+    ;
+
+archiveLogClause
+    : ARCHIVE LOG instanceClause? (sequenceClause | changeClause | 
currentClause | groupClause | logfileClause | nextClause | allClause) 
toLocationClause?
+    ;
+
+checkpointClause
+    : CHECKPOINT (GLOBAL | LOCAL)?
+    ;
+
+checkDatafilesClause
+    : CHECK DATAFILES (GLOBAL | LOCAL)?
+    ;
+
+distributedRecovClauses
+    : (ENABLE | DISABLE) DISTRIBUTED RECOVERY
+    ;
+
+flushClause
+    : FLUSH flushClauseOption
+    ;
+
+endSessionClauses
+    : (disconnectSessionClause | killSessionClause) (IMMEDIATE | NOREPLY)?
+    ;
+
+switchLogfileClause
+    : SWITCH LOGFILE
+    ;
+
+suspendResumeClause
+    : SUSPEND | RESUME
+    ;
+
+quiesceClauses
+    : QUIESCE RESTRICTED | UNQUIESCE
+    ;
+
+rollingMigrationClauses
+    : startRollingMigrationClause | stopRollingMigrationClause
+    ;
+
+rollingPatchClauses
+    : startRollingPatchClause | stopRollingPatchClause
+    ;
+
+alterSystemSecuriyClauses
+    : restrictedSessionClause | setEncryptionWalletOpenClause | 
setEncryptionWalletCloseClause | setEncryptionKeyClause
+    ;
+
+affinityClauses
+    : enableAffinityClause | disableAffinityClause
+    ;
+
+shutdownDispatcherClause
+    : SHUTDOWN IMMEDIATE? dispatcherName
+    ;
+
+registerClause
+    : REGISTER
+    ;
+
+setClause
+    : SET alterSystemSetClause+
+    ;
+
+resetClause
+    : RESET alterSystemResetClause+
+    ;
+
+relocateClientClause
+    : RELOCATE CLIENT clientId
+    ;
+
+cancelSqlClause
+    : CANCEL SQL SQ_ sessionId serialNumber instanceId? sqlId? SQ_
+    ;
+
+flushPasswordfileMetadataCacheClause
+    : FLUSH PASSWORDFILE_METADATA_CACHE
+    ;
+
+instanceClause
+    : INSTANCE instanceName
+    ;
+
+sequenceClause
+    : SEQUENCE numberLiterals

Review comment:
       @wgy8283335 please correct me if I'm wrong.
   
   1. `INTEGER_` can only hold whole numbers without decimals. `NUMBER_` can 
hold whole as well as decimal numbers. `numberLiterals` can have `INTEGER_` and 
`NUMBER_`.
   
   2. Since we put `INTEGER_` before `NUMBER_`, even if we expect `NUMBER_` the 
parsing tree matches with `INTEGER_` for whole numbers. But for decimal 
numbers, it matches `NUMBER_` correctly.
   
   3. As mentioned in the [literals 
](https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/Literals.html#GUID-1824CBAA-6E16-4921-B2A6-112FB02248DA)
 documentation, we should use `INTEGER_` notation whenever integer appears and 
should use `NUMBER_` notation whenever number or n appears. 
   
   4. But as previously mentioned in the 2nd point, if we expect `NUMBER_` and 
specify the whole number in SQL, the parsing tree will match `INTEGER_`. In 
this case, ANTLR will give us an error.
   
   5. In some cases, there won't be parameters appear with integer, number and 
n. At those places, if we're sure about whether it'll contain whole or decimal, 
we can explicitly specify `INTEGER_` or  `NUMBER_`. Otherwise, we can simply 
put `numberLiterals` as it'll match both of them in any cases. 
   
   6. I think, to resolve the issue mentioned in point 4:
       I. If we're sure if that number can have both whole and decimal numbers, 
we can put it as `numberLiterals`. In this way, if it's a whole number, the 
parsing tree will match `INTEGER_` and if it's a decimal number, it'll match 
`NUMBER_`.
      II. If we're sure if that number will only contain whole number only then 
we can specify it as `INTEGER`.
   
   I'm sorry if it's a silly thing. Please tell me what do you think to resolve 
this issue. I pushed my code. Please check it.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to