Click here to Skip to main content
16,011,702 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to update oracle 11g db tables like
G_X_Table => groupid(fk),itemid(fk)
Group_Table => groupid(PK),groupName
Item_Table => itemid(PK),itemName

I need to write a stored procedure while updating(insert,delete).I have to pass one groupId and ItemId collection to procedure where insert G_X_Table with groupid and collection,those are not there in item collection those need to delete. Please help me to write procedure.

I need to call this Procedure through C# with oledb connection please anybody help me. I am very new with oracle..connection through c#.

my idea: delete form G_X_Table where groupid=input groupid and insert G_X_Table with new values. But I am confused what the type i need to accept item collection in procedure and what oledb type i need to pass as input parameter.

Thanks in advance..
Posted
Updated 30-Nov-13 11:17am
v3

for collection, my solution is loop insert/delete in C#.Currently, i haven't found any way to pass a array or collection from C# to oracle, if you found, welcome to share with me.
 
Share this answer
 
Comments
s#@!k 3-Dec-13 7:29am    
Thank you so much for your response. But if I need to update 100 records it is going to hit db 100 times form C# code ha.So I concatenated all int types separated by "|" and made it as string passing input parameter as oledbtype.varchar. I declared varchar2 in procedure as in parameter and in procedure updated by splitting as individual items. Please update any upcoming issues with this solution.
For Oracle using OLEDB, check this
How To Access an Oracle Database by Using the OLE DB .NET Data Provider and Visual C# .NET[^]
To send list to stored procedure, check this Tip/Trick(Though it's for SQL server but you could create same for Oracle too, try Google)
Using comma separated value parameter strings in SQL IN clauses[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900