Eu precisava fazer isso com o PG. Será que é possivel ?

CREATE DEFINER = 'root'@'localhost' PROCEDURE `importar`()
    NOT DETERMINISTIC
    CONTAINS SQL
    SQL SECURITY DEFINER
    COMMENT ''
begin
 declare done int default 0;
 declare l VARCHAR(500);
 DECLARE cur1 CURSOR for select reg from importacao;
 DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
 open cur1;
repeat
    FETCH cur1 into l;
    START TRANSACTION;
    insert into aux (reg) VALUES(l);
    if SUBSTR(l,4,1) = '9' THEN
       commit;
       CALL grava_trans;
       
    end if; 
 
until done end REPEAT;
 
 close cur1;
 
END;


junior Prado escreveu:
> Silfar,
>
> Corrigindo...
>
> O postgres não permite commit() e rollback dentro de procedure;
> Desculpe a informação errada...
>
> Att.
>
> Junior
>
> 2008/1/18, Silfar Goulart de Castro < [EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>>:
>
>     Junior muito obrigado.
>
>     Vou começar os testes aqui, mas pelol jeito acho que o postgresql vai
>     ser o escolhido.
>
>     Só mais uma coisa, eu costumo desenvolver com delphi, pegando o
>     valor do
>     generator antes de gravar, para fazer o master detail, e no fb quando
>     agente pega o valor do generator ele já atualiza o valor, tem como
>     fazer
>     isso no PG tb ?
>
>
>
>     junior Prado escreveu:
>     > Silfar,
>     >
>     > O postgres permite commit() e rollback dentro de procedure sim;
>     > O auto incremento é usado pelo tipo SERIAL.
>     > Conversor de dados http://icewall.org/~hjort
>     <http://icewall.org/%7Ehjort>
>     > <http://icewall.org/%7Ehjort/conv2pg
>     <http://icewall.org/%7Ehjort/conv2pg>>
>     >
>     >
>     > --
>     > Valter Cezar Prado Junior
>     > Analista TI
>     >
>     > Sem saber como fazer ele fez!
>     >
>     ------------------------------------------------------------------------
>     >
>     > _______________________________________________
>     > pgbr-geral mailing list
>     > [email protected]
>     <mailto:[email protected]>
>     > https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
>     >
>
>     _______________________________________________
>     pgbr-geral mailing list
>     [email protected]
>     <mailto:[email protected]>
>     https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
>
>
>
>
> -- 
> Valter Cezar Prado Junior
> Analista TI
>
> Sem saber como fazer ele fez!
> ------------------------------------------------------------------------
>
> _______________________________________________
> pgbr-geral mailing list
> [email protected]
> https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
>   

_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a