

LPAD(RTRIM(RTRIM(TO_CHAR(seq_patient_id.NEXTVAL))),10,'0') INTO :NEW.patient_id FROM DUAL

Then create the trigger tr_patient to add seq_patient_id on the primary key patient_id CREATE OR REPLACE TRIGGER tr_patient BEFORE INSERT ON patient In the patient table we create a sequence function to store patient_id automatically and start with 10000001 and end with 19999999. Payroll table will be accessed only by an accountant to secure the information.Īfter converting the structure we will use sql scripts for database modifications. The reason we made a separate table for the hospital Contact because hospitals have multiple phone numbers and email. In above structure Prescribed_Med has only one attribute because Patient_Report table and Medicine table has many to many relationship, Prescribed_Med is there to break many to many relationship.
