This discussion is archived
13 Replies Latest reply: Mar 4, 2013 1:57 AM by Marwim RSS

CHR() arrow symbol

Hani Explorer
Currently Being Moderated
Hi

I use oracle DB 11.2, i need chr() value that return arrow up and down symbol.
  • 1. Re: CHR() arrow symbol
    973181 Newbie
    Currently Being Moderated
    Hi,

    at psourg.org you find that procedure: http://psoug.org/snippet/Generate-ASCII-table_537.htm
    It generates an ASCII-table. I would try that.
    And you can modify it. For instance replace chr wir nchr or try a greater numberrange.
    But I think, you will not find an arrow.

    regards,
    Marco
  • 2. Re: CHR() arrow symbol
    stefan nebesnak Journeyer
    Currently Being Moderated
    Hani wrote:
    Hi

    I use oracle DB 11.2, i need chr() value that return arrow up and down symbol.
    The <font style="background-color: #E7FA6B">ASCII</font> function returns the NUMBER code that represents the specified character:
    SQL> select ASCII('↑') from dual;
    
    ASCII('↑')
    ----------
            24
    
    SQL> select ASCII('↓') from dual;
    
    ASCII('↓')
    ----------
            25
    
    SQL>
    SQL> select ASCII('▲') from dual;
    
    ASCII('▲')
    ----------
            30
    
    SQL> select ASCII('▼') from dual;
    
    ASCII('▼')
    ----------
            31
    The <font style="background-color: #E7FA6B">CHR</font> function is the opposite of the ascii function. It returns the character based on the NUMBER code.
    SQL> select chr(24) from dual;
    
    C
    -
    ↑
    
    SQL> select chr(25) from dual;
    
    C
    -
    ↓
    
    SQL> select chr(30) from dual;
    
    C
    -
    ▲
    
    SQL> select chr(31) from dual;
    
    C
    -
    ▼
    You can also try the <font style="background-color: #E7FA6B">UNISTR</font> function.
  • 3. Re: CHR() arrow symbol
    Hani Explorer
    Currently Being Moderated
    I try it before but the result for select chr(31) from dual; return null
  • 4. Re: CHR() arrow symbol
    stefan nebesnak Journeyer
    Currently Being Moderated
    It depends on the used character set.
  • 5. Re: CHR() arrow symbol
    Hani Explorer
    Currently Being Moderated
    I USE
    select convert( chr(30) , 'UTF8')
    from dual
    but it still null, so what character set must use?
  • 6. Re: CHR() arrow symbol
    584412 Journeyer
    Currently Being Moderated
    Hani wrote:
    I try it before but the result for select chr(31) from dual; return null
    This is very unlikely. It might return a character that your output system will not print, but it doesn't return a null.
    What does select NVL(chr(31),'aha') from dual; return?
  • 7. Re: CHR() arrow symbol
    Manik Expert
    Currently Being Moderated
    Hani wrote:
    I USE
    select convert( chr(30) , 'UTF8')
    from dual
    but it still null, so what character set must use?
    No its not null. It is just that your editor is unable to print it.
    my oracle version 11g r2.

    Checked in SQLPLUS:
    SQL> select convert( chr(30) , 'UTF8')
      2  from dual;
    
    C
    -
    ▲
    Cheers,
    Manik.
  • 8. Re: CHR() arrow symbol
    Hani Explorer
    Currently Being Moderated
    Thanks for response

    I try sqlplus but it same, no any character appear , i put nvl which tell me that its not null, but its also not appear any char
  • 9. Re: CHR() arrow symbol
    sb92075 Guru
    Currently Being Moderated
    Hani wrote:
    Thanks for response

    I try sqlplus but it same, no any character appear , i put nvl which tell me that its not null, but its also not appear any char
    ASCII character set does NOT contain any "arrow" character.
  • 10. Re: CHR() arrow symbol
    Nitesh. Explorer
    Currently Being Moderated
    .
  • 11. Re: CHR() arrow symbol
    BluShadow Guru Moderator
    Currently Being Moderated
    Hani wrote:
    Thanks for response

    I try sqlplus but it same, no any character appear , i put nvl which tell me that its not null, but its also not appear any char
    What character set is your database using?
  • 12. Re: CHR() arrow symbol
    chris227 Guru
    Currently Being Moderated
    You may try
    select
     unistr('\2190')
    ,unistr('\2191')
    ,unistr('\2192')
    ,unistr('\2193')
    from dual
    
    UNISTR('\2190')     UNISTR('\2191')     UNISTR('\2192')     UNISTR('\2193')
    "←"     "↑"     "→"     "↓"
  • 13. Re: CHR() arrow symbol
    Marwim Expert
    Currently Being Moderated
    Hello,

    what you get also depends on the NLS_LANG setting of your client. SQL*PLUS will only display characters that are available in the codepage defined by the client NLS_LANG parameter.
    There are several postings about this problem
    {message:id=876360}
    {message:id=2183873}
    {message:id=366997}

    Though even when the codepage ist set correctly the font used in your console has to support unicode characters.

    Regards
    Marcus

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points