Doubt, concatenation of values

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc
  

Poston Thu, 04 Oct 2007 11:58 am

guys, help me with a logic here I want to display the Address of comrade, concatenating with the number of his residence, but there are cases that the ' ende_ds_logradouro ' and ' ende_ds_numero ' are null, so I don't want you to print only that comma, do, show the comma only if there is value in the fields?

SELECT ... ende_ds_logradouro || ', ' || ende_ds_numero the Backyard
Porva
Location: São Paulo/SP

Rafael S. Nunes
São Paulo/SP

Poston Thu, 04 Oct 2007 1:21 pm

Of Course!
Try it like this:
Code: Select all
SELECT... ende_ds_logradouro
|| decode( ende_ds_numero, null, null, ', ' )
|| ende_ds_numero AS Logradouro
:-
dr_gori
Location: Portland, OR USA

Thomas F. G

Você já respondeu a dúvida de alguém hoje?
http://glufke.net/oracle/search.php?search_id=unanswered

Poston Thu, 04 Oct 2007 1:32 pm

uia gori! funfou need to practice the DECODE and NLV.

Thanks man
Porva
Location: São Paulo/SP

Rafael S. Nunes
São Paulo/SP


  • See also
    Replies
    Views
    Last Post


    Return to SQL

    Who is online

    Users browsing this forum: No registered users and 2 guests