Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

.Net ODP writing date null - ORA-01475 bind variable error

user640406Jun 6 2008 — edited Jun 9 2008
In the code below we are trying to write a date value followed by a date value of null in the same application session and receiving error ORA-1475. If date values are sent one after the other there is no error, and if the application is restarted and null values are sent repeatedly there is no error, only if a value is written then a null is written next. This is a VB.Net 2 framework solution using ODP client 10.102.2.20 to Oracle server. The problem also occurs writing date value/null in a similar stored procedure writing to a different table. Any suggestions?

Using connection As OracleConnection = New OracleConnection(_ConnectionString)
connection.Open()
command = New OracleCommand
With command
.Connection = connection
.CommandText = storedProcedure
.CommandType = CommandType.StoredProcedure
For columnId = 1 To parameterNames.Count
parameter = New OracleParameter
With parameter
.ParameterName = parameterNames.Item(columnId).ToString
.Value = dataRow.Item(columnNames(columnId).ToString)
End With
.Parameters.Add(parameter)
Next columnId
End With
rowsAffected = command.ExecuteNonQuery
connection.Close()
End Using

PROCEDURE pr_update
(
p_activity_log_id IN mrs_activity_log.activity_log_id%TYPE,
p_fund_code IN mrs_activity_log.fund_code%TYPE,
p_asset_class IN mrs_activity_log.asset_class%TYPE,
p_master_rule_name IN mrs_activity_log.master_rule_name%TYPE,
p_primary_rule_category IN mrs_activity_log.primary_rule_category%TYPE,
p_severity IN mrs_activity_log.severity%TYPE,
p_status_id IN mrs_activity_log.status_id%TYPE,
p_date_opened IN mrs_activity_log.date_opened%TYPE,
p_process_id IN mrs_activity_log.process_id%TYPE,
p_action_required IN mrs_activity_log.action_required%TYPE,
p_instruction IN mrs_activity_log.instruction%TYPE,
p_reviewed IN mrs_activity_log.reviewed%TYPE,
p_reviewed_comments IN mrs_activity_log.reviewed_comments%TYPE,
p_reviewed_by IN mrs_activity_log.reviewed_by%TYPE,
p_updated_by IN mrs_activity_log.updated_by%TYPE
)
AS
v_commit BOOLEAN := TRUE;
v_closed_date Date;
v_reviewed_date Date;
BEGIN
-- Set the value of the commit flag depending on whether procedure is executing within a transaction or not
IF DBMS_TRANSACTION.LOCAL_TRANSACTION_ID() IS NOT NULL THEN
v_commit := FALSE;
END IF;

UPDATE mrs_activity_log SET
fund_code = p_fund_code,
asset_class = p_asset_class,
master_rule_name = p_master_rule_name,
primary_rule_category = p_primary_rule_category,
severity = p_severity,
status_id = p_status_id,
date_opened = p_date_opened,
date_closed = v_closed_date,
process_id = p_process_id,
action_required = p_action_required,
instruction = p_instruction,
reviewed = p_reviewed,
reviewed_date = v_reviewed_date,
reviewed_comments = p_reviewed_comments,
reviewed_by = p_reviewed_by,
updated_by = p_updated_by,
updated_date = SYSDATE
WHERE activity_log_id = p_activity_log_id;

IF NOT SQL%FOUND THEN
RAISE NO_DATA_FOUND;
END IF;

IF v_commit = TRUE THEN
COMMIT;
END IF;

-- if this fails, rollback if necessary and reraise the error to the client
EXCEPTION
WHEN OTHERS THEN
IF v_commit = TRUE THEN
ROLLBACK;
END IF;
RAISE;

END;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 7 2008
Added on Jun 6 2008
2 comments
1,852 views