Re: Constraints question
Posted in 1997
Ray Cruz wrote:
>
> Michel.Auger@cgi.ca wrote:
> >
> > Let's say I'm using an "order_header" and "order_item" tables. There is a
> > constraint between these tables.
> >
> > I need to unload the "order_header" from a database and load it into another
> > database without deleting the "order_item" (the primary keys will not changed).
> >
> > If I use this code : begin work;
> > delete from order_header;
> > load from order_header.unl
> > insert into order_header;> > commit work;
> >
> > Is there a way to have Informix checked the constraints at the "commit"
> > instead than the "delete"?
> >
> > Thank you
>
> You can disable the constraint just before the delete. You may then set
> the constraint mode to filtering after loading the "order_header".
> Violations will be captured to your "order_header_vio" table.
... and this works only in a logging database (I'm pretty sure), and the
synta is (from memory, double check me in the manuals):
BEGIN WORK;
SET CONSTRAINTS ALL DEFERRED;
DELETE FROM ...;
LOAD FROM ...;...
COMMIT WORK; -- this is where constraints are tested
Check SET CONSTRAINTS in the SQL manuals. There are ways, I think, to
defer only certain constraints as well.
--
//////////////// =======================================================
////////// // Dennis J. Pimple Informix Software, Inc.
////// / /// Principal Consultant 6300 S Syracuse Way Ste 205
///// // //// dennisp@informix.com Englewood CO 80111
//// // /////
/// // ////// recept: 303-850-0210
// // /////// direct: 303-740-5611 Opinions expressed are mine,
/ /////////// fax: 303-779-4025 and do not necessarily
//////////////// http://www.informix.com reflect those of my employer