Click to See Complete Forum and Search --> : Oracle SP in ASP.NET


Trinity14
07-10-2003, 08:59 AM
I am creating an asp.net application and this is my first time using an Oracle back-end and I'm a bit confused.

I'm getting this error:

ORA-06550: line 1, column 7: PLS-00201: identifier 'GETCURRENTPOLLQUESTIONID' must be declared ORA-06550: line 1, column 7: PL/SQL: Statement ignored

The information I've found on the net seems unrelated to my problem.

This is the Stored Procedure:

PROCEDURE GETCURRENTPOLLQUESTIONID
(
PARAM_MODULEID IN NUMBER,
PARAM_QUESTIONID OUT NUMBER
)
IS
BEGIN

SELECT QUESTIONID INTO PARAM_QUESTIONID FROM POLLQUESTIONS
WHERE MODULEID = PARAM_MODULEID;

EXCEPTION WHEN NO_DATA_FOUND THEN

PARAM_QUESTIONID := -1;

END;


And here's my function where I'm trying to use the Oracle SP above called GETCURRENTPOLLQUESTIONID.

Public Shared Function GetQuestionID(ByVal moduleId As Integer) As Integer

Dim myConnection As New OracleConnection(ConfigurationSettings.AppSettings("connectionString"))
Dim myCommand As New OracleCommand("GETCURRENTPOLLQUESTIONID", myConnection)

' Mark the Command as a SPROC
myCommand.CommandType = CommandType.StoredProcedure

' Add Parameters to SPROC
Dim parameterModuleId As New OracleParameter("PARAM_MODULEID", OracleType.Int32, 4)
parameterModuleId.Value = moduleId
myCommand.Parameters.Add(parameterModuleId)

Dim parameterQuestionId As New OracleParameter("PARAM_QUESTIONID", OracleType.Int32, 4)
parameterQuestionId.Direction = ParameterDirection.Output
myCommand.Parameters.Add(parameterQuestionId)

' Open the database connection and execute SQL Command
myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()

If parameterQuestionId.Value Is System.DBNull.Value Then
Return -1
Else
Return CInt(parameterQuestionId.Value)
End If

End Function

I appreciate any responses. :)

Trin

Srinivas_Sharma
07-10-2003, 09:31 AM
Hi,

Try to put the procedure inside a package

and call it using packagename.procedurename in ASP.NET

That should work i suppose,

Cheers

Srini

Trinity14
07-10-2003, 09:39 AM
Hey thanks so much Srinivas! That got rid of the error, sure enough.
Trin

Srinivas_Sharma
07-10-2003, 09:52 AM
No Problem

Srini