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
213 stars 78 forks source link

False positive with FORALL in InsertWithoutColumnsCheck #114

Closed felipebz closed 5 years ago

felipebz commented 5 years ago

The code below is triggering InsertWithoutColumnsCheck:

declare
   type t_tab is table of tab%rowtype index by binary_integer;
   v_tab t_tab;
begin
  forall idx in v_tab.first .. v_tab.last
  insert into tab values v_tab(idx); 
end;

It happens because these "TABLE types" are currently ignored by the type solver. Therefore, it doesn't know that v_tab is a TABLE nor that v_tab(idx) returns a rowtype. Ultimately this will be fixed in #108.

For now, we should ignore INSERTs inside a FORALL statement.