Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Development Trends in Web and Oracle

Re: Development Trends in Web and Oracle

From: Hexathioorthooxalate <ruler_at_removemetoemail.clara.co.uk>
Date: Mon, 14 Mar 2005 18:23:17 -0000
Message-ID: <1110824826.96483.0@dyke.uk.clara.net>

"Galen Boyer" <galenboyer_at_hotpop.com> wrote in message news:usm2yg60z.fsf_at_hotpop.com...
> Hexathioorthooxalate, are you saying that to guarantee parent/child
> relationships you code triggers?

I haven't written this in the thread so far. But if you really really wanted to guarantee parent/child
relationships in a trigger, you could. I've coded (untested) up an example below. It is pretty clumbsy but it does answer the question - you can (but probably wouldn't) enforce referential integrity this way.

CREATE TRIGGER galenRefTest
 BEFORE INSERT OR UPDATE ON childTable
  FOR EACH ROW
DECLARE
 RefIntegDataValid NUMBER
BEGIN
 SELECT COUNT(*)
  INTO RefIntegDataValid
   FROM parentTable
    WHERE parentTable.ID=

        EXTRACT(:NEW.xmltypeColumnBeingUpdated,'company/employee/id/text()');

 IF RefIntegDataValid=0 THEN
  RAISE_APPLICATION_ERROR(errornumber,'appropriate error message');  END IF; END; Regards
Hex

"Galen Boyer" <galenboyer_at_hotpop.com> wrote in message news:usm2yg60z.fsf_at_hotpop.com...
> On Sun, 13 Mar 2005, ruler_at_removemetoemail.clara.co.uk wrote:
>>
>> Come on please. You perform some validation in stored procs and
>> triggers. You don't just allow the data to be inserted without
>> checking it do you, especially if the external schema is stored procs
>> effectively exposing the database through an API ! Only in substandard
>> implementations would you NOT check the information.
>
> Hexathioorthooxalate, are you saying that to guarantee parent/child
> relationships you code triggers?
>
> --
> Galen deForest Boyer
>
Received on Mon Mar 14 2005 - 12:23:17 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US