Hello everyone.
I am a newbie to Oracle 8 so please be patient and thanks for your time.
The problem is the above mentioned error. I have two databases
successully created using SQL*Plus 8.03. They are as follows:
Create Table EMPLOYEES
(
FName VARCHAR(15) NOT NULL,
MINIT CHAR,
LName VARCHAR(15) NOT NULL,
SSN CHAR(9) NOT NULL,
BDATE CHAR(25),
Address VARCHAR(30),
Sex CHAR,
Salary DECIMAL(10,2),
SUPERSSN CHAR(9),
DNO INT,
Primary Key(SSN),
Foreign Key(SUPERSSN) REFERENCES EMPLOYEES(SSN),
Foreign Key(DNO) REFERENCES DEPARTMENT(DNUM BER)
);
Create Table DEPARTMENT
(
DNAME VARCHAR(15) NOT NULL,
DNUMBER INT NOT NULL,
MGRSSN CHAR(9) NOT NULL,
MGRSTARTDATE CHAR(25),
Primary Key(DNUMBER),
Unique(DNAME),
Foreign Key(MGRSSN) References EMPLOYEES(SSN)
);
I then try to insert a record into the Employees table and received the
above mentioned error:
Insert into employees Values
('John', 'B', 'Smith', '123456789', '1965-01-09', '731 Fondren,
Houston, TX', 'M', 30000, '33344555', 5);
I then decided to try to insert a record into the Department table and
received the exact same error. I have read on google.com since the
Employees table has a foreign key which references a primary key in the
Department table I should make sure the Foreign key value exist in the
Department table first. But I'm caught in a loop because both tables
have foreign keys which point to the primary key in the other table.
Any help would be greatly appreciated.
Thanks again
Victor 2 5094
Victor M. wrote: Hello everyone.
I am a newbie to Oracle 8 so please be patient and thanks for your time. The problem is the above mentioned error. I have two databases successully created using SQL*Plus 8.03. They are as follows:
Create Table EMPLOYEES ( FName VARCHAR(15) NOT NULL, MINIT CHAR, LName VARCHAR(15) NOT NULL, SSN CHAR(9) NOT NULL, BDATE CHAR(25), Address VARCHAR(30), Sex CHAR, Salary DECIMAL(10,2), SUPERSSN CHAR(9), DNO INT, Primary Key(SSN), Foreign Key(SUPERSSN) REFERENCES EMPLOYEES(SSN), Foreign Key(DNO) REFERENCES DEPARTMENT(DNUM BER) );
Create Table DEPARTMENT ( DNAME VARCHAR(15) NOT NULL, DNUMBER INT NOT NULL, MGRSSN CHAR(9) NOT NULL, MGRSTARTDATE CHAR(25), Primary Key(DNUMBER), Unique(DNAME), Foreign Key(MGRSSN) References EMPLOYEES(SSN) );
I then try to insert a record into the Employees table and received the above mentioned error:
Insert into employees Values ('John', 'B', 'Smith', '123456789', '1965-01-09', '731 Fondren, Houston, TX', 'M', 30000, '33344555', 5);
I then decided to try to insert a record into the Department table and received the exact same error. I have read on google.com since the Employees table has a foreign key which references a primary key in the Department table I should make sure the Foreign key value exist in the Department table first. But I'm caught in a loop because both tables have foreign keys which point to the primary key in the other table.
Any help would be greatly appreciated.
Thanks again
Victor
1) DNUMBER is a "INTEGER" & therefore does NOT require signle quote
marks around it.
2) SSN is defined as CHAR(9), but count the characters!
1965-01-09
1234567890
Exactly how do you proposed to jam 10 characters into
a field that holds only NINE?
3) What prevents you from disabling one or both PK/FK pairs
while loading the data?
4) Ask the application/table designer how to load the tables!
In article <Q6pOa.120391$M J5.69016@fed1re ad03>, an*******@hotma il.com
says... Victor M. wrote: Hello everyone.
I am a newbie to Oracle 8 so please be patient and thanks for your time. The problem is the above mentioned error. I have two databases successully created using SQL*Plus 8.03. They are as follows:
Create Table EMPLOYEES ( FName VARCHAR(15) NOT NULL, MINIT CHAR, LName VARCHAR(15) NOT NULL, SSN CHAR(9) NOT NULL, BDATE CHAR(25), Address VARCHAR(30), Sex CHAR, Salary DECIMAL(10,2), SUPERSSN CHAR(9), DNO INT, Primary Key(SSN), Foreign Key(SUPERSSN) REFERENCES EMPLOYEES(SSN), Foreign Key(DNO) REFERENCES DEPARTMENT(DNUM BER) );
Create Table DEPARTMENT ( DNAME VARCHAR(15) NOT NULL, DNUMBER INT NOT NULL, MGRSSN CHAR(9) NOT NULL, MGRSTARTDATE CHAR(25), Primary Key(DNUMBER), Unique(DNAME), Foreign Key(MGRSSN) References EMPLOYEES(SSN) );
I then try to insert a record into the Employees table and received the above mentioned error:
Insert into employees Values ('John', 'B', 'Smith', '123456789', '1965-01-09', '731 Fondren, Houston, TX', 'M', 30000, '33344555', 5);
I then decided to try to insert a record into the Department table and received the exact same error. I have read on google.com since the Employees table has a foreign key which references a primary key in the Department table I should make sure the Foreign key value exist in the Department table first. But I'm caught in a loop because both tables have foreign keys which point to the primary key in the other table.
Any help would be greatly appreciated.
Thanks for the help. I am just beginning to learn Oracle on my own so
I'm bound to make mistakes.
1. For the SSN field...do I have to take into consideration the
terminator character at the end ? I suppose that is what you mean by the
added 0 at the end of the string '1234567890' ?
2. Would you tell me if this sounds right on disabling the Foreign Key
constraint in the Employees Table.
ALTER TABLE EMPLOYEES MODIFY CONSTRAINTS DNO DISABLE NOVALIDATE
Thanks again
Victor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jack |
last post by:
I have a text file of data in a file (add2db.txt) where the entries are
already entered on separate lines in the following form:
INSERT INTO `reviews` VALUES("", "Tony's", "Lunch", "Great atmosphere.
Good food.", " (Harry Houdini - 03/01/2004)");
INSERT INTO `reviews` VALUES("", "Le Chow Place", "Lunch", "yada yada",
" (Herbert Hoover -...
|
by: shank |
last post by:
I have a recordset that contains multiple records of product a user is
purchasing. For clarity, I converted the recordset fields to variables. I
need to take that entire recordset and insert it into another table on a
remote server. The below code only inserts 1 record. How do I change the
code to get all records inserted?
thanks!
<%
Dim...
|
by: Tim::.. |
last post by:
Can someone please tell me why I keep getting the following error from the
code below!
Error: INSERT statement conflicted with COLUMN FOREIGN KEY constraint
'FK_tblOfficePageContent_tblPageContent'. The conflict occurred in database
'CPNCMS', table 'tblPageContent', column 'pageID'. The statement has been
terminated.
I cant seem to see...
|
by: Geoffrey KRETZ |
last post by:
Hello,
I'm wondering if the following behaviour is the correct one for
PostGreSQL (7.4 on UNIX).
I've a table temp_tab with 5 fields (f1,f2,f3,...),and I'm a launching
the following request :
INSERT INTO temp_tab VALUES (1,2,3)
|
by: SandySears |
last post by:
I am trying to use a stored procedure to insert a record using VS 2005, VB
and SQL Server Express. The code runs without errors or exceptions, and
returns the new identifer in the output parameters. It returns my error text
message in another output parameter as "ok", which is the value that is set
in the stored procedure prior to doing the...
| |
by: technocraze |
last post by:
Hi guys,
I have encountered this error when updating the values to the MS Acess table.
Error : Update on linked table failed. ODBC sql server error Timeout expired. MS Acess is my front end and sql server is my backend server.
This error occured whenever i step through and when it reaches rs.update it jux hangs down there and thereafter...
|
by: rn5a |
last post by:
During registration, users are supposed to enter the following
details: First Name, Last Name, EMail, UserName, Password, Confirm
Password, Address, City, State, Country, Zip & Phone Number. I am
using MS-Access 2000 database table for this app. Note that the
datatype of all the fields mentioned above are Text. Apart from the
above columns,...
|
by: ak1dnar |
last post by:
There is a Error getting while i am entering records using this jsp file.
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<%@ include file="../Connections/conn.jsp" %>
<%
// *** Edit Operations: declare variables
// set the form action variable
String MM_editAction =...
|
by: DavidOwens |
last post by:
<form action="do.php" method="post">
<?php
/*
create table users (id int, staffid int, region varchar(20), firstname varchar(20), surname varchar(20));
insert into users values(1,1,'region1','John', 'Doe'),(2,2,'region1','Pete', 'Mackay');
create table stores (name varchar(10));
insert into stores...
|
by: rsdev |
last post by:
Hi,
I have a stored procedure which is returning a blank id.
Here's my code;
SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings);
SqlCommand cmd = new SqlCommand("NewComponent", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@shortDescription",...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |