HI,
I am writing a stock management database for my dissertation.
I have 3 table - Part, Parts_Supplied and Supplier...
When i insert a part, i need to also insert a record into Parts_supplied which contains only the part_id and supplier_id.
Do i use an oracle insert trigger when the part table is updated? If so, i am unsure how to get the newly added part_id and supplier_id to this trigger. Could i do this whole procedure in one go??
I'll leave my addpart plsql
I am writing a stock management database for my dissertation.
I have 3 table - Part, Parts_Supplied and Supplier...
When i insert a part, i need to also insert a record into Parts_supplied which contains only the part_id and supplier_id.
Do i use an oracle insert trigger when the part table is updated? If so, i am unsure how to get the newly added part_id and supplier_id to this trigger. Could i do this whole procedure in one go??
I'll leave my addpart plsql
Code:
CREATE OR REPLACE PROCEDURE SP_ADD_PART
(s_part_no IN tbl_part.s_part_no%TYPE,
s_part_Desc IN tbl_part.s_part_Desc%TYPE,
d_cost IN tbl_part.d_cost%TYPE,
i_qty IN tbl_part.i_qty%TYPE,
i_btype_id IN tbl_Part.i_btype_id%TYPE,
s_location IN tbl_Part.s_location%TYPE,
i_kanban_qty IN tbl_Part.i_kanban_qty%TYPE,
i_lead_time IN tbl_Part.i_lead_time%TYPE,
i_low_level IN tbl_Part.i_low_level%TYPE
)
IS
BEGIN
--insert order
INSERT INTO tbl_part (s_part_no, s_part_Desc, d_cost,i_qty, i_btype_id, s_location,i_kanban_qty,i_lead_time, i_low_level)VALUES (s_part_no, s_part_desc, d_cost,i_qty,i_btype_id,s_location,i_kanban_qty,i_lead_time, i_low_level);
END;
/
show errors;
ps. i can also pass through the supplier_id if required.
Many thanks, your help is much apreciated, especially as my deadline is friday!!!
Alex