I need to create a function for SQL Server and Oracle that I can call to get an ASCII character from a character code. My issue, and the reason I am creating the function, is that SQL Server and Oracle have functions with different names for this. My application needs to be able to switch from one database to the other without having to worry about changing the syntax to match the database. The company chooses to do this through the use of database specific SQL function calls.
I have the SQL Server version working fine but I am having issues with the Oracle version. The function that I have is:
CREATE OR REPLACE FUNCTION sf_char
If I run the following sql statement I get the correct character from nchr but not my function call.
select nchr(255), sf_char(255)
I have tried changing the return data type to NCHAR, CHAR, VARCHAR2, and NVARCHAR2 and it doesn't seem to matter. My function continues to return a black diamond with a white question mark.
Can someone please point me in the right direction?