Inserting more data into last inserted row fails
Hi great people,
I have 2 tables. First one is patient_profile with two fields; pid and surname as follows ( pid int(4) unsigned not null auto_increment primary key,
surname varchar(30)).
Second table is patient_address with 3 fields; add_id, pid, phone as follows;
add_id int(4) unsigned not null auto_increment primary key, pid int(4) unsigned not null auto_increment, phone int unsigned not null
The pid field in patient_address is a foreign key that references pid in patient_profile.
I created an after insert row trigger on patient_address that states that whenever i insert a new row into patient_profile the new value of the pid field should be inserted into patient_address.pid column automatically.
This means that patient_address.add_id will also automatically get a value since its a primary key and auto_increments.
My question is, how can i insert the value for patient_address.phone each time a new row is inserted into patient_profile?
Actually, i have created a form with all the DB fields and so phone is a variable that changes depending on the patient being inserted.
Some one help me. Thanks in advance
Subject
Written By
Posted
Inserting more data into last inserted row fails
April 12, 2012 11:52AM
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.