E aíd Diego, beleza?

Aí vai um exemplo.
Abraço,

Rudinei

The \set command sets a variable, and \unset removes a variable. To
access a variable you precede its name with a colon. The \set command
used alone lists all defined variables.

Figure  shows the use of psql variables.

        test=> \set num_var 4
        test=> SELECT :num_var;
         ?column?
        ----------
                4
        (1 row)

        test=> \set operation SELECT
        test=> :operation :num_var;
         ?column?
        ----------
                4
        (1 row)

        test=> \set str_var '\'My long string\''
        test=> \echo :str_var
        'My long string'
        test=> SELECT :str_var;
            ?column?
        ----------------
         My long string
        (1 row)

links:
http://www.postgresql.org/files/documentation/books/aw_pgsql/node143.html
http://www.faqs.org/docs/ppbook/x19832.htm

2009/3/18 Dickson S. Guedes <lis...@guedesoft.net>
>
> Em Qua, 2009-03-18 às 09:04 -0300, dmanci...@gmail.com escreveu:
> > Pessoal
> >
> > No Oracle(sqlplus) é possível o seguinte:
> >
> > select campo1, campo2
> > from tabela
> > where campo1 = &variavel;
> >
> > Sendo que ao encontrar &variavel, será aberto um prompt solicitando o
> > valor... existe algo parecido no psql?
>
> http://guedesoft.net/blog/2008/04/07/exemplo-de-um-script-sql-interativo-no-postgresql/
>
> --
> Dickson S. Guedes
> mail/xmpp: gue...@guedesoft.net - skype: guediz
> http://guedesoft.net - http://planeta.postgresql.org.br
>
> _______________________________________________
> pgbr-geral mailing list
> pgbr-geral@listas.postgresql.org.br
> https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
>
_______________________________________________
pgbr-geral mailing list
pgbr-geral@listas.postgresql.org.br
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a