stored function, multiple queries, best practices

From: Ash Grove <ash_grv7(at)yahoo(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: stored function, multiple queries, best practices
Date: 2006-04-14 12:48:34
Message-ID: 20060414124834.63095.qmail@web52501.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hello,

I'd like to learn how other people approach this kind
of situation:

Say you want to do an insert on three tables and all
of your data is coming into the db from your
application. You do the first insert and a primary key
is generated. You grab that primary key and insert it
(along with some other data) into the two other
tables. Finally, you return the primary key to the
application. If something goes wrong, you want to
everything to rollback.

I currently do this by building a delimited string in
the application containing all data to be inserted and
then sending it, via callablestatement, to a stored
function. The function parses the string, does the
inserts and returns the primary key via a registered
out parameter.

Are there glaring errors with this approach? How would
you do this?

Thanks in advance,
Ash

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2006-04-14 14:18:58 Re: stored function, multiple queries, best practices
Previous Message Achilleus Mantzios 2006-04-14 11:27:41 Re: Kernel 2.4->2.6 upgrade results in PANIC: could not locate a