I have a client table, and a cpfClient field of type varchar.
The cpf is stored without a mask. Ex: "00751595170"
I would like to make a select that formats the result by putting the masks. "007.515.951.70"
I have a client table, and a cpfClient field of type varchar.
The cpf is stored without a mask. Ex: "00751595170"
I would like to make a select that formats the result by putting the masks. "007.515.951.70"
You can select parts of the SUBSTR
field and concatenate CONCAT
with the symbols to apply the formatting, eg:
SELECT
CONCAT (
SUBSTR('11111111122',1,3),'.',
SUBSTR('11111111122',4,3),'.',
SUBSTR('11111111122',7,3),'-',
SUBSTR('11111111122',10)) as cpf;