Home » SQL & PL/SQL » SQL & PL/SQL » Exended Ascii to Character (Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production)
Exended Ascii to Character [message #490796] Thu, 27 January 2011 07:10 Go to next message
gp185007
Messages: 45
Registered: April 2005
Location: Mumbai
Member
Hi,

I have requirement to convert the extended ascii to character.
Is there any function available .

Thanks in advance.

Thanks and Regards,
Ganesh.
Re: Exended Ascii to Character [message #490798 is a reply to message #490796] Thu, 27 January 2011 07:28 Go to previous messageGo to next message
cookiemonster
Messages: 13967
Registered: September 2008
Location: Rainy Manchester
Senior Member
Is this what you mean?
SQL> select chr(231) from dual;

C
-
ç

SQL> 
Re: Exended Ascii to Character [message #490820 is a reply to message #490796] Thu, 27 January 2011 10:05 Go to previous messageGo to next message
Michel Cadot
Messages: 68765
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
You have to ask yourself convert to which character?
There is a standard function CONVERT to convert from one character set to another one. Take great care of the example.

Regards
Michel
Re: Exended Ascii to Character [message #490878 is a reply to message #490796] Thu, 27 January 2011 23:36 Go to previous messageGo to next message
gp185007
Messages: 45
Registered: April 2005
Location: Mumbai
Member
Hi,

I tried using CHR function, however it works fine for ascii characters from 0 --127.

For Extended ascii characters output does not match with Extended Ascii character set. (Pls refer to attached file).


Regards,
Ganesh
Re: Exended Ascii to Character [message #490884 is a reply to message #490878] Fri, 28 January 2011 00:37 Go to previous messageGo to next message
Frank
Messages: 7901
Registered: March 2000
Senior Member
Above 127, the actual character linked to an "ASCII" value depends on the used character set.
Re: Exended Ascii to Character [message #490886 is a reply to message #490878] Fri, 28 January 2011 00:55 Go to previous messageGo to next message
Michel Cadot
Messages: 68765
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
gp185007 wrote on Fri, 28 January 2011 06:36
Hi,

I tried using CHR function, however it works fine for ascii characters from 0 --127.

For Extended ascii characters output does not match with Extended Ascii character set. (Pls refer to attached file).


Regards,
Ganesh

And did you try CONVERT function as I said?
Did you answer this question "You have to ask yourself convert to which character?"?

Regards
Michel

Re: Exended Ascii to Character [message #490902 is a reply to message #490886] Fri, 28 January 2011 02:17 Go to previous messageGo to next message
gp185007
Messages: 45
Registered: April 2005
Location: Mumbai
Member
Yes,

I tried using the below character set convert function.

Character Set Description
US7ASCII US 7-bit ASCII character set
WE8DEC West European 8-bit character set
WE8HP HP West European Laserjet 8-bit character set
F7DEC DEC French 7-bit character set
WE8EBCDIC500 IBM West European EBCDIC Code Page 500
WE8PC850 IBM PC Code Page 850
WE8ISO8859P1 ISO 8859-1 West European 8-bit character set

However, I tried to use convert function as below but unable to get the corresponding ascii value of 207.

E.g
select convert('╩', 'WE8ISO8859P1','US7ASCII' ) from dual;
I tried with all combinations.

Any help highly appreciated.

Regards,
Ganesh
Re: Exended Ascii to Character [message #490905 is a reply to message #490902] Fri, 28 January 2011 02:36 Go to previous messageGo to next message
Michel Cadot
Messages: 68765
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Quote:
unable to get the corresponding ascii value of 207

Because chr(207) does not exist in US7ASCII. The CONVERT function takes as second parameter the TARGET character set and as third one the source character set, so in your case it should be:
convert(char(207), 'US7ASCII', 'WE8ISO8859P1')

So you get:
SQL> select chr(207), convert(chr(207), 'US7ASCII', 'WE8ISO8859P1') from dual;
C C
- -
Ï I

which is correct, isn't it.

Regards
Michel

[Updated on: Fri, 28 January 2011 02:36]

Report message to a moderator

Re: Exended Ascii to Character [message #490948 is a reply to message #490905] Fri, 28 January 2011 04:28 Go to previous messageGo to next message
gp185007
Messages: 45
Registered: April 2005
Location: Mumbai
Member
Hi,

Just to give final goal.

We need to generating a extract in which the amount fileds are EBCDIC signed packed fields.

Since we do not have built in Oracle function to do this conversion, we need to find some manual workaround to do this.


Regards,
Ganesh
Re: Exended Ascii to Character [message #490952 is a reply to message #490948] Fri, 28 January 2011 04:32 Go to previous message
Michel Cadot
Messages: 68765
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
I give up, you wasted our time with a complete different question than your actual issue.
Do it yourself!

Regards
Michel
Previous Topic: Sequence generating random values, after increment by 1
Next Topic: SQL : External Table error
Goto Forum:
  


Current Time: Thu Aug 07 00:04:05 CDT 2025