|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
SQL Plus Help!
Hi All
I have 3 tables to create and have to insert initial 10 records for each tables. So e.g Table1: EMPID(PK) Name Address Salary Table2: JOBID(PK) Category Status EMPID(FK from table1) Table3: DeptID(PK) PIC JOBID(FK) LOC So is there any way to insert records into all 3 tables once? Now when i insert records individually I can not insert for Foreign key field they said Parent key can not be found. I have successfully can insert 10 records in Table1.But got error when i insert into Table 2 (some same records ID) and Table 3. Please help.. Thnks, |
|
#2
|
|||
|
|||
|
If you are using MySQL and InnoDB tables you can SET FOREIGN_KEY_CHECKS = 0;
...run the script SET FOREIGN_KEY_CHECKS = 1; ... This disables the foreign key constraint checking.
__________________
El éxito consiste en una serie de pequeñas victorias día a día MySQL, MS SQL, MS ACCESS, Oracle Database Manager - http://victorpendleton.net/products/psdviewer.html |
|
#3
|
|||
|
|||
|
Hi victorpendleton,
Thnks for ur guide. I am using oracle sql*plus and it's really new to me and now I even not sure where to put the script you gave. I m thinking to drop PK or FK from table so that I can show all records without problem. But If I want to delete or update then again I have to go individually? hmm.. ![]() |
|
#5
|
|||
|
|||
|
Wrong forum but I will answer anyways.
That script was for MySQL not Oracle. You need to disable the table constraints before the data load. ALTER TABLE table_name DISABLE CONSTRAINT constraint_name CASCADE; .... load data ALTER TABLE table_name ENABLE CONSTRAINT constraint_name; |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > SQL Plus Help! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|