Page 1 of 1

DEE and DUM

Posted: Thu Jan 09, 2014 8:53 pm
by Chris Walton
I have not got the usage of DEE and DUM sorted out. How do I amend the following examples to initialise a relvar to empty?

Code: Select all

VAR Test BASE RELATION { A0 INT } INIT ( RELATION { TUPLE { A0 999 } } ) KEY { A0 };
Ok.
VAR Test1 BASE RELATION { A0 INT } INIT ( DEE ) KEY { A0 };
ERROR: Variable of type RELATION {A0 INTEGER} cannot be initialised with an expression of type RELATION {}
Line 1
VAR Test2 BASE RELATION { A0 INT } INIT ( DUM ) KEY { A0 };
ERROR: Variable of type RELATION {A0 INTEGER} cannot be initialised with an expression of type RELATION {}
Line 1

Re: DEE and DUM

Posted: Tue Jan 14, 2014 5:32 pm
by Dave
Defining relvars initialises them to empty, so you can omit the "INIT (...)" clause. Alternatively, you could do:

Code: Select all

DELETE Test;
DELETE Test1;
DELETE Test2;

Re: DEE and DUM

Posted: Thu Jan 23, 2014 6:31 pm
by Chris Walton
I was not clear enough about what I was trying to do. I was trying to insert, into a relvar which has a RVA, values which contained an empty relation for the RVA. After some experimentation I have found the following works.

Code: Select all

VAR T1 BASE RELATION { A0 CHAR, R0 RELATION { B1 INT, B2 CHAR } } KEY { A0 };
Ok.
INSERT T1 RELATION { TUPLE { A0 "Test", R0 RELATION { B1 INT, B2 CHAR } { } } };
NOTICE: Inserted 1 tuple.
Ok.