next up previous contents index
Next: Data dictionary Up: Handling NULL values Previous: Inserts:   Contents   Index


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).

Baoqiu Cui