Home » SQL & PL/SQL » SQL & PL/SQL » unable to update column
unable to update column [message #196267] Wed, 04 October 2006 12:45 Go to next message
ashish_pass1
Messages: 114
Registered: August 2006
Location: delhi
Senior Member
hello
i want to know how could i update column by a constraints
(i.e primary key).Though i tried it by alter table command
but error occurred.
plz revert me back as i m new in oracle. Cool
Re: unable to update column [message #196279 is a reply to message #196267] Wed, 04 October 2006 13:38 Go to previous messageGo to next message
Nirmala
Messages: 43
Registered: October 2004
Member
You can disable the constraint and then try to update the column.

alter table <table_name> disable constraint <constraint name>;

update table

Re: unable to update column [message #196325 is a reply to message #196279] Thu, 05 October 2006 00:43 Go to previous messageGo to next message
be2sp1
Messages: 52
Registered: September 2005
Location: India
Member
But, once the constraint is disabled and then the value is inserted or updated which cannot be validated by the constraint then you will not be able to enable the constraint back.
icon7.gif  Re: unable to update column [message #196377 is a reply to message #196267] Thu, 05 October 2006 03:11 Go to previous messageGo to next message
ashish_pass1
Messages: 114
Registered: August 2006
Location: delhi
Senior Member
sir,
i unable to make u clear of question,sorry fo it.
suppose i had made a table in which i forget to make a constraints column(i.e primary key column).
now i would like to make it constraints column.
though tables having no rows.
Razz
  • Attachment: as.txt
    (Size: 0.33KB, Downloaded 154 times)

[Updated on: Thu, 05 October 2006 03:17]

Report message to a moderator

Re: unable to update column [message #196378 is a reply to message #196377] Thu, 05 October 2006 03:17 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Now THERE's an attachement that makes things a lot clearer!

Please explain what it is exactly what you want:
a) you have all columns you need, but you need to have a primary key
b) you already have a primary key, but you want to add a column to it, so it will contain two columns
c) none of the above
Re: unable to update column [message #196379 is a reply to message #196267] Thu, 05 October 2006 03:24 Go to previous messageGo to next message
ashish_pass1
Messages: 114
Registered: August 2006
Location: delhi
Senior Member
i need primary key on department_id which having null values.
Re: unable to update column [message #196382 is a reply to message #196379] Thu, 05 October 2006 03:27 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
no go.
Re: unable to update column [message #196385 is a reply to message #196267] Thu, 05 October 2006 03:33 Go to previous messageGo to next message
Cthulhu
Messages: 381
Registered: September 2006
Location: UK
Senior Member
Yes, the best you can do is to have a unique key that allows NULL values. But not a primary key.
Re: unable to update column [message #196391 is a reply to message #196385] Thu, 05 October 2006 03:41 Go to previous message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It seems that you are unfamiliar with the Primary key concept.
Oracle

A primary key constraint combines a NOT NULL and unique constraint in one declaration. Therefore, to satisfy a primary key constraint:

- No primary key value can appear in more than one row in the table.

- No column that is part of the primary key can contain a null.


[EDIT]
Although it appears that my post was written as a reply to Cthulhu's one, it was aimed to the OP. Sorry.

[Updated on: Thu, 05 October 2006 03:43]

Report message to a moderator

Previous Topic: converting a number to hex
Next Topic: i want sample of DBHandler and DBconnection
Goto Forum:
  


Current Time: Sat Dec 10 07:04:36 CST 2016

Total time taken to generate the page: 0.04593 seconds