Em 11/01/11, Cesar Pedroso<cesar.cs...@gmail.com> escreveu:
> Boa tarde,
>
> Gostaria de saber como usar uma variavel dentro de uma FUNCTION.
>
> Vou criar uma sequence com o maior valor da tabela mas se o valor for menor
> que 100000 cria como 100000.
>
> Ex.
>
> select max(id) into variavel from tabela;
> if variavel < 100000 the
>   create sequence teste start 100000;
> else
>   create sequence teste start variavel;
> end if;
>


Na PL/pgSQL veja o comando EXECUTE:
http://www.postgresql.org/docs/current/interactive/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN

Osvaldo
_______________________________________________
pgbr-geral mailing list
pgbr-geral@listas.postgresql.org.br
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a