1

How do I insert data into a columm with the type TEXT in Informix via SQL. If there are two other columns that I also want to insert/update - is the only way to save it in a file and LOAD it?

Or if I want to do do via SQL statements - can you give the syntax?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Sean Mshan
  • 57
  • 2
  • 5
  • 1
    Which language are you using? There are ways to do it in ESQL/C; I believe it can be done with JDBC too, and probably ODBC, and ... but what you can't do is use a simple string to hold the value. In ESQL/C, you might use: `EXEC SQL INSERT INTO SomeTable(Col1, Col2, Col3) VALUES(:host1, :host2, :host3);` but one of the host variables would need to be of the appropriate type for TEXT, namely a `loc_t` or locator structure. – Jonathan Leffler Aug 03 '13 at 19:39

2 Answers2

0

The load command works, and you can also use ESQL/C to do it (it is mentioned in this answer that you might already found).

About doing it in a simple insert,

You can use the VALUES clause to insert a value, but the only value that you can give that column is null. However, you can use the SELECT form of the INSERT statement to copy a TEXT or value from another table.

You can see here the docs for Text data type.

Community
  • 1
  • 1
Filipe Silva
  • 21,189
  • 5
  • 53
  • 68
0

See my question: Consistent method of inserting TEXT column to Informix database using JDBC and ODBC

It is easy with JDBC and PreparedStatement. ODBC works little different but is able to insert string with simple SQL INSERT (without preparing).

Community
  • 1
  • 1
Michał Niklas
  • 53,067
  • 18
  • 70
  • 114