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

[INSERT]Return a value

From: Leví Teodoro da Silva <tlevisilva(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: [INSERT]Return a value
Date: 2008-11-07 13:21:05
Message-ID: 4a74ba520811070521v33680720x1ed4b061ff4eb2b8@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
Hi guys,

I was looking for something like the follow but i dont get ...

I want to do two inserts. In my first insert i want that the query returns a
result for me and in the second, i want that the postgres just insert the
values in my table.

I thought the following :

BEGIN;
INSERT INTO "Login"(
            "CPF", "password", status, "idSeller")
    VALUES ('108', '12345', 'ok', '2555') RETURNING "CPF" INTO STRICT teste;

INSERT INTO "Login"(
            "CPF", "password", status, "idSeller")
    VALUES ('109', '12345', 'ok', '2559');
COMMIT;

It's execute the inserts but i dont receive the CPF value. If i put the
first insert in a simple query, without BEGIN and COMMIT, it works fine.

How can i solve this problem !?


Regards,
Thanks,
Leví

Responses

pgsql-novice by date

Next:From: A. KretschmerDate: 2008-11-07 13:34:38
Subject: Re: [INSERT]Return a value
Previous:From: Leví Teodoro da SilvaDate: 2008-11-07 12:07:45
Subject: Re: [DUMP] Make a dump with special characters

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