fix for skipping sql starting with WITH
This commit is contained in:
@ -996,7 +996,8 @@ void Skip2NextTerminator(String initiator,String terminator) :
|
||||
t = getToken(1);
|
||||
if(t.image.equals(initiator)) count++;
|
||||
if(t.image.equals(terminator)) count--;
|
||||
if((null != t.specialToken && beginToken.kind != SELECT && beginToken.kind != INSERT && beginToken.kind != UPDATE && beginToken.kind != DELETE && beginToken.kind != MERGE && beginToken.kind != EXECUTE) || t.kind == EOF)
|
||||
if((null != t.specialToken && beginToken.kind != SELECT && beginToken.kind != INSERT && beginToken.kind != UPDATE && beginToken.kind != DELETE
|
||||
&& beginToken.kind != MERGE && beginToken.kind != EXECUTE && beginToken.kind != WITH) || t.kind == EOF)
|
||||
return;
|
||||
if (t.specialToken != null && "/".equals(t.image))
|
||||
return;
|
||||
|
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
|
||||
*/
|
||||
|
||||
package net.sourceforge.pmd.lang.plsql.ast;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import net.sourceforge.pmd.lang.plsql.AbstractPLSQLParserTst;
|
||||
|
||||
public class CursorWithWithTest extends AbstractPLSQLParserTst {
|
||||
|
||||
@Test
|
||||
public void parseCursorWithWith() throws Exception {
|
||||
String code = IOUtils.toString(this.getClass().getResourceAsStream("CursorWithWith.pls"),
|
||||
StandardCharsets.UTF_8);
|
||||
ASTInput input = parsePLSQL(code);
|
||||
Assert.assertNotNull(input);
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
create or replace procedure test is
|
||||
|
||||
cursor c_tariff_price is
|
||||
with risk_set as
|
||||
(select 2 from
|
||||
dual)
|
||||
select 1 from dual;
|
||||
|
||||
begin
|
||||
null;
|
||||
end;
|
||||
/
|
Reference in New Issue
Block a user