Home > Net >  Setting string value through substring operator in Informix?
Setting string value through substring operator in Informix?

Time:09-03

I have to migrate an Informix DB to PostgreSQL DB and I'm looking for the documentation of a function, but I can't find anything.

My Issue - I have this line of Informix SQL:

update tab1 set mycolumn[7, 10] = "abcd";

I assume mycolumn gets the "abcd" from character position 7 to 10 and the rest of mycolumn remains untouched. But I have to verify it; that's the reason, why I need the documentation. Original IBM documentation would be the best.

CodePudding user response:

From the IBM Informix 14.10 documentation for the UPDATE SQL statement follow the links for the SET Clause and then Single-Column Format and Expression where there is a link to the Column Expressions. On that page is a description for the [first, last] syntax which is described as an Informix extension.

Here is an example:

create table tab1(mycolumn char(12));
insert into tab1 values("123456789abc");
update tab1 set mycolumn[7,10] = "ABCD";
select * from tab1;

with the result:

mycolumn

123456ABCDbc
  • Related