Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Oracle 9.2 and classic asp but I think my trouble is with Oracle

Status
Not open for further replies.

LadyDi02

Technical User
May 25, 2006
61
CA
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
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.
 
faq222-2244 will help you with forum usage. Paragraph 3 explains about choice of forum for your question. Paragraph 7 explains about effective thread titles. Paragraph 8 & 9 explain about doing your own basic research. Paragraph 15 explains how to recognise and acknowledge helpful answers. Paragraph 16 explains the two-way nature of the site.

forum759 will help you with Oracle answers

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
It seems inefficient to recreate the sproc every time...

Assuming the Oracle portion of the code is working properly, from the ASP side you might try using an ADO "Command" object to call the stored procedure since it supports input and output parameters.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top