Home » SQL & PL/SQL » SQL & PL/SQL » how to populate a distinct column in a table (oracle 11.g)
how to populate a distinct column in a table [message #582813] Mon, 22 April 2013 19:27 Go to next message
ApacheOmega
Messages: 9
Registered: April 2013
Location: Alabama
Junior Member
I had to create a new column in a particular table now i want to insert the values in that column though the other columns are already populated I entered the command (insert into Product(STANDARD_PRICE) values(895.99)Wink
when i hit return it says cannot enter null value into(SYSTEM.PRODUCT.PRODUCT_ID)
product_id is the PK which is the first column
STANDARD_PRICE is the last column in my table
how do i enter the values into that column without receiving this error or having to effect the other columns?
Re: how to populate a distinct column in a table [message #582815 is a reply to message #582813] Mon, 22 April 2013 19:34 Go to previous messageGo to next message
BlackSwan
Messages: 23055
Registered: January 2009
Senior Member
>(insert into Product(STANDARD_PRICE) values(895.99)
INSERT statement creates a NEW row!
UPDATE changes column in existing row!

http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_10008.htm#SQLRF01708

Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/

Re: how to populate a distinct column in a table [message #582827 is a reply to message #582813] Mon, 22 April 2013 22:48 Go to previous messageGo to next message
arif_md2009
Messages: 732
Registered: May 2009
Location: United Arab Emirates
Senior Member

the error is obvious , you are trying to enter null into a column which has a primary key column which has to be manually entered.Kindly check the entire structure of your table and insert it properly.
Re: how to populate a distinct column in a table [message #582836 is a reply to message #582827] Tue, 23 April 2013 00:32 Go to previous message
Michel Cadot
Messages: 59791
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Not so obvious than you think, read Blackswan's answer.

Regards
Michel
Previous Topic: show number of days between two date
Next Topic: email on job start/complete
Goto Forum:
  


Current Time: Wed Nov 26 10:04:54 CST 2014

Total time taken to generate the page: 0.13869 seconds