# Abstract Syntax Tree crashes when use SELECT FOR UPDATE

**URL:** <https://community.sonarsource.com/t/abstract-syntax-tree-crashes-when-use-select-for-update/22489>\
**Category:** SonarQube Server / Community Build\
**Tags:** plsql, rules\
**Created:** [April 1, 2020, 7:47pm UTC](https://community.sonarsource.com/t/abstract-syntax-tree-crashes-when-use-select-for-update/22489 "2020-04-01T19:47:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Welton\_Leao\_Machado](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/welton_leao_machado/32/4167_2.png) [@Welton\_Leao\_Machado](https://community.sonarsource.com/u/Welton_Leao_Machado)\
**Post date:** [April 1, 2020, 7:47pm UTC](https://community.sonarsource.com/t/abstract-syntax-tree-crashes-when-use-select-for-update/22489/1 "2020-04-01T19:47:58Z")

</div>

I’m make the custom rules to PLSQL analysis and am using the sslr-plsql-toolkit-3.4.1.2576.jar to guide me to find violated rules in the code blocks.

So when i parse code with a simple SELECT the Abstract Syntax Tree is mapped correcly:

```auto
CREATE OR REPLACE PACKAGE BODY package_sample_sonar_rules AS
	PROCEDURE rule21_compliant
	IS
	VAR1 INTEGER := 10;
	CURSOR cursor1 IS
		SELECT 
			col1,
			col2
		FROM
			tab1
		WHERE col1 > VAR1;
	BEGIN
		OPEN cursor1;
		CLOSE cursor1;		
	END rule21_compliant;
END package_sample_sonar_rules;
/

```

 ![cp1](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/7/7248e73ba50eb2a35be8f1d450b8ccd017c09488.png)

But i need find the SELECT WITH FOR UPDATE on code Because my rules do not allow the use of FOR UPDATE. So when add FOR UPDATE on SELECT, the Abstract Syntax Tree crashes and the SELECT on the tree is not similar to SELECT without FOR UPDATE

```auto

CREATE OR REPLACE PACKAGE BODY package_sample_sonar_rules AS
	PROCEDURE rule21_compliant
	IS
	VAR1 INTEGER := 10;
	CURSOR cursor1 IS
		SELECT 
			col1,
			col2
		FROM
			tab1
		WHERE col1 > VAR1 FOR UPDATE;
	BEGIN
		OPEN cursor1;
		CLOSE cursor1;		
	END rule21_compliant;
END package_sample_sonar_rules;
/

```

 ![cp2](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/2X/3/34a94530c65e9c49e464b6fb5f83dbbc1bb621f4.png)

i dont know if in this forum can publish about tool sslr-plsql-toolkit-3.4.1.2576.jar because the problem is with that tool and not with sonar qube or scanner

---

<div class="post-metadata">

**Author:** ![felipebz](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/felipebz/32/32739_2.png) [@felipebz](https://community.sonarsource.com/u/felipebz)\
**Post date:** [April 2, 2020, 11:23am UTC](https://community.sonarsource.com/t/abstract-syntax-tree-crashes-when-use-select-for-update/22489/2 "2020-04-02T11:23:44Z")

</div>

The SonarPLSQL parser doesn’t support the “for update” clause. See [https://jira.sonarsource.com/browse/SONARPLSQL-201](https://jira.sonarsource.com/browse/SONARPLSQL-201)

The SonarSource folks need to fix it. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/system/32/31083_2.png) [@system](https://community.sonarsource.com/u/system)\
**Post date:** [May 7, 2020, 7:38am UTC](https://community.sonarsource.com/t/abstract-syntax-tree-crashes-when-use-select-for-update/22489/3 "2020-05-07T07:38:24Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
