Skip site navigation (1) Skip section navigation (2)

Re: SQL-Invoked Procedures for 8.1

From: Grant Finnemore <grantf(at)guruhut(dot)co(dot)za>
To: Magnus Hagander <mha(at)sollentuna(dot)net>
Cc: Gavin Sherry <swm(at)linuxworld(dot)com(dot)au>,pgsql-hackers(at)postgresql(dot)org
Subject: Re: SQL-Invoked Procedures for 8.1
Date: 2004-09-23 08:34:12
Message-ID: 41528A84.4080102@guruhut.co.za (view raw or flat)
Thread:
Lists: pgsql-hackers
Hi Magnus,

Yes, this is the situation that I have been thinking about. Specifically
when a single stored procedure returns many recordsets.

Perhaps I should also clarify that the "spec" I have been using is
the JDK javadoc documentation.

Using java with Magnus' procedure:
   CallableStatement cs = connection.prepareCall("call get_info_for_user ?");
   cs.setString(1, "test");
   if(cs.execute()) {
      ResultSet rs = cs.getResultSet();
      while(rs != null) {
        // Process rs
      }
   }

Regards,
Grant

Magnus Hagander wrote:
[snip]
> 
> Not a user of JDBC, but this is fairly common in the ADO/ADO.NET world
> with MS SQL Server as well (not sure about other dbs and .NET - I'ev
> only used it with mssql and pgsql)... As for an example, something along
> the line of (though in my cases usually with a *lot* more parameters):
> 
> --
> CREATE PROCEDURE get_info_for_user(@userid varchar(16)) AS
>  SELECT something FROM contentstable WHERE userid=(at)userid
> 
>  SELECT whatever,somethingelse FROM anothertable WHERE
> something=anything
> --
> 
> You get the point :-)
> Then in my .net code I'd do a simple:
> SqlDataReader rdr = cmd.ExecuteReader();
> ... process first result ...
> rdr.NextResult();
> ... process second result...
> 

In response to

Responses

pgsql-hackers by date

Next:From: Gavin SherryDate: 2004-09-23 08:47:45
Subject: Re: SQL-Invoked Procedures for 8.1
Previous:From: Oliver JowettDate: 2004-09-23 08:17:46
Subject: Re: SQL-Invoked Procedures for 8.1

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group