-
Notifications
You must be signed in to change notification settings - Fork 8.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Parse Oracle open cursor statement SQL error when parameters con…
…tain method expr
- Loading branch information
Showing
4 changed files
with
34 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
core/src/test/java/com/alibaba/druid/sql/parser/OracleCursorOpenTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.alibaba.druid.sql.parser; | ||
|
||
import com.alibaba.druid.DbType; | ||
import com.alibaba.druid.sql.SQLUtils; | ||
import com.alibaba.druid.sql.ast.SQLStatement; | ||
import junit.framework.TestCase; | ||
import org.junit.Assert; | ||
|
||
import java.util.List; | ||
|
||
public class OracleCursorOpenTest extends TestCase { | ||
public void test_open_cursor_with_method() { | ||
String sql = "create or replace procedure proc_test1 (myArray in self_define_array) is \n" + | ||
"\n" + | ||
"CURSOR c_test (p1 varchar2) is\n" + | ||
"select\n" + | ||
" *\n" + | ||
"from\n" + | ||
" test1\n" + | ||
"where\n" + | ||
" id = p1;\n" + | ||
"\n" + | ||
"BEGIN OPEN c_test (myArray (1));\n" + | ||
"\n" + | ||
"END proc_test1;"; | ||
List<SQLStatement> sqlStatements = SQLUtils.parseStatements(sql, DbType.oracle); | ||
System.out.println(sqlStatements); | ||
Assert.assertFalse(sqlStatements.isEmpty()); | ||
} | ||
} |