next up previous contents index
Next: 4.2.7 The View Level Up: 4.2.6 Handling NULL values Previous: 4.2.6.3 Inserts   Contents   Index

4.2.6.4 Deletes

To delete rows with NULL values at any particular FIELD use Field = 'NULL'(_), 'NULL'/1 with a free argument. When 'NULL'/1 's argument is bound it fails the delete predicate always. For example:

| ?- emp_del('NULL'(_), ..). $\rightarrow$ adds ENAME IS NULL to the generated SQL statement

| ?- emp_del('NULL'('bound'), ...). $\rightarrow$ fails always

The reason for the above protocol is to preserve the semantics of deletes, when some free arguments of a delete predicate get bound by some preceding predicates. For example in the following clause, the semantics is preserved even if the Deptno field is NULL for some rows.

| ?- emp(_,_,_,_,Deptno), dept_del(Deptno).



Terrance Swift 2007-10-06