Discussions
Categories
- 17.9K All Categories
- 3.4K Industry Applications
- 3.3K Intelligent Advisor
- 63 Insurance
- 536.4K On-Premises Infrastructure
- 138.3K Analytics Software
- 38.6K Application Development Software
- 5.8K Cloud Platform
- 109.5K Database Software
- 17.5K Enterprise Manager
- 8.8K Hardware
- 71.1K Infrastructure Software
- 105.3K Integration
- 41.6K Security Software
Print Extended ASCII Codes in sql*plus

SANCHITGUPTA
Member Posts: 123
how to print Extended ASCII Codes in sql*plus like if we use
select chr(65)||chr(66)||chr(125) from dual; then output will be
Ab}
but if we use chr(127), chr(128) and so on then its do not print the correct result
So please tell how we can get correct result in sql*plus
Edited by: 922951 on Mar 23, 2012 2:26 AM
select chr(65)||chr(66)||chr(125) from dual; then output will be
Ab}
but if we use chr(127), chr(128) and so on then its do not print the correct result
So please tell how we can get correct result in sql*plus
Edited by: 922951 on Mar 23, 2012 2:26 AM
Answers
-
Pl post details of OS and database versions.
Pl define what you mean by "correct result".
CHR(127) is the 'delete' character (http://www.ascii-code.com/) - how do you plan to "output" or "print" it ?
Pl post (using copy and paste) what you see when you execute your code. What exactly are you trying to achieve ?
HTH
Srini -
There is really no such thing as extended ASCII codes.
Computers use character set encodings to represent text data as bytes. On so-called ASCII platforms, most of these encodings (but not all), represent basic ASCII characters the same way as the ASCII standard does, i.e. as bytes (most precisely: octets) in the range 0-127, and use other possible byte values (128-255) to represent other characters. Depending on the encoding, one or more of these bytes may be used per character. There are encodings (East Asian) where a byte in the ASCII range may actually be a second byte of a multibyte character. Certain encodings, most notably UTF-16, use more than one byte for any character and, therefore, are not a binary superset of ASCII at all. Moreover, the code unit of UTF-16 is not byte (octet) but a 16-bit word ('ub2' in Oracle's C data type naming).
Therefore, please rephrase your question and tell us what you really try to achieve.
And do not post the same question twice in two threads!
-- Sergiusz -
In addition to what you have been asked to reveal above, please also provide:
- version of Oracle Client and sql*plus if different from database server home
- details of client environment from which sql*plus is run (even if it runs on the server host)
- database character set. If it is a Utf-8 variant, CHR() might not work as you expect for input values > 127. -
os is window xp
version is oracle 10g 10.2.0.1.0
want correct symbol in sql*plus which is given in this sidehttp://www.asciitable.com/ specially for Extended ASCII Codes..
if i use through cmd then its print but in sql*plus its not getting print
Thanx in advance -
The mentioned web page uses some very outdated terminology from 1980-ties. The "Extended ASCII Codes", as they call it, are the upper codes of the MS-DOS (aka OEM) code page 437. There are many other OEM code pages available in Windows, where these codes are defined differently. Anyway, if you run SQL*Plus from Command Prompt, do this:
C:\> set NLS_LANG=AMERICAN_AMERICA.US8PC437 C:\> sqlplus ...
Assuming your database character set supports the particular characters your are interested in, this should help. You can check your database character set by running:SELECT value FROM nls_database_parameters WHERE parameter='NLS_CHARACTERSET';
What is the result of this query in your database?
-- Sergiusz
This discussion has been closed.