Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sjjian/oracle-sql-parser
this is a yacc (goyacc) oracle sql parser.
https://github.com/sjjian/oracle-sql-parser
ast goyacc lexer oracle parse parser plsql sql statement stmt yacc
Last synced: about 2 months ago
JSON representation
this is a yacc (goyacc) oracle sql parser.
- Host: GitHub
- URL: https://github.com/sjjian/oracle-sql-parser
- Owner: sjjian
- License: apache-2.0
- Created: 2021-09-15T02:55:36.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-04-18T07:09:49.000Z (almost 3 years ago)
- Last Synced: 2024-10-15T09:52:45.120Z (3 months ago)
- Topics: ast, goyacc, lexer, oracle, parse, parser, plsql, sql, statement, stmt, yacc
- Language: Yacc
- Homepage:
- Size: 768 KB
- Stars: 17
- Watchers: 1
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Oracle SQL Parser
this is an oracle sql parser. ref: https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf## supported statement
|statement| sub statement |yacc|ast|
|----|----|----|----|
|Alter table|Add column| :heavy_check_mark:|:heavy_check_mark:|
|Alter table|Modify column| :heavy_check_mark:|:heavy_check_mark:|
|Alter table|Drop column| :heavy_check_mark:|:heavy_check_mark:|
|Alter table|Rename column| :heavy_check_mark:|:heavy_check_mark:|
|Alter table|Add constraint| :heavy_check_mark:| :heavy_check_mark:|
|Alter table|Modify constraint| :heavy_check_mark:| :heavy_check_mark:|
|Alter table|Rename constraint| :heavy_check_mark:| :heavy_check_mark:|
|Alter table|Drop constraint| :heavy_check_mark:| :heavy_check_mark:|
|Create table|Relational table|:heavy_check_mark:|:heavy_check_mark:|
|Create index|Relational table|:heavy_check_mark:| |
|Drop table|-|:heavy_check_mark:|:heavy_check_mark:|
|Drop index|-|:heavy_check_mark:|:heavy_check_mark:|## usage
```go
package mainimport (
"fmt"
"github.com/sjjian/oracle-sql-parser"
"github.com/sjjian/oracle-sql-parser/ast"
)func main() {
stmts, err := parser.Parser("alter table db1.t1 add (id number, name varchar2(255))")
if err != nil {
fmt.Println(err)
return
}
stmt := stmts[0]
switch s := stmt.(type) {
case *ast.AlterTableStmt:
fmt.Println(s.TableName.Table.Value) // t1
}
}
```