Search Postgresql Archives

Re: return value from SQL statement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxxx> 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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux