mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for oracle sql parser
This commit is contained in:
@@ -13,14 +13,16 @@ import com.alibaba.druid.stat.TableStat;
|
||||
public class OracleBlockTest4 extends OracleTest {
|
||||
|
||||
public void test_0() throws Exception {
|
||||
String sql = "declare "
|
||||
+ " cursor cspid(vspid dba_hist_snapshot.snap_id%type) is "
|
||||
+ " select end_interval_time , startup_time " //
|
||||
+ " from dba_hist_snapshot "
|
||||
+ //
|
||||
" where snap_id = vspid and instance_number = :inst_num"
|
||||
+ " and dbid = :dbid; "
|
||||
+ " bsnapt dba_hist_snapshot.end_interval_time%type; bstart dba_hist_snapshot.startup_time%type; esnapt dba_hist_snapshot.end_interval_time%type; estart dba_hist_snapshot.startup_time%type; begin -- Check Begin Snapshot id is valid, get corresponding instance startup time open cspid(:bid); fetch cspid into bsnapt, bstart; if cspid%notfound then raise_application_error(-20200, 'Begin Snapshot Id '||:bid||' does not exist for this database/instance'); end if; close cspid; -- Check End Snapshot id is valid and get corresponding instance startup time open cspid(:eid); fetch cspid into esnapt, estart; if cspid%notfound then raise_application_error(-20200, 'End Snapshot Id '||:eid||' does not exist for this database/instance'); end if; if esnapt <= bsnapt then raise_application_error(-20200, 'End Snapshot Id '||:eid||' must be greater than Begin Snapshot Id '||:bid); end if; close cspid; -- Check startup time is same for begin and end snapshot ids if ( bstart != estart) then raise_application_error(-20200, 'The instance was shutdown between snapshots '||:bid||' and '||:eid); end if; end;";
|
||||
String sql = "DECLARE" + //
|
||||
" done BOOLEAN;" + //
|
||||
"BEGIN" + //
|
||||
" FOR i IN 1..50 LOOP" + //
|
||||
" IF done THEN" + //
|
||||
" GOTO end_loop;" + //
|
||||
" END IF;" + //
|
||||
" <<end_loop>>" + //
|
||||
" END LOOP;" + //
|
||||
"END;";
|
||||
|
||||
OracleStatementParser parser = new OracleStatementParser(sql);
|
||||
List<SQLStatement> statementList = parser.parseStatementList();
|
||||
|
||||
Reference in New Issue
Block a user