Refer to a table by entering "" in Oracle number field

Asked

Viewed 32 times

2

This query needs to bring the address number field between ""

SELECT a.ds_endereco, 
       a.nr_endereco, 
       a.nm_bairro, 
       c.nm_cidade, 
       c.cd_uf, 
       a.nr_cep, 
       A.nr_fone, 
       a.nr_celular 
FROM   paciente A, 
       cidade c 
WHERE  a.cd_cidade = c.cd_cidade 
       AND a.tp_situacao = 'N' 
       AND a.cd_paciente <> 1 
ORDER  BY 1 

1 answer

3


SELECT a.ds_endereco,
       '"' || TO_CHAR(a.nr_endereco) || '"',
       a.nm_bairro,
       c.nm_cidade,
       c.cd_uf,
       a.nr_cep,
       A.nr_fone,
       a.nr_celular
FROM   paciente A,
       cidade c
WHERE  a.cd_cidade = c.cd_cidade
       AND a.tp_situacao = 'N'
       AND a.cd_paciente <> 1
ORDER  BY 1

|| Operator

The Oracle/PLSQL || Operator Allows you to concatenate 2 or more strings Together.

Or in free translation:

The operator || of Oracle/PLSQL allows you to concatene 2 or more strings together.


TO_CHAR

The Oracle/PLSQL TO_CHAR Function converts to number or date to string.

In free translation:

The function TO_CHAR of Oracle/PLSQL converts a number or date for a string.

  • I got it when I added two ||

Browser other questions tagged

You are not signed in. Login or sign up in order to post.