forked from phoedos/pmd
@ -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
|
* [#1633](https://github.com/pmd/pmd/issues/1633): \[java] UnsynchronizedStaticFormatter reports commons lang FastDateFormat
|
||||||
* java-performance
|
* java-performance
|
||||||
* [#1632](https://github.com/pmd/pmd/issues/1632): \[java] ConsecutiveLiteralAppends false positive over catch
|
* [#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
|
### API Changes
|
||||||
|
|
||||||
|
@ -1314,6 +1314,8 @@ void Condition2() #void :
|
|||||||
LOOKAHEAD(4) IsNullCondition()
|
LOOKAHEAD(4) IsNullCondition()
|
||||||
|
|
|
|
||||||
LOOKAHEAD(4) IsOfTypeCondition()
|
LOOKAHEAD(4) IsOfTypeCondition()
|
||||||
|
|
|
||||||
|
ExistsCondition()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1338,6 +1340,14 @@ ASTLikeCondition LikeCondition() :
|
|||||||
{ return jjtThis; }
|
{ return jjtThis; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ASTExistsCondition ExistsCondition() :
|
||||||
|
{}
|
||||||
|
{
|
||||||
|
<EXISTS> "(" Subquery() ")"
|
||||||
|
|
||||||
|
{ return jjtThis; }
|
||||||
|
}
|
||||||
|
|
||||||
ASTCompoundCondition CompoundCondition() :
|
ASTCompoundCondition CompoundCondition() :
|
||||||
{}
|
{}
|
||||||
{
|
{
|
||||||
@ -5848,7 +5858,7 @@ ASTID ID(): {}
|
|||||||
| <EXCEPTION> //SYNTAX
|
| <EXCEPTION> //SYNTAX
|
||||||
| <EXCLUSIVE> //SYNTAX //RESERVED WORD
|
| <EXCLUSIVE> //SYNTAX //RESERVED WORD
|
||||||
| <EXECUTE> //SYNTAX
|
| <EXECUTE> //SYNTAX
|
||||||
| <EXISTS> //SYNTAX //RESERVED WORD
|
//| <EXISTS> //SYNTAX //RESERVED WORD
|
||||||
//| <EXIT> //SYNTAX
|
//| <EXIT> //SYNTAX
|
||||||
//20120501 | <EXTENDS>
|
//20120501 | <EXTENDS>
|
||||||
| <FETCH> //SYNTAX
|
| <FETCH> //SYNTAX
|
||||||
|
@ -986,4 +986,9 @@ public class PLSQLParserVisitorAdapter implements PLSQLParserVisitor {
|
|||||||
public Object visit(ASTValuesClause node, Object data) {
|
public Object visit(ASTValuesClause node, Object data) {
|
||||||
return visit((PLSQLNode) node, 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);
|
return visit((PLSQLNode) node, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object visit(ASTExistsCondition node, Object data) {
|
||||||
|
return visit((PLSQLNode) node, data);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Treat all Executable Code
|
* Treat all Executable Code
|
||||||
*/
|
*/
|
||||||
|
@ -68,4 +68,11 @@ public class WhereClauseTest extends AbstractPLSQLParserTst {
|
|||||||
StandardCharsets.UTF_8);
|
StandardCharsets.UTF_8);
|
||||||
ASTInput input = parsePLSQL(code);
|
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