dbTalk Databases Forums  

Temporary tables in memory using PL/SQL (as a workaround for nothaving CREATE TABLE privs)?

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Temporary tables in memory using PL/SQL (as a workaround for nothaving CREATE TABLE privs)? in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #21  
Old   
dananrg@yahoo.com
 
Posts: n/a

Default Re: Temporary tables in memory using PL/SQL (as a workaround for nothaving CREATE TABLE privs)? - 02-15-2008 , 01:37 PM






On Feb 14, 2:44*pm, Urs Metzger <u... (AT) ursmetzger (DOT) de> wrote:
Quote:
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.

Anyone care to comment on the goodness or badness of updating values
in a composite primary key rather than making copies of rows, deleting
the old rows, then re-inserting updated versions of the copied rows?

I did come up with a way of doing what I needed using "collections of
records" in PL/SQL before I saw your reply. That seems to work. I have
not tried your example #2 yet. I can post it if anyone is interested.


Reply With Quote
  #22  
Old   
Urs Metzger
 
Posts: n/a

Default Re: Temporary tables in memory using PL/SQL (as a workaround fornot having CREATE TABLE privs)? - 02-15-2008 , 02:25 PM






dananrg (AT) yahoo (DOT) com schrieb:
Quote:
On Feb 14, 2:44 pm, Urs Metzger <u... (AT) ursmetzger (DOT) 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


Reply With Quote
  #23  
Old   
Urs Metzger
 
Posts: n/a

Default Re: Temporary tables in memory using PL/SQL (as a workaround fornot having CREATE TABLE privs)? - 02-15-2008 , 02:25 PM



dananrg (AT) yahoo (DOT) com schrieb:
Quote:
On Feb 14, 2:44 pm, Urs Metzger <u... (AT) ursmetzger (DOT) 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


Reply With Quote
  #24  
Old   
Urs Metzger
 
Posts: n/a

Default Re: Temporary tables in memory using PL/SQL (as a workaround fornot having CREATE TABLE privs)? - 02-15-2008 , 02:25 PM



dananrg (AT) yahoo (DOT) com schrieb:
Quote:
On Feb 14, 2:44 pm, Urs Metzger <u... (AT) ursmetzger (DOT) 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


Reply With Quote
  #25  
Old   
Urs Metzger
 
Posts: n/a

Default Re: Temporary tables in memory using PL/SQL (as a workaround fornot having CREATE TABLE privs)? - 02-15-2008 , 02:25 PM



dananrg (AT) yahoo (DOT) com schrieb:
Quote:
On Feb 14, 2:44 pm, Urs Metzger <u... (AT) ursmetzger (DOT) 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


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.