PLSQL error summary


1. Is null is true, and is and null are the same thing.

Neuropathy writing: no matter VC_ Whether itemids is null or ”, and the sentence after or is false. Only is null or is not null can be used to judge null. The following VC_ Itemids only need the blank in front of it.








2. Inefficient subqueries

Neuropathy writing method: the sub query does not use the column of the external query, but the external query does not query a piece of data, it will execute a sub query, but the data of the sub query is the same, it should be written as temporary data.

Improved writing:

  my_date varchar2(20);
  select t1.real_date
    into my_date
    from (select '20200520' real_date from dual) t1;
  --Use the variable values above to place them in the where condition 
    FROM table_a A, table_b b
   WHERE A.item1 IN ('1', '2', '5')
     and a.item2 = b.item3(+)
     and a.item6 >= my_date
     and a.item5 is null;