PLSQL error summary

Time:2021-1-18

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.

 

analysis:

 

 

 

 

 

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:

declare
  my_date varchar2(20);
begin
  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 
  SELECT *
    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;
end;

 

Recommended Today

[rust] basic data type

This article introduces the built-in data types provided by rust. Boolean type Boolean typeLogical values representing yes and No. It has two values:trueandfalseGenerally used in logical expressions, and, or, and not operations can be performed: fn main() { let x = true; let y: bool = ! x; // False, inverse operation let z = […]