CREATE PROCEDURE INSERTHELPDESK
(
: EMPLOYEEID NUMBER;
: DESCRIPTION NVARCHAR;
)
AS
BEGIN
INSERT INTO HELPDESK (EMPLOYEEID, DESCRIPTION)
VALUES (: EMPLOYEEID, : DESCRIPTION)
END;
I keep getting compile errors with the Oracle stored procedure. Can anyone tell me what's wrong or an example of how it should be. I am passing parameter values in from an asp.net web application. Any help much appreciated. Daniel
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Hi Pav - thanks for the response it was most helpful.
The below stored procedure compiles successfully...
Create Procedure Inserthelpdesk
IS
Employeeid Number;
Description varchar2(50);
Begin
Insert
Into Helpdesk (employeeid, Description)
Values (Employeeid, Description)
;
End Inserthelpdesk;
However... I want to bind data to those variables that I am passing in from an ASP.Net Web application. I assume you bind data to variables using the colon (: ) symbol - see below...
Create Procedure Inserthelpdesk
IS :Employeeid Number; :Description varchar2(50);
Begin
Insert
Into Helpdesk (employeeid, Description)
Values (:Employeeid, :Description)
;
End Inserthelpdesk;
However when I do this and try to compile the stored procedure I get the following error message:
Line # = 2 Column # = 1 Error Text = PLS-00049: bad bind variable 'EMPLOYEEID'
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Create Procedure Inserthelpdesk
(p_Employeeid Number,
p_Description varchar2)
IS
Begin
Insert
Into Helpdesk (employeeid, Description)
Values (p_Employeeid, p_Description);
End Inserthelpdesk;
/
the p_ is just a convention that indicates a parameter -- g_ for globals, l_ for locals as well. It lets you use essentially the same names for variables as you use for column names and makes bind variables a little more visible in SQL.
Bookmarks