sql - Informix - update SET column with results from a subselect -


I have a table with the collection column. I want to do a subselect which gives several integers and results in that collection column, although I can not get a syntax to do this through SQL. I did this by writing a SQL process that does the same thing (the result of SELECT and return variables in the SET variable), but I'm trying to do this without the function. Can it be done?

First of all, I create a temporary table:

  create template table 1 (id integer, cola2t (not to tap INT))  < / Pre> 

Then I fill it with test data:

  Include table 1 values ​​(1); Insert Table 1 (id) values ​​(2);   

And now it works:

  UPDATE table1 SET col2 = SET {1,2};   

... but I am trying to do this and it does not work:

  UPDATE table1 SET col2 = (Selection ID from the table 1) WHERE id = 1;   

returns this error:

  [error code: -9632, SQL state: IX000] does not match the value column type (cola 2) is. Adding ST types in pure SQL is a pain.    

You should be able to do this:

  Table 1 SET call2 = SET {(Table 1 with select ID WHERE id = 1}} ID = 1;   

However, I'm not sure what the correct modification is to get more than one value in the set; The inner interior is not there.

Comments