I am really stuck now. I have 2 tables. A user table and Hardware table.
user table (User_ID,First_name,Last_Name,Email)
hardware table(Hardware_ID, User_ID, DateRequired, Description)
A User comes in a fills out a form and then clicks submit. On submit (this is where I am stuck) I created 2 procedures to do my inserts
{code] 1st procedure
CREATE OR REPLACE PROCEDURE User_Info_Insert (User_ID OUT INT,
First_Name IN VARCHAR2,
Last_Name IN VARCHAR2,
Email IN VARCHAR2,
Extension IN VARCHAR2,
Last_Modified_By IN VARCHAR2)
IS
BEGIN
insert into Users values (Corp_UserID_seq.nextval,First_Name,Last_Name,Email,Extension,sysdate,Last_Modified_By)
Returning User_ID INTO User_ID;
END;
[/Code]
2nd procedure
I need to get the User_ID( Returning User_ID INTO User_ID) from the first insert to also be added to the hardware table. Is this possible? Unless I can just run one big insert that will complete these 2 inserts. Please please please your help is really appreciated. Thanks everyone.
user table (User_ID,First_name,Last_Name,Email)
hardware table(Hardware_ID, User_ID, DateRequired, Description)
A User comes in a fills out a form and then clicks submit. On submit (this is where I am stuck) I created 2 procedures to do my inserts
{code] 1st procedure
CREATE OR REPLACE PROCEDURE User_Info_Insert (User_ID OUT INT,
First_Name IN VARCHAR2,
Last_Name IN VARCHAR2,
Email IN VARCHAR2,
Extension IN VARCHAR2,
Last_Modified_By IN VARCHAR2)
IS
BEGIN
insert into Users values (Corp_UserID_seq.nextval,First_Name,Last_Name,Email,Extension,sysdate,Last_Modified_By)
Returning User_ID INTO User_ID;
END;
[/Code]
2nd procedure
Code:
CREATE OR REPLACE PROCEDURE Hardware_Info_Insert (DateRequired IN DATE,
Equipment IN VARCHAR2,
Purpose IN VARCHAR2,
LoanDuration IN DATE,
Approver IN VARCHAR2,
LastModifiedBy IN VARCHAR2)
IS
begin
insert into Hardware_Desc values (Corp_HardwareID_seq.nextval,DateRequired,Equipment,Purpose,LoanDuration,Approver,sysdate,LastModifiedBy);
end;
I need to get the User_ID( Returning User_ID INTO User_ID) from the first insert to also be added to the hardware table. Is this possible? Unless I can just run one big insert that will complete these 2 inserts. Please please please your help is really appreciated. Thanks everyone.