Skip to content

Commit

Permalink
add createProcedure rule for oracle apache#4
Browse files Browse the repository at this point in the history
  • Loading branch information
tianhao960 committed Aug 21, 2022
1 parent b0dcd5d commit 719db3a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,10 @@ VARCHAR2
: V A R C H A R [2]
;

STRING
: S T R I N G
;

NVARCHAR2
: N V A R C H A R [2]
;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,30 @@ createProcedure
;

plsqlProcedureSource
: (schemaName DOT)? procedureName ( LP_ parameterDeclaration ( COMMA_ parameterDeclaration )* RP_)? sharingClause?
: (schemaName DOT_)? procedureName ( LP_ parameterDeclaration ( COMMA_ parameterDeclaration )* RP_)? sharingClause?
((defaultCollationClause | invokerRightsClause | accessibleByClause)*)? (IS | AS) (callSpec | declareSection? body) SEMI_
;

body
: BEGIN statement+ (EXCEPTION (exceptionHandler)+)? END (identifier)? SEMI_
;

//need add more statement type according to the doc
statement
: ( SIGNED_LEFT_SHIFT_ label SIGNED_RIGHT_SHIFT_ ( SIGNED_LEFT_SHIFT_ label SIGNED_RIGHT_SHIFT_ ) *)?
( select
| update
| delete
| insert
| lockTable
| merge
)
;

exceptionHandler
: WHEN ( (typeName (OR typeName)* )| OTHERS ) THEN statement+
;

declareSection
: itemList1 itemList2?
| itemList2
Expand Down Expand Up @@ -79,7 +99,7 @@ collectionVariableDecl
(
typeName ( COLON_ EQ_ ( qualifiedExpression | functionCall | variableName ) )?
| typeName ( COLON_ EQ_ ( collectionConstructor | variableName ) )?
| typeName COMA_ TYPE
| typeName MOD_ TYPE
)
SEMI_
;
Expand Down Expand Up @@ -141,7 +161,7 @@ typeDefinition
;

recordTypeDefinition
: TYPE typeName IS RECORD LP_ fieldDefinition ( COMMA_ fieldDefinition )* RP_ SEMI
: TYPE typeName IS RECORD LP_ fieldDefinition ( COMMA_ fieldDefinition )* RP_ SEMI_
;

fieldDefinition
Expand All @@ -160,11 +180,11 @@ subtypeDefinition
;

constraint
: (INTEGER_ COMMA_ INTEGER_) | (RANGE NEMBER_ DOT_ DOT_ NEMBER_)
: (INTEGER_ COMMA_ INTEGER_) | (RANGE NUMBER_ DOT_ DOT_ NUMBER_)
;

collectionTypeDefinition
: TYPE typeName IS ( assocArrayTypeDef | varrayTypeDef | nestedTableTypeDef ) SEMI
: TYPE typeName IS ( assocArrayTypeDef | varrayTypeDef | nestedTableTypeDef ) SEMI_
;

varrayTypeDef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,6 @@ execute
| alterHierarchy
| alterLockdownProfile
| alterPluggableDatabase
| createProcedure
) SEMI_?
;

0 comments on commit 719db3a

Please # to comment.