TEXT to VARCHAR stored procedure
Posted in 1998
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL, Data Types & Schema Design
Due to a reporting tool that I am using with an Informix 7.2
db, it is not able to understand any TEXT fields in the db schema.
So I decided to try some kind of conversion approach, where I
would create a stored procedure which took as input a TEXT
field, and returned as output a VARCHAR:
CREATE PROCEDURE text2varchar(t TEXT NOT NULL) RETURNING VARCHAR(255); DEFINE my_ret VARCHAR(255);
LET my_ret = "hello";
RETURN my_ret;
END PROCEDURE;
Unfortunately that caused syntax problems at the ')'. I have a
feeling that since TEXT is a binary blob this isn't going to work.
Another difficulty is that this needs to be done using SQL, so
ESQL is out of the question. This is for reasons I don't want to
get into here).
The DB schema has already been created and it's a lot of work to
change the code so I'd like to avoid that route if possible.
Also, support at the report tool company is looking into this
(I'm surprised they haven't hit this before), but since it's been
awhile they've been looking, my faith in them is running low.
So if anyone knows of a way I can accomplish a casting or conversion
from TEXT to VARCHAR or CHAR, please let me know.
Thanks for any help.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading