Re: Convert Varchar/Char to Text
Posted in 2004
Sven Radtke wrote: > i know this is an old problem. but after hours of searching i didn't find > any solution. > my problem : convert varchar-data from table1 to text-data table2 in SPL A better way to state this is "your requirement is to convert varchar data into text data, and, at the moment, your preferred solution is to use SPL". Unfortunately, as you've discovered, it cannot be done in SPL - at least, not as delivered. > all what i've got is, that i need a userdefined-function (datablade, udr > ?!?) for Informix IDS 9.x. All valid names - udr = user-defined routine; udf = user-defined function, datablade = set of user-defined types or functions or both. Yes, you would need to provide yourself with a UDR that can be used to cast character strings to TEXT blobs. Whether you could then use that in SPL is still slightly debatable; the only thing you can do with BYTE or TEXT blobs in SPL is pass them around with references. How you assign the reference, I'm not sure (I'd have to do a manual bash, and I suspect the answer is "you can't" because BYTE and TEXT were deprecated at the point when extensibility and BLOB and CLOB data types were added). > a) Is there any example for such a function ? (i am not very skilled in > this, but i will do my best to understand this :o) ) IIUG Software Archive? IBM web site (and good luck). > b) Is there any solution in ESQL/C for Ifx 7.x ? In ESQL/C, you can do it by sucking the data into the client program, setting a locator structure to point to the varchar data, and then sending the locator to the database for insertion into the text column. That's relatively trivial - relative being the operative term. I could hack a solution for that out of the code in SQLCMD relatively easily. SQLCMD is available at the IIUG Software Archive. -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/