ASCII Codes of a character
Posted in 2000
Topics: SQL Development & Query Writing, Stored Procedures & SPL
Does anybody know a function to retrieve the ASCII code of a single character (e.g. 'a') within a SELECT statement or a stored procedure ? Any help is welcome. Thanks to the world.
Guido Conrad wrote:
>
> Does anybody know a function to retrieve the ASCII code of a single
> character (e.g. 'a') within a SELECT statement or a stored procedure ?
> Any help is welcome.
Not offhand. Depending on how adventurous you feel, you could write a
UDF to do it, or a stored procedure that interfaces to a table such as:
create table ascii
(
character char(1) not null unique constraint ck1_ascii,
code smallint not null unique constraint ck2_ascii
check (code >= 0 AND code < 256) constraint ch1_ascii
);
Generate the data to populate the table. Then write the stored
procedure to
take a CHAR(1) value and look up the corresponding code?
--
Yours,
Jonathan Leffler (Jonathan.Leffler@Informix.com) #include <disclaimer.h>
Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN
"I don't suffer from insanity; I enjoy every minute of it!"