Expression evaluation syntax
Posted: Fri Oct 11, 2013 10:13 pm
Is there a syntax to invoke an operator and obtain its value? My intended use of this is quick and dirty syntax testing while actually writing Rel code. The example I have is:
If
is defined, I would like to write something like (in DBrowser):
greater_than(unbounded_integer("1"),unbounded_integer("1")) and get back the value of the operater, type boolean, (in this example) false.
If
Code: Select all
OPERATOR greater_than(P unbounded_integer, Q unbounded_integer) RETURNS BOOLEAN;
CASE;
WHEN Q = unbounded_integer("unbounded") THEN return FALSE;
WHEN P = unbounded_integer("unbounded") AND Q <> unbounded_integer("unbounded")
THEN return TRUE;
ELSE return
(CAST_AS_INTEGER(THE_VALUE(P)) > CAST_AS_INTEGER(THE_VALUE(Q)));
END CASE;
END OPERATOR;
greater_than(unbounded_integer("1"),unbounded_integer("1")) and get back the value of the operater, type boolean, (in this example) false.