Problem:
// Oracle Database Error Delete from where ORDERID=in(0,1,2,3,4,5,6,7 ..... 1001);
View Code
C # has written a way to solve
/// <summary> ///Stitching SQL/// </summary> /// <param name= "str" >Main SQL statement</param> /// <param name= "IDs" >parameters to stitch in inside</param> /// <param name= "Count" >number of bars per execution</param> /// <returns></returns> Public Static string Get(stringStrstring[] IDs) { if(IDs. Length >0) {StringBuilder sb=NewStringBuilder (); for(inti =0; I < IDs. Length; i++) { if((i% +) ==0&& i >0) {sb. Remove (sb.) Length-1,1); Sb. Append (") or"+ str +"In ("+ Ids[i] +","); } Else{sb. Append (Ids[i]+","); }} sb. Remove (sb.) Length-1,1); returnSTR +"In ("+ sb. ToString () +")"; } return ""; }
View Code
Call the following
Static voidMain (string[] args) { stringstr ="Delete from dd_order_detail where ORDERID ="; string[] s = { }; List<string> list =Newlist<string>(); for(inti =0; I <1001; i++) {list. ADD (i.ToString ()); } s=list. ToArray (); Console.WriteLine (s.length); stringSS =Get(str, s); Console.readkey (); }
View Code
The effect is as follows
C # Resolution database with in is greater than 1000 error problem