felipebz / zpa

Parser and static code analysis tool for PL/SQL and Oracle SQL.
https://zpa.felipebz.com
GNU Lesser General Public License v3.0
211 stars 77 forks source link

Get the IDENTIFIER_NAME #145

Closed tplazaro closed 2 years ago

tplazaro commented 3 years ago

Hi, this might be a dumb question (sorry in advance - new to java). So let's say we have this create procedure line:

CREATE PROCEDURE SCHEMA.PROC_NAME ...

I am trying to parse the UNIT_NAME token but it only includes SCHEMA. How do I get the PROC_NAME string in this case?

felipebz commented 3 years ago

Hi.

To get then "proc_name" you'll need to check the children of the UNIT_NAME node:

image

If variable called 'node' with a UNIT_NAME you can use node.getLastChild() to get the procedure name.