Can anyone help me figure out what's going wrong here?
Here's the database configuration: Connected to Oracle Database 12c Enterprise Edition Release 12.1.0.2.0
Code: Select all
drop table lv_testing.test_details;
drop table lv_testing.test_batches;
create table lv_testing.test_batches (
batch_id varchar2(36) --primary key
);
create table lv_testing.test_details (
detail_id varchar2(36), --primary key,
batch_id varchar2(36), --references lv_testing.test_batches(batch_id),
detail varchar2(240)
);
create or replace procedure lv_testing.write_detail (
in_batch_id in varchar2,
in_detail_id in varchar2,
in_detail in varchar2
) is
begin
-- Ensure batch header exists.
insert into lv_testing.test_batches (
batch_id
)
select in_batch_id
from dual
left join lv_testing.test_batches b
on b.batch_id = in_batch_id
where b.batch_id is null
;
insert into lv_testing.test_details (
detail_id,
batch_id,
detail
)
values (
in_detail_id,
in_batch_id,
in_detail
)
;
end;
/
Code: Select all
public void Devart_Works()
{
var connection = new OracleConnection($"user id = {User}; password = {Password}; data source = {DataSource}; Enlist = false")
{
Unicode = false,
PassParametersByName = true,
};
connection.Open();
var transaction = connection.BeginTransaction();
try
{
var command = new OracleCommand("LV_TESTING.WRITE_DETAIL", CommandType.StoredProcedure)
{
Connection = connection,
PassParametersByName = true,
};
command.Parameters.Add(new OracleParameter("IN_BATCH_ID", BatchId));
command.Parameters.Add(new OracleParameter("IN_DETAIL_ID", AlphaId));
command.Parameters.Add(new OracleParameter("IN_DETAIL", "Alpha"));
command.ExecuteNonQuery();
command = new OracleCommand("LV_TESTING.WRITE_DETAIL", CommandType.StoredProcedure)
{
Connection = connection,
PassParametersByName = true,
};
command.Parameters.Add(new OracleParameter("IN_BATCH_ID", Enumerable.Repeat(BatchId, 2).ToArray()));
command.Parameters.Add(new OracleParameter("IN_DETAIL_ID", new string[] { BetaId1, BetaId2, }));
command.Parameters.Add(new OracleParameter("IN_DETAIL", new string[] { "Beta One", "Beta Two", }));
command.ExecuteArray(2);
transaction.Commit();
}
catch (Exception ex)
{
transaction.Rollback();
throw ex;
}
finally
{
connection.Close();
}
}