Re: PL/SQL best practices
Date: Mon, 5 Aug 2002 20:34:45 +0200
Message-ID: <aimgg5$9d4$2_at_news.cybercity.dk>
Alex,
I don't know of any "best" practice, and in this case, I would let the
following factors influence the decision:
-data quality; do you expect a lot of the data, casting exceptions? -if yes,
it might be better to spend some time investigating why this is so -if there
is a constraint implemented, and you violate it big time, what's the point
in having the constraint?
-job needed: is it batch or transaction oriented.
-speed/performance: if you need to load the data quickly, consider removing
the foreign key constraint, loading the data, and then clean up
afterwards/restoring the constraint.
I'm sure there are numerous other factors to consider. In my opinion, there is no 100% right way to do stuff like this -it tends to depend on what you want to obtain ;).
cheers,
Jørgen
"Alex" <alexk84_at_hotmail.com> wrote in message
news:57d3e820.0208050627.7c79505a_at_posting.google.com...
> When inserting a record into a table A which has a foreign key to
> table B, which of the following would be considerred best practice:
>
> 1. Insert the record and catch the exception that occurs if the
> reference data does not exist in table B.
>
> 2. Lookup the data in table B to ensure that it exists and then
> proceed.
>
> Thanks,
>
> Alex
Received on Mon Aug 05 2002 - 20:34:45 CEST