aspose file tools
The moose likes JDBC and the fly likes Stored procedures and arrays/lists Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Stored procedures and arrays/lists" Watch "Stored procedures and arrays/lists" New topic
Author

Stored procedures and arrays/lists

Kev D'Arcy
Ranch Hand

Joined: Jul 26, 2001
Posts: 75
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 26144
    
  66

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Kev D'Arcy
Ranch Hand

Joined: Jul 26, 2001
Posts: 75
Hi Jeanne

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

Kev
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26144
    
  66

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__"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Stored procedures and arrays/lists
 
Similar Threads
How Multimap Records of 1'st table to 2'nd one?
what are procedures in sql ?
JDBC for AS/400
Data Access Layer Best Practices
How to handle stored procedures