Re: sql*plus question

From: Joost Ouwerkerk <owrkrj_at_mailhub.sickkids.on.ca>
Date: 1997/07/21
Message-ID: <33d39aca.16837862_at_resunix.sickkids.on.ca>#1/1


In this case it is assumed there is only one table (detail) which relies on the invoice_number. It is also assumed that there is no foreign key constraint on the invoice number in the detail table (if there were such a constraint then the new invoice number (primary key) would have to exist in the master table before a reference to it (in the detail table) could be made.

Assuming these things not to be true then, there is no reason why we can't change the primary key value (other than changing it to a value that already exists in the table or to NULL).

Joost Ouwerkerk.

On Mon, 21 Jul 1997 08:41:05 -0500, Programming <sysdev_at_mb.sympatico.ca> wrote:

>What is the primary key?
>Is it possible to update a primary key?
>I thought that you had to drop the row,
>then insert, if you wanted to change the key.
>Isn't that right?
>
>Rodger
>
>smp wrote:
>
> Hi,
> This has got to be an easy one but my brain has gone dead and I
>an't work it out.
> I would appreciate any clues to the answer.
>
> I have two tables header and detail which have a master-detail
>relationship
> with invoice as the key.
>
> header
> invoice varchar2(10)
> ref varchar2(5)
> other stuff. .
>
> detail
> invoice varchar2(10)
> other stuff. . .
>
> I want to amend the invoice number for both header and detail if the
>ref in
> the header holds a particular value
>
> eg should become
> Header:-
> invoice 123456 invoice 97123456
> bref CHANGE bref CHANGE
>
> Detail:-
> invoice 123456 invoice 97123456
>
> I would like to do this in one pass if possible
>
> Help!!!!
> Yours gratefully
>
> Sally Pearce
> Financials DBA(for my sins)
Received on Mon Jul 21 1997 - 00:00:00 CEST

Original text of this message