@ -37,6 +37,8 @@ This is a {{ site.pmd.release_type }} release.
|
||||
* [#1633](https://github.com/pmd/pmd/issues/1633): \[java] UnsynchronizedStaticFormatter reports commons lang FastDateFormat
|
||||
* java-performance
|
||||
* [#1632](https://github.com/pmd/pmd/issues/1632): \[java] ConsecutiveLiteralAppends false positive over catch
|
||||
* plsql
|
||||
* [#1587](https://github.com/pmd/pmd/issues/1587): \[plsql] Parse Exception with EXISTS
|
||||
|
||||
### API Changes
|
||||
|
||||
|
@ -1314,6 +1314,8 @@ void Condition2() #void :
|
||||
LOOKAHEAD(4) IsNullCondition()
|
||||
|
|
||||
LOOKAHEAD(4) IsOfTypeCondition()
|
||||
|
|
||||
ExistsCondition()
|
||||
)
|
||||
}
|
||||
|
||||
@ -1338,6 +1340,14 @@ ASTLikeCondition LikeCondition() :
|
||||
{ return jjtThis; }
|
||||
}
|
||||
|
||||
ASTExistsCondition ExistsCondition() :
|
||||
{}
|
||||
{
|
||||
<EXISTS> "(" Subquery() ")"
|
||||
|
||||
{ return jjtThis; }
|
||||
}
|
||||
|
||||
ASTCompoundCondition CompoundCondition() :
|
||||
{}
|
||||
{
|
||||
@ -5848,7 +5858,7 @@ ASTID ID(): {}
|
||||
| <EXCEPTION> //SYNTAX
|
||||
| <EXCLUSIVE> //SYNTAX //RESERVED WORD
|
||||
| <EXECUTE> //SYNTAX
|
||||
| <EXISTS> //SYNTAX //RESERVED WORD
|
||||
//| <EXISTS> //SYNTAX //RESERVED WORD
|
||||
//| <EXIT> //SYNTAX
|
||||
//20120501 | <EXTENDS>
|
||||
| <FETCH> //SYNTAX
|
||||
|
@ -986,4 +986,9 @@ public class PLSQLParserVisitorAdapter implements PLSQLParserVisitor {
|
||||
public Object visit(ASTValuesClause node, Object data) {
|
||||
return visit((PLSQLNode) node, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object visit(ASTExistsCondition node, Object data) {
|
||||
return visit((PLSQLNode) node, data);
|
||||
}
|
||||
}
|
||||
|
@ -1080,6 +1080,11 @@ public abstract class AbstractPLSQLRule extends AbstractRule implements PLSQLPar
|
||||
return visit((PLSQLNode) node, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object visit(ASTExistsCondition node, Object data) {
|
||||
return visit((PLSQLNode) node, data);
|
||||
}
|
||||
|
||||
/*
|
||||
* Treat all Executable Code
|
||||
*/
|
||||
|
@ -68,4 +68,11 @@ public class WhereClauseTest extends AbstractPLSQLParserTst {
|
||||
StandardCharsets.UTF_8);
|
||||
ASTInput input = parsePLSQL(code);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExistsCondition() throws Exception {
|
||||
String code = IOUtils.toString(this.getClass().getResourceAsStream("WhereClauseExists.pls"),
|
||||
StandardCharsets.UTF_8);
|
||||
ASTInput input = parsePLSQL(code);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
--
|
||||
-- Where Clause With Exists Condition
|
||||
-- https://docs.oracle.com/en/database/oracle/oracle-database/18/sqlrf/EXISTS-Condition.html#GUID-20259A83-C42B-4E0D-8DF4-9A2A66ACA8E7
|
||||
--
|
||||
|
||||
BEGIN
|
||||
|
||||
SELECT id
|
||||
INTO id_out
|
||||
FROM some_table
|
||||
WHERE EXISTS
|
||||
(SELECT NULL
|
||||
FROM other_table
|
||||
WHERE other_id = other_id_in);
|
||||
|
||||
DELETE FROM some_table
|
||||
WHERE id = id_in
|
||||
AND NOT EXISTS
|
||||
(SELECT NULL
|
||||
FROM other_table
|
||||
WHERE id = id_in);
|
||||
|
||||
END;
|
||||
/
|
Reference in New Issue
Block a user