muito obrigado pela dica Rodrigo....mesmo sem saber muito eu vou
executar esse script e vou ver se entendo como ele trabalha...se eu
tiver alguma duvida a mais eu retorno a perguntar....
por enquanto muito obrigado
Rodrigo Hjort escreveu:
2007/5/13, Wallace Reis <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>>:
Em anexo uma funcao em plperlu. Vale lembrar que a versao 8.3 tera
isso nativamente.
Wallace, muito legal essa função em PL/PerlU!
Em anexo algumas alterações que eu fiz nela, para receber o nome do
esquema e um filtro para a seleção. Por sorte, fui testar a função e
existiam tabelas homônimas no meu banco. Daí resolvi inventar moda.
Ah, a sobrecarga com 1 e 2 parâmetros fica por conta de duas funções
em linguagem SQL.
rodrigo=# \d nova
Table "public.nova"
Column | Type | Modifiers
--------+-----------------------+-----------
id | integer | not null
nome | character varying(50) | not null
Indexes:
"nova_pkey" PRIMARY KEY, btree (id)
rodrigo=# SELECT * FROM nova;
id | nome
----+----------
1 | primeiro
2 | segundo
3 | terceiro
(3 rows)
rodrigo=# SELECT table_to_xml('public', 'nova', 'id = 2');
table_to_xml
-------------------------------------------------------------------------------------------------
<nova xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<row>
<id>2</id>
<nome>segundo</nome>
</row>
</nova>
(1 row)
rodrigo=# SELECT table_to_xml('public', 'nova');
table_to_xml
-------------------------------------------------------------------------------------------------
<nova xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
<http://www.w3.org/2001/XMLSchema-instance>">
<row>
<id>1</id>
<nome>primeiro</nome>
</row>
<row>
<id>2</id>
<nome>segundo</nome>
</row>
<row>
<id>3</id>
<nome>terceiro</nome>
</row>
</nova>
(1 row)
rodrigo=# SELECT table_to_xml('nova');
table_to_xml
-------------------------------------------------------------------------------------------------
<nova xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
<http://www.w3.org/2001/XMLSchema-instance>">
<row>
<id>1</id>
<nome>primeiro</nome>
</row>
<row>
<id>2</id>
<nome>segundo</nome>
</row>
<row>
<id>3</id>
<nome>terceiro</nome>
</row>
</nova>
(1 row)
--
Atenciosamente,
Rodrigo Hjort
Icewall Tecnologias
http://www.icewall.com.br
------------------------------------------------------------------------
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
_______________________________________________________
Yahoo! Mail - Sempre a melhor opção para você!
Experimente já e veja as novidades.
http://br.yahoo.com/mailbeta/tudonovo/
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral