Re: Temporary tables in memory using PL/SQL (as a workaround for not having CREATE TABLE privs)?

From: Urs Metzger <urs_at_ursmetzger.de>
Date: Fri, 15 Feb 2008 21:25:30 +0100
Message-ID: <fp4sa3$jf1$1@online.de>


dananrg_at_yahoo.com schrieb:
> On Feb 14, 2:44 pm, Urs Metzger <u..._at_ursmetzger.de> wrote:

>> Why not just insert the records and delete the old ones afterwards?

>
> Thanks Urs. Some of the columns in the child tables I need to update
> are part of composite primary keys. In your first example, you update
> a foreign key value.
>
> For some reason, I thought it wasn't possible to update values that
> were part of a primary key. I didn't think it was allowed. Using
> JavaBeans, I've been told, it isn't allowed. Is it bad practice to
> update values that are part of a primary key? Was it ever not allowed
> in any version of Oracle? Not sure where I got that idea from, but
> your first example works fine.
>

You can, and IIRC always could, change primary key (doesn't matter if composite or not) and foreign key values if you don't violate constraints. You can
- update a primary key, if it has no children - update a foreign key, if it's new parents are there. That's what I

   did in my firts example.

There is yet another way to update primary keys and foreign keys in one transaction: deferrable constraints, which means that integrity will be checked only at commit time. Search the manuals...

Hth Urs Metzger Received on Fri Feb 15 2008 - 14:25:30 CST

Original text of this message