- 3,715,958 Users
- 2,242,917 Discussions
- 7,845,703 Comments
Forum Stats
Discussions
Categories
- 17 Data
- 362.2K Big Data Appliance
- 7 Data Science
- 1.6K Databases
- 475 General Database Discussions
- 3.7K Java and JavaScript in the Database
- 22 Multilingual Engine
- 487 MySQL Community Space
- 5 NoSQL Database
- 7.6K Oracle Database Express Edition (XE)
- 2.8K ORDS, SODA & JSON in the Database
- 417 SQLcl
- 42 SQL Developer Data Modeler
- 184.9K SQL & PL/SQL
- 21K SQL Developer
- 1.9K Development
- 3 Developer Projects
- 32 Programming Languages
- 135.1K Development Tools
- 9 DevOps
- 3K QA/Testing
- 256 Java
- 6 Java Learning Subscription
- 10 Database Connectivity
- 67 Java Community Process
- 1 Java 25
- 9 Java APIs
- 141.1K Java Development Tools
- 6 Java EE (Java Enterprise Edition)
- 153K Java Essentials
- 135 Java 8 Questions
- 86.2K Java Programming
- 270 Java Lambda MOOC
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 10 Java SE
- 13.8K Java Security
- 3 Java User Groups
- 22 JavaScript - Nashorn
- 18 Programs
- 125 LiveLabs
- 30 Workshops
- 9 Software
- 3 Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 3 Deutsche Oracle Community
- 11 Español
- 1.9K Japanese
- 2 Portuguese
Unhandled execution error / ASP.Net
Any ideas as to what's causing the following error:
---
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Oracle.DataAccess.Client.OraException:
/---
I'm simply calling an Oracle function which returns a date. Code snippet:
---
FUNCTION func_get_session_date(v_session_id VARCHAR2, v_session_key VARCHAR2) RETURN DATE IS
...etc
/---
...employing the OraDataReader to extract the value (unnecessary code extracted for clarity):
---
DateTime returnDateTime;
string commandText = "SELECT pkg_css_session_state.func_get_session_date(:v_session_id, :v_session_key) FROM dual";
//string commandText = "SELECT pkg_css_session_state.func_get_session_date('" + this.AspxSessionID + "', '" + sessionKey + "') FROM dual";
OraConnection oraConnection = new OraConnection(connectionString);
OraCommand oraCommand = new OraCommand();
oraCommand.Connection = oraConnection;
oraCommand.CommandText = commandText;
OraParameter oraParmSessionID = new OraParameter();
oraParmSessionID.ParameterName = "v_session_id";
oraParmSessionID.OraDbType = OraDbType.Varchar2;
oraParmSessionID.Value = this.AspxSessionID;
oraParmSessionID.Direction = ParameterDirection.Input;
oraCommand.Parameters.Add(oraParmSessionID);
OraParameter oraParmSessionKey = new OraParameter();
oraParmSessionKey.ParameterName = "v_session_key";
oraParmSessionKey.OraDbType = OraDbType.Varchar2;
oraParmSessionKey.Value = sessionKey;
oraParmSessionKey.Direction = ParameterDirection.Input;
oraCommand.Parameters.Add(oraParmSessionKey);
oraConnection.Open();
OraDataReader oraDataReader = oraCommand.ExecuteReader(CommandBehavior.CloseConnection);
if (oraDataReader.Read())
{
if (! oraDataReader.IsDBNull(0))
{
returnDateTime = oraDataReader.GetDateTime(0);
}
}
/--
Interestingly, it works fine when I don't use input parameters (see commented-out commandText string).
Thanks ahead o' time!
---
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Oracle.DataAccess.Client.OraException:
/---
I'm simply calling an Oracle function which returns a date. Code snippet:
---
FUNCTION func_get_session_date(v_session_id VARCHAR2, v_session_key VARCHAR2) RETURN DATE IS
...etc
/---
...employing the OraDataReader to extract the value (unnecessary code extracted for clarity):
---
DateTime returnDateTime;
string commandText = "SELECT pkg_css_session_state.func_get_session_date(:v_session_id, :v_session_key) FROM dual";
//string commandText = "SELECT pkg_css_session_state.func_get_session_date('" + this.AspxSessionID + "', '" + sessionKey + "') FROM dual";
OraConnection oraConnection = new OraConnection(connectionString);
OraCommand oraCommand = new OraCommand();
oraCommand.Connection = oraConnection;
oraCommand.CommandText = commandText;
OraParameter oraParmSessionID = new OraParameter();
oraParmSessionID.ParameterName = "v_session_id";
oraParmSessionID.OraDbType = OraDbType.Varchar2;
oraParmSessionID.Value = this.AspxSessionID;
oraParmSessionID.Direction = ParameterDirection.Input;
oraCommand.Parameters.Add(oraParmSessionID);
OraParameter oraParmSessionKey = new OraParameter();
oraParmSessionKey.ParameterName = "v_session_key";
oraParmSessionKey.OraDbType = OraDbType.Varchar2;
oraParmSessionKey.Value = sessionKey;
oraParmSessionKey.Direction = ParameterDirection.Input;
oraCommand.Parameters.Add(oraParmSessionKey);
oraConnection.Open();
OraDataReader oraDataReader = oraCommand.ExecuteReader(CommandBehavior.CloseConnection);
if (oraDataReader.Read())
{
if (! oraDataReader.IsDBNull(0))
{
returnDateTime = oraDataReader.GetDateTime(0);
}
}
/--
Interestingly, it works fine when I don't use input parameters (see commented-out commandText string).
Thanks ahead o' time!
Comments
-
Try adding a parameter 0 before your oraParmSessionID parameter. That will give the function someplace to return its result.
OraParameter oraReturn = new OraParameter();
oraReturn.ParameterName = "justaboutanything";
oraReturn.OraDbType = OraDbType.Date;
oraReturn.Direction = ParameterDirection.ReturnValue;
oraCommand.Parameters.Add(oraReturn );Any ideas as to what's causing the following error:
---
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Oracle.DataAccess.Client.OraException:
/---
I'm simply calling an Oracle function which returns a date. Code snippet:
---
FUNCTION func_get_session_date(v_session_id VARCHAR2, v_session_key VARCHAR2) RETURN DATE IS
...etc
/---
...employing the OraDataReader to extract the value (unnecessary code extracted for clarity):
---
DateTime returnDateTime;
string commandText = "SELECT pkg_css_session_state.func_get_session_date(:v_session_id, :v_session_key) FROM dual";
//string commandText = "SELECT pkg_css_session_state.func_get_session_date('" + this.AspxSessionID + "', '" + sessionKey + "') FROM dual";
OraConnection oraConnection = new OraConnection(connectionString);
OraCommand oraCommand = new OraCommand();
oraCommand.Connection = oraConnection;
oraCommand.CommandText = commandText;
OraParameter oraParmSessionID = new OraParameter();
oraParmSessionID.ParameterName = "v_session_id";
oraParmSessionID.OraDbType = OraDbType.Varchar2;
oraParmSessionID.Value = this.AspxSessionID;
oraParmSessionID.Direction = ParameterDirection.Input;
oraCommand.Parameters.Add(oraParmSessionID);
OraParameter oraParmSessionKey = new OraParameter();
oraParmSessionKey.ParameterName = "v_session_key";
oraParmSessionKey.OraDbType = OraDbType.Varchar2;
oraParmSessionKey.Value = sessionKey;
oraParmSessionKey.Direction = ParameterDirection.Input;
oraCommand.Parameters.Add(oraParmSessionKey);
oraConnection.Open();
OraDataReader oraDataReader = oraCommand.ExecuteReader(CommandBehavior.CloseConnection);
if (oraDataReader.Read())
{
if (! oraDataReader.IsDBNull(0))
{
returnDateTime = oraDataReader.GetDateTime(0);
}
}
/--
Interestingly, it works fine when I don't use input parameters (see commented-out commandText string).
Thanks ahead o' time!
This discussion has been closed.