Re: OID in informix
Posted in 2000
"Martin A. Marques" wrote: > > I want to know if the use of the OID (does informix have OID for > identification of the lines?) for identification of the line in the table, so > I can relate it on another table. > If I delete a line of the table, how does it affect the OID of the other > lines, especially the ones below? I don't know what OID is, but it sounds like referential integrity. You need to define a PRIMARY KEY on each table. You can then define a FOREIGN KEY in your detail table that relates it to the primary key of the master table. If you don't have a suitable primary key in the master table, you can add a column of type SERIAL which will automatically generate a numeric key whenever a zero is inserted. Once a primary / foreign key relationship is defined, if you attempt to insert detail records without a master record present, or you try to delete a master record with detail records present, you get an error. You can switch on CASCADE DELETE for a FOREIGN KEY, which will automatically delete the detail records when the master record is deleted. You must have logging switched on for this. Cheers, -- Mark. +----------------------------------------------------------+-----------+ | Mark D. Stock mailto:mdstock@mydas.freeserve.co.uk |//////// /| | http://www.informix.com http://www.informixhandbook.com |///// / //| | http://www.iiug.org +-----------------------------------+//// / ///| | |This email will self-destruct in |/// / ////| | |10 sec. If you received this email |// / /////| | |in error, sorry about the mess. |/ ////////| +----------------------+-----------------------------------+-----------+