MySQL Forums
Forum List  »  Newbie

Re: PLS HELP: ERROR 1452 (23000) Foreign Key Constraint
Posted by: Roland Chan
Date: April 06, 2011 01:37PM

Here is the output of the MySQL dump:

-- MySQL dump 10.13 Distrib 5.5.11, for osx10.6 (i386)
--
-- Host: localhost Database: constraint_test
-- ------------------------------------------------------
-- Server version 5.5.11

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `Beneficiary`
--

DROP TABLE IF EXISTS `Beneficiary`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Beneficiary` (
`beneficiary_id` bigint(20) NOT NULL,
`district` varchar(255) DEFAULT NULL,
`serviceUnit` varchar(255) DEFAULT NULL,
`insuredNo` int(11) DEFAULT NULL,
`beneficiaryIndex` int(11) DEFAULT NULL,
`relationship` varchar(255) DEFAULT NULL,
`percentage` double DEFAULT NULL,
`fullName` varchar(255) DEFAULT NULL,
`lastUpdatedDate` datetime DEFAULT NULL,
`insured_id` bigint(20) NOT NULL,
`contractNo` varchar(255) DEFAULT NULL,
PRIMARY KEY (`beneficiary_id`),
KEY `FK41BADEC55CE3480` (`insured_id`),
CONSTRAINT `FK41BADEC55CE3480` FOREIGN KEY (`insured_id`) REFERENCES `Insured` (`insured_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `Beneficiary`
--

LOCK TABLES `Beneficiary` WRITE;
/*!40000 ALTER TABLE `Beneficiary` DISABLE KEYS */;
/*!40000 ALTER TABLE `Beneficiary` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `Client`
--

DROP TABLE IF EXISTS `Client`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Client` (
`client_id` bigint(20) NOT NULL,
`firstName` varchar(255) DEFAULT NULL,
`lastName` varchar(255) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
`initial` varchar(255) DEFAULT NULL,
`birthDate` datetime DEFAULT NULL,
`district` varchar(255) DEFAULT NULL,
`serviceUnit` varchar(255) DEFAULT NULL,
`genderType` varchar(255) DEFAULT NULL,
`externalId` varchar(255) DEFAULT NULL,
`externalTempId` varchar(255) DEFAULT NULL,
`taxationProvince` varchar(255) DEFAULT NULL,
`children` varchar(255) DEFAULT NULL,
`manufacturerClientNumber` varchar(255) DEFAULT NULL,
PRIMARY KEY (`client_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `Client`
--

LOCK TABLES `Client` WRITE;
/*!40000 ALTER TABLE `Client` DISABLE KEYS */;
INSERT INTO `Client` VALUES (1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
/*!40000 ALTER TABLE `Client` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `Insured`
--

DROP TABLE IF EXISTS `Insured`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Insured` (
`insured_id` bigint(20) NOT NULL,
`client_id` bigint(20) NOT NULL,
`insuredNo` int(11) DEFAULT NULL,
PRIMARY KEY (`insured_id`),
KEY `FKD7E770CAC207FE14` (`client_id`),
CONSTRAINT `FKD7E770CAC207FE14` FOREIGN KEY (`client_id`) REFERENCES `Client` (`client_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `Insured`
--

LOCK TABLES `Insured` WRITE;
/*!40000 ALTER TABLE `Insured` DISABLE KEYS */;
INSERT INTO `Insured` VALUES (1,1,NULL);
/*!40000 ALTER TABLE `Insured` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2011-04-06 15:16:53

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.