Multiple Return Values?
Multiple Return Values?
От:
Steve_Miller@sil.org
Дата:
We are in the process of converting a SQL Server database to PostgreSQL. SQL Server stored procedures can have output parameters, as well as a return value. Postgres, as far as I can tell, doesn't have output parameters. Anybody have a good workaround for returning multiple values out of Postgres? Steve miller
Re: Multiple Return Values?
От:
Josh Berkus <josh@agliodbs.com>
Дата:
Steve, > We are in the process of converting a SQL Server database to PostgreSQL. > SQL Server stored procedures can have output parameters, as well as a > return value. Postgres, as far as I can tell, doesn't have output > parameters. Anybody have a good workaround for returning multiple values > out of Postgres? Yes. If you're using 7.3, then you can return your output values as a faux record, as many as you want. If you're running 7.2, then you can return stuff as a string with delimiters, and parse it on the client end. -- -Josh Berkus Aglio Database Solutions San Francisco
Re: Multiple Return Values?
От:
Steve_Miller@sil.org
Дата:
Josh, Thanks for the reply. I'd forgotten about the stuffing a string full of delimited values. It's been a loooong time since I've used that trick. We're using 7.3, though. I've heard about a table row. Is that what you're talking about? I was thinking that the solution might be to set up a temp table, which would have the desired structure and one row. The down side to that is the temp table has a disk presence (I've been told), rather than being in memory, which will slow down processing. Seems like it would be a bit messy to set up/clean up, too. Might almost be easier parsing that string of values. But maybe your faux record is something else. Steve Miller SIL International On 02/17/2003 06:00:29 PM Josh Berkus wrote: >Steve, > >> We are in the process of converting a SQL Server database to PostgreSQL. >> SQL Server stored procedures can have output parameters, as well as a >> return value. Postgres, as far as I can tell, doesn't have output >> parameters. Anybody have a good workaround for returning multiple values >> out of Postgres? > >Yes. If you're using 7.3, then you can return your output values as a faux >record, as many as you want. > >If you're running 7.2, then you can return stuff as a string with delimiters, >and parse it on the client end. > >-- >-Josh Berkus > Aglio Database Solutions > San Francisco >