I'm using an ExecuteOracleNonQuery in C# to INSERT a record into my Oracle database using a stored procedure but can't seem to get the ROWID to return.
In C# ...
using (OracleConnection oc=
new OracleConnection(AppConfiguration.ConnectionString))
{
OracleCommand myCommand = new OracleCommand("PKG_TEST.INSERT", oc);
myCommand.CommandType = CommandType.StoredProcedure;
myCommand.Parameters.AddWithValue("p_Id", allAssets.Id);
myCommand.Parameters.AddWithValue("p_Description", allAssets.Description);
OracleString rowId;
try
{
myConnection.Open();
result = myCommand.ExecuteOracleNonQuery(out rowId);
allAssets.RowId = rowId.ToString();
}
catch(System.Exception ex)
{
Console.WriteLine(ex.StackTrace);
}
finally
{
myConnection.Close();
}
}
return result;
Procedure in Oracle package ...
PROCEDURE insert (
p_id IN ALL_ASSETS.id%TYPE,
p_description IN ALL_ASSETS.description%TYPE
)
IS
BEGIN
INSERT INTO ALL_ASSETS
(id, description)
VALUES (p_id, p_description);
END insert;
Can anyone shed any light on how the ROWID is returned, please?
EDIT - I've now changed the code to be as above but still no ROWID return. Also, only one record is being inserted.
Thanks.