I'm new to c# and .Net and i need your help .
I've create a procedure in the DB that accepts table value parameter ( list of id's ) , and i'm looking the appropriate equivalent for an Oracle Associative Array .
--New Data Type in the DB:
CREATE TYPE IDType AS TABLE
(
ID bigint
)
GO
-- DB Procedure
Create procedure TVP_PROC (@ID IDType readonly)
Declare @TVP IDType
Insert into @TVP select ID from @ID
As
Update my_tbl set id=(select ID from @TVP)
it should run like this : exec TVP_PROC @ID //@ID is alist of id's
.Net Code :
Public void UpdateID (List long<long> IDS )
{
Datatable datatable = new datatable ();
Datatable.columns.add (“IDS”,typeof(int64));
Foreach (int64 id in IDS)
{
Datatable.Rows.Add(id);
}
}
Var Query =hibernate.createsqlquery(“Exec TVP_PROC @ID:IDS”);
Query. ?????????
Questions :
is there any preferred way to write it except using datatable variable and assigning the ids every iteration?
More important , what is the appropriate way to assign the table\list variable ? is there any table value \ array variable which can be define to this kind of datatype ?