Search Postgresql Archives

Re: i need you help about postgresql(rollback)

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

 



On 7/13/05, Nee.Mem(倪明) <accp@xxxxxxxxx> wrote:> systemguards,hi!> i see you wrote on this page> http://archives.postgresql.org/pgsql-general/2005-07/msg00319.php> > test exsample:>        create or replace function test()>        returns void as>        '>        begin>                delete from regiondata;>                rollback;>        end;>        'language 'plpgsql';> but exception a error:    CONTEXT:  PL/pgSQL function "test" line 3 at SQL statement> Use others' words :> >It is important not to confuse the use of BEGIN/END for grouping statements> > in PL/pgSQL with the database commands for transaction control. PL/pgSQL's> > BEGIN/END are only for grouping; they do not start or end a transaction> and can you tell me how to use rollback work in 'pgsql' function?  and give me a exsample?> 
As Alvaro told you can write ROLLBACK... if you are using pgsql 8.x.xthen you can use exceptions... Alvaro gives you the examples... When astatement gives an error, it will go to the exception an allstatements in the block will be rolled back.
If you are using pgsql 7.x.x or lower... you will get an error an allyour transaction will be rolled back

-- regards,Jaime Casanova(DBA: DataBase Aniquilator ;)
---------------------------(end of broadcast)---------------------------TIP 3: Have you checked our extensive FAQ?
               http://www.postgresql.org/docs/faq

[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