G-7810
🆓Warning
Never use SQL inside PL/SQL to read sequence numbers (or SYSDATE).
Reason
Since Oracle Database 11g it is no longer needed to use a select
statement to read a sequence (which would imply a context switch).
Example
Non-Compliant Example
declare l_sequence_number employees.employee_id%type; begin select employees_seq.nextval into l_sequence_number from dual; my_package.do_something(l_sequence_number); end; /
Issues
Line | Column | Message |
---|---|---|
4 | 25 |
★★★★★
Compliant Solution -
declare l_sequence_number employees.employee_id%type; begin l_sequence_number := employees_seq.nextval; my_package.do_something(l_sequence_number); end; /
References
- same as Trivadis G-7810