Consultor Eletrônico



Kbase P79597: How to convert a numeric field to character field in SQL-92?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/15/2008
Status: Verified

GOAL:

How to convert a numeric field to character field in SQL-92?

GOAL:

How to use TO_CHAR SQL92 function?

FIX:

To convert a numeric field to a character value in SQL-92 use the TO_CHAR scalar function or the CONVERT function:

SELECT TO_CHAR (CustNum) FROM PUB.Customer;

SELECT CONVERT('CHAR', CustNum) FROM PUB.Customer;

Note that the primary use of the TO_CHAR function is to format the output of
date-time expressions through the format_string argument as per the following
example:

SELECT TO_CHAR (OrderDate, 'DD/MM/YYYY') FROM PUB.Order;