Re: return value from SQL statement

From: "Alain Roger" <raf(dot)news(at)gmail(dot)com>
To: "Craig Ringer" <craig(at)postnewspapers(dot)com(dot)au>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: return value from SQL statement
Date: 2008-03-25 15:38:04
Message-ID: 75645bbb0803250838u2c1e17a0i99aaa96e549a46c0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

under pl/pgsql language i would like to return a function value.
e.g :
0 is everything is completed
-1 if searched data already exist into table
-2 if insert into failed
...

later i would like to use this returned value in my PHP (this i know how to
do)
is it clearer ?
A.

On Tue, Mar 25, 2008 at 3:02 PM, Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
wrote:

> Alain Roger wrote:
> > Hi,
> >
> > i have a 'insert into' statement and i would like to know if it fails or
> > not.
> > i was thinking to check the resturn value from this statement, but how
> to do
> > it ?
> >
> >
> The answer depends entirely on how you're using the database.
>
> ODBC?
>
> JDBC?
>
> Perl DBD?
>
> Python with psycopg?
>
> SQL code read by the psql command?
>
> Also, by "failure", do you mean "encountered an error that terminated
> the transaction" or "inserted zero rows" ?
>
> --
> Craig Ringer
>

--
Alain
------------------------------------
Windows XP SP2
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ivan Sergio Borgonovo 2008-03-25 15:57:12 Re: return value from SQL statement
Previous Message Roberts, Jon 2008-03-25 15:35:45 Re: How to sort strings containing a dot?