473,394 Members | 1,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Getting wrong error message when running a command

Hi

I have just started learning oracle.

i have created a table with name imp_master and columns item_code with constraint not null, item_name with constraint n1 not null(n1 is user defined constraint name), item_rate and item_desc.

the copmmand is as follows...

CODE:

create table item_master
( item_code varchar2(25) not null,
item_name varchar2(25) n1 not null,
item_rate number(7,2),
item_desc varchar2(50) );

table has been created with the above mentioned columns. i have checked it with the command " desc item_master;"

After this has been done i have altered the column "item_desc" with the command " alter table item_master modify item_desc not null; "
the column has been altered.
To check this i have entered the command
Insert into table item_master (item_desc) values (null);
The problem is here
instead of showing the message that the column item_desc does not take null values... it is throwing error message
ERROR MESSAGE :

ORA_01400 cannot insert null into
( "SCOTT"."ITEM_MASTER"."ITEM_CODE")

even though i am trying to enter nulls into "item_desc" column ... it is referring to "item_code" column.

After this i have modified the item_desc to accept the null values. And then i ran command to enter the values into the column. Then also it is throwing the error message as

ERROR MESSAGE:

ORA_01400 cannot insert null into
( "SCOTT"."ITEM_MASTER"."ITEM_CODE")

I am programming in oracle 9. OS is windows 200 advanced server.

Help appreciated.
Jan 22 '08 #1
3 2152
rpnew
188 100+
Hi,
You are doing following....
Expand|Select|Wrap|Line Numbers
  1.  Insert into table item_master (item_desc) values (null);
  2.  
So here what is happening is you are inserting value(null in this case) for item_desc but you are not specifying any value for other columns so NULL will be inserted for them. And thats why you are getting this error cause you've specified NOT NULL constraints for first two columns so NULL is not allowed for them.
If you want to check your item_desc column for NULL try the following query

Expand|Select|Wrap|Line Numbers
  1.   Insert into table item_master (item_code,item_name,item_desc) values ('somevalue','somevalue',null);
  2.  
For column item_rate you haven't specified any constraints so error will not be thrown.

Regards,
RP
Jan 22 '08 #2
amitpatel66
2,367 Expert 2GB
Well ,that is how oracle performs.
If you see your table structure, the first column ITEM_CODE is described as NOT NULL. So any insert statement not entering value for this column will throw this error.

If you try the below insert statement:

Expand|Select|Wrap|Line Numbers
  1. insert into ITEM_MASTER(item_code) values('1');
  2.  
It will throw you an error saying "CANNOT INSERT NULL INTO item_name" and so on.
Oracle will take in order the columns from the table and throw an error accordingly!!
Jan 22 '08 #3
Thanks a lot guys....
Jan 22 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Jeff Harbin | last post by:
I've spent the last 2 days trying to begin using mysql. I've purchased 3 books and read huge chunks of the documentation provided with the mysql zip file. I've downloaded...
5
by: Ken Cox [Microsoft MVP] | last post by:
MS has posted this here: http://www.asp.net/faq/ms03-32-issue.aspx Fix for: 'Server Application Unavailable' Error after Applying Security Update for IE...
9
by: Microsoft News Server | last post by:
Hi, I am currently having a problem with random, intermittent lock ups in my ASP.net application on our production server (99% CPU usage by 3 threads, indefinately). I currently use IIS Debug...
4
by: Sean Shanny | last post by:
To all, Running into an out of memory error on our data warehouse server. This occurs only with our data from the 'September' section of a large fact table. The exact same query running over...
7
by: michael sorens | last post by:
(1) I tried to use what seems like a standard line (from Walkthrough: Creating a Windows Service Application in the Component Designer at http://msdn2.microsoft.com/en-us/library/zt39148a.aspx): ...
23
by: deathtospam | last post by:
A day or two ago, I wrote a quick ASPX page with a CS codebehind using Visual Studio .NET 2005 -- it worked, I saved it and closed the project. Today, I came back to the project, reopened the...
7
by: Norman Diamond | last post by:
A project depends on VC runtime from Visual Studio 2005 SP1, and DotNet Framework 2. Options are set in the setup project properties, so if these two dependencies are not already installed then...
13
by: AAaron123 | last post by:
I downloaded the personal website starter kit and when I run it I get the error shown below. I found a way of using Launch Surface Area Configuration that is supposed to fix the remote setting...
5
by: Tony | last post by:
I am continuing to develop an Access 2007 application which was originally converted from Access 2003. In Access 2003 I was able to disable the Access Close button in the top righthand corner of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.