1. insert into t1 values (...)
Should be: insert into t1 (...) values (...)
2. to_char (sysdate, 'yyyymmddhhmms ')
Changed:
To_char (sysdate, 'yyyymmddhh24mis ')
3. select count (*) into v_count from t1 where c1 = ?;
No_data_found error will never be triggered. v_count = 0
4. Return Value Problems
Reasonable solution:
Result: = false at the beginning of the process;
Result: = true at the end of the process;
You do not need to assign values to the result.
Unreasonable solution:
Result: = true at the beginning of the process;
Result: = false is required when the judgment of each part of the intermediate code is incorrect.
You do not need to assign a value to the result at the end of the process.
5. select c1, c2 in from t1 where c3 = v_c3;
If v_c1 = 0 or v_c2 = 0 then
If no value is found, an error is returned. No value is returned.
Use when no_data_found to determine
6. '... where c1 = '| v_c1; the c1 field is of the dense type and must be enclosed in single quotation marks. Otherwise, the c1 index cannot be used, and oracle is converted '... where c1 = '| chr (39) | to_char (v_c1) | chr (39 );
Change to: where c1 = '| chr (39) | v_c1 | chr (39 );
7. If only data exists, add and rownum <2 faster
Select count (*)
Into v_count
From t1
Where c1 = v_c1;
Addition condition: and rownum <2
7. where exists (SELECT *
FROM t1
Should be:
Where exists (SELECT 'x'
FROM t1
8. RAISE_APPLICATION_ERROR (-20000, infoMsg); do not use the 20000 error code.
The available error number of RAISE_APPLICATION_ERROR ranges from-20000 to-20999.