Skip to Main Content

SQLcl

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

sqlcl codescan - rule G-1050 should not apply to check constraints.

Robbie DatabeeSep 3 2024

the codescan rule G-1050 should not apply to check constraints.

create table t (
    c char(1) default on null 'Y' not null,
    constraint t_c_chk check (c in ('Y', 'N'))
);

results in

Warning (3,37): G-1050: Avoid using literals in your code

Check constraints only accept literals, sql-functions (not PL/SQL) and references to columns in same row.
see section "Restrictions on Check Constraints".

In the example above one can't avoid the literals in the check constraint.

I already opened an issue with plsql-and-sql-coding-guidelines.
We are still arguing about changing the rule but already agreed on that this should be fixed in SQLcl's implementation.

Comments
Post Details
Added on Sep 3 2024
0 comments
28 views