Closed stevemuench closed 6 months ago
To doublecheck:
departments
dname
emp /setnull
department_id /fk departments
ename
should output
...
create table emp (
id number generated by default on null as identity
constraint emp_id_pk primary key,
department_id number
constraint emp_department_id_fk
references departments on delete set null,
ename varchar2(255 char)
)
;
...
Then
team_members
username
projects /insert 2
name
project_lead /nn /references team_members /setnull
would raise an error due to conflicting directives.
I didn't understand why the team_members and project example would not simply result in a foreign key project_lead that would be set null if the team member to which it referred was deleted. Can you clarify what you mean by conflicting directives? It would definitely be an error to list both /cascade and /setnull together, but I thought /references was a synonym for /fk and that the lack of having either /setnull or /cascade was what represented the default ON DELETE RESTRICT behavior (which is omitted from the DDL since it's the behavior of a foreign key by default).
The /nn
directive is conflicting with /setnull
. (This is a test example for /cascade
that is converted to /setnull
, and /nn
is just an artifact).
Thanks for clarifying. I missed the /nn
in there.
in 1.2.6
In order to reverse-engineer existing schemas into QuickSQL for visualization in the Oracle APEX QuickSQL diagram, support for the
ON DELETE SET NULL
foreign key constraint variant is required to round out support for the different kinds of foreign key constraints that can be expressed. Ideally, wherever/cascade
is supported today, QuickSQL would also recognize/setnull
and generate the appropriateON DELETE SET NULL
for the SQL in the foreign key constraint DDL it produces.