|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Filling tables from other tables?
ok not shore how to describe this but what I trying to do is this when I create a Person they will automaticly get a National Identification Card but how will I be able to do this?
This is the UK Citizen Table Insert code:- Code:
INSERT INTO UKCITIZEN VALUES("citizenid", "convictionid", "contactid", "nationalidentificationregister", "addressid", "bioid", name, surname, dateofbirth, placeofbirth, nationalinsurancenumber, ethnicity, workstatus);
But when this gets created it will also need to fill out this part of the codeing automaticly: - Code:
INSERT INTO NIC VALUES(nationalidentificationregister, citizenid, auditid, dateissued, dateexpires); dateissued will be sysdate dateexpires will be sysdate + 157784630 (5 Year) *Current SQL Tables, Objects, Inserts are in the Attached file, if you wish to see the table layout |
|
#2
|
|||
|
|||
|
Not sure, what you want to achieve, but it sounds like a problem that can be solved by creating an insert trigger on the table UKCITIZEN.
Two additional things: 1) you should always specifiy the column list in the INSERT statement (INSERT INTO table (col1, col2, ..) VALUS (...)) in order to avoid problems when the table or the column order changes at a later stage 2) in Oracle never use double quotes for column names, that will save you a lot of problems (because then Oracle - as most other DBMS - will be case sensitiv in regards to the column names) |
|
#3
|
||||
|
||||
|
Are there any examples of triggers you chould point out please?
1)Like this? : - INSERT INTO UKCITIZEN (citizenid, convictionid, contactid, ...) VALUS("001", null, "008", ...); 2)the double quotes are not in the name there just put there so I know its a char/varchar2 that gose in there. |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > Filling tables from other tables? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|