Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stored procedures and arrays/lists

 
Kev D'Arcy
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

This isn't strictly speaking a Java issue, but I'm writing an application
using stored procedures to access a SQL Server database, and I have a
situation where I need to add multiple rows to a table (it's coming from a
multi-select list box). I'm wondering is there any other way of doing it other
that repeatedly calling the same stored proc to add them one at a time. Since
the values from the multi-select are part of a record, I'd like to be able to
insert/update the record in one go, rather than having to break it up into
multiple steps and then having to write a back-out procedure should any of
the steps fail.

Thanks for you help,

Kev
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kev,
You could write a stored proc that takes a list. Or you could make the calls to all the stored procs part of a single transaction so it commits/rollsback together.
 
Kev D'Arcy
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeanne

How do I write a stored proc that takes a list?

Kev
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kev D'Arcy:
Hi Jeanne

How do I write a stored proc that takes a list?

Kev

Looking for it on the internet, it seems I was using a database specific feature. (This was a number of years ago.) Your best bet would be searching for "array stored procedure __your_db_name__"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic