• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

deleting multiple comma separated values in one attempt

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I want to delete few records from a table whose id's will be passed at run time i want this operation to be done at once
can i have a method to do so
delete from tablename where id /in = HERE I HAVE TO PASS , SEPARATED MULTIPLE VALUES using jdbc

Thanks
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"shanu",

We're a friendly bunch at the Ranch, but we require members to have real display names.

Please see your previous warning here.

We require display names to be two words: your first name, a space then your last name. Fictitious names are not allowed.

You can change your display your display name here.

thanks,
Dave.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Probably the easiest is to use a sql batch, since you can also use a PreparedStatement. Performance is typically very good (whatever that means)

or you can use

delete from my_table where table_id in (1, 2, 3, 4, etc);

If they are string values you will need single quotes:

delete from my_table where table_id in ('1', '2', '3', '4', etc);
reply
    Bookmark Topic Watch Topic
  • New Topic