How to select the records of a high box table in postgres?

Asked

Viewed 640 times

0

I need to select all records from a table where the letters of a given column are in the upper case (Uppercase).
Is there a function that does the case/minuscule differentiation in POSTGRES?
Here is the picture of my table:
inserir a descrição da imagem aqui

The column numero_fci has several records as alphanumeric characters, however, some records are in low (lowercase) and in a SELECT i would like to return only those who are in high box.
How should I proceed?
Already I thank you!

  • not for nothing, but you’re using the wrong kind, you’re storing a UUID using character(36)

  • And what would be the right way?

  • I would advise you to use the type UUID, as for formatting, leave this to the application (C#, Java, NodeJS, PHP, Ruby, etc has support for GUID/UUID), but if you need to display the UUID as text with capital letters in the Database, do: upper(numero_fci::TEXT)

  • Okay @Tobiasmesquita, thanks for the tip!

  • An observation regarding the field type character(36), is agent we do not generate this code but the recipe. Agent only stores the return information that the IRS gives us. So the kind of field in our bank is correct.

1 answer

0


Selects all records that are different when you play them in a Lower function. Example:

SELECT * FROM tabela WHERE LOWER(numero_fci) != numero_fci
  • Thank you @Rovann Linhalis, it didn’t work out the way you mentioned more you can help me get the solution. SELECT * FROM fci_item WHERE UPPER(numero_fci) in( select numero_fci from fci_item );

  • blz, but I don’t think you need that subselect

Browser other questions tagged

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