G-7127
🆓Warning
Always use the FORCE option when creating views.
Reason
The FORCE option ensures that the object definition is stored in the data dictionary, even if semantic validation fails. Without FORCE, object creation is aborted and the definition is lost. This reduces the visibility of invalid objects and complicates dependency analysis, troubleshooting, and deployment validation.
Specify the NO FORCE option if you want the statement to fail when it contains semantic errors.
However, object definitions containing syntax errors are not stored in the data dictionary, even when the FORCE option is specified.
This rule applies to the following SQL statements:
create json relational duality viewcreate view
Examples
Non-Compliant Example
create or replace view dept_sal_v as
select d.deptno, d.dname, sum(e.sal + nvl(e.comm, 0)) as sal
from dept d
left join emps e
on e.deptno = d.deptno
group by d.deptno, d.dname; | Line | Column | Message |
|---|---|---|
| 1 | 1 |
ERROR at line 4:
ORA-00942: table or view "SCOTT"."EMPS" does not exist
Help: https://docs.oracle.com/error-help/db/ora-00942/ Compliant Solution - ★★★★☆
create or replace force view dept_sal_v as
select d.deptno, d.dname, sum(e.sal + nvl(e.comm, 0)) as sal
from dept d
left join emps e
on e.deptno = d.deptno
group by d.deptno, d.dname; Warning: View created with compilation errors. Compliant Solution - ★★★★★
create or replace force view dept_sal_v as
select d.deptno, d.dname, sum(e.sal + nvl(e.comm, 0)) as sal
from dept d
left join emp e
on e.deptno = d.deptno
group by d.deptno, d.dname; View created.Parameters
Use parameters to customize the rule to your needs.
| Parameter | Description | Default Value |
|---|---|---|
| DisableAllQuickFix | Comma-separated list of rules for which a quick fix should not be applied to all the problems in a file. | Core G-3130 |
References
- related to Trivadis G-7125
