Re: Anything like REPLACE or SUBSTITUTE?
Posted in 1999
Topics: Performance & Tuning, Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL
Thanks. Great. Why didn't I test it??? Sven Wu <wuyf@tm.net.my> schrieb in im Newsbeitrag: 7lc0hv$if8$1@news.xmission.com... > > The "replace" function is exist in version 7.30. > > "Art S. Kagel" wrote: > > > No. You could do it using a brute force approach in a stored procedure > > but it will be a dog in performance. Better to make that script a 4GL > > or ESQL/C program and fix up the string in code. Or better yet break > > that into to columns for surname and first name and you can then: > > > > SELECT trim(surname) || ', ' || trim(first_name), .... > > > > Art S. Kagel > > > > Sven Heins wrote: > > > > > > Is there anything like the above string functions in Informix? > > > > > > I would like to do something like this... > > > > > > select replace( name, "/", ", ") from table1 > > > where ... > > > > > > If there is a string "Smith/Thomas" in the column 'name' the result should > > > be "Smith, Thomas". > > > Is informix able to do so??? > > > > > > Thanks for your help. > > > > > > -- > > > Sven Heins > > > solution42 IT systems & consulting Gmbh & Co KG > > > http://www.solution42.de > >
Sven Heins wrote:
> Thanks. Great. Why didn't I test it???
This isn't a dig at Sven in particular, but it is a dig at a fair
number of the questions asked in comp.databases.informix.
Very often, the quickest way to find out if something works is to
try it. Granted, there are occasions when you don't want to try
something. For example:
BEGIN WORK;
DROP TABLE Humongous; ROLLBACK WORK;
You can experiment with that in OnLine (IDS, UDO, XPS, etc) and
you will be fine as long as your database does have transactions.
Try it in SE and your table is gone -- oops!
So, if your test might do damage, then ask away. If your test
can't do any damage -- and I've yet to hear of a SELECT that did
more lasting damage than eat up the space in a dbspace for the
INTO TEMP clause or prevent other people from accessing data because
of the isolation level -- then it is usually quicker to try it.
The worst that will happen as a result is that your message says:
When I tried ... I got error -XYZ. This helps us understand that
you've tried. It probably helps you learn. And it is quicker.
And when you do ask a question, in general it is a good idea to include
both platform and version information.
--
Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net)
Guardian of DBD::Informix v0.60 -- see http://www.perl.com/CPAN
#include <disclaimer.h>