-- -- Creates logical constraints -- A logical constraint is one that cannot ordinarily be made as a database constraint (e.g. -- mandatory associations implemented in > 1 table.) This sort of construct cannot be -- done using a foreign key and hence must be validated by a deferred check on closing -- a transaction. In order for a deferred check to work, an assertion must be prepared. -- It is the responsibility of this package to create these assertions. create or replace package jrm_deferred_check is -- PRE : product_name is a valid name in the RM meta-model -- POST: all logical constraints are identified and assertions created. The instance data -- logical constraint code is created and made into an expression. procedure createLogicalConstraints( product_name VARCHAR2 ); -- function getExpression -- -- The expression is the 'call-back' body used by deferred_checks. This will (at runtime) -- provide the logic to the constraints identified in identifyLogicalConstraints -- PRE: expID is a valid expression defined against an assertion -- lineId is the line number of the sql part of the expression -- POST: the sql part for this expression id and line number is returned function getExpression( expId IN NUMBER , lineId IN NUMBER) return varchar2; -- PRE: expId is a valid expression defined against an assertion -- POST: the number of lines of sql used in the 'call-back' function getExpressionSize( expId IN NUMBER) return number; end jrm_deferred_check; /