How to display the "degree" symbol?

Moderator: NorbertKrupa

Post Reply
User avatar
usli06
Intermediate
Intermediate
Posts: 93
Joined: Wed Jan 25, 2012 4:53 am

How to display the "degree" symbol?

Post by usli06 » Sat Jun 13, 2015 9:49 pm

How do I display the "degree" symbol in a vsql result set?

For example, like this for a temperature:

74°F

NorbertKrupa
GURU
GURU
Posts: 527
Joined: Tue Oct 22, 2013 9:36 pm
Location: Chicago, IL
Contact:

Re: How to display the "degree" symbol?

Post by NorbertKrupa » Sun Jun 14, 2015 3:40 am

This is typically done at the presentation layer; not the database layer.

Code: Select all

dbadmin=> SELECT '72' || CHR(176) || 'F';
 ?column?
----------
 72°F
(1 row)
Checkout vertica.tips for more Vertica resources.

User avatar
usli06
Intermediate
Intermediate
Posts: 93
Joined: Wed Jan 25, 2012 4:53 am

Re: How to display the "degree" symbol?

Post by usli06 » Tue Jun 16, 2015 3:01 am

This is typically done at the presentation layer; not the database layer.
Heh heh, I agree! But I'm trying to create some descriptive text to store in a table column, in that I want to store the degree symbol in the database column. The CHR(176) works perfect. Thanks!!!

NorbertKrupa
GURU
GURU
Posts: 527
Joined: Tue Oct 22, 2013 9:36 pm
Location: Chicago, IL
Contact:

Re: How to display the "degree" symbol?

Post by NorbertKrupa » Tue Jun 16, 2015 3:12 am

usli06 wrote:I want to store the degree symbol in the database column.
This is a bad idea. You won't be able to get optimized encoding. Store just the integer component, then do your formatting.
Checkout vertica.tips for more Vertica resources.

Post Reply

Return to “vSQL”