informix

SQL Select - transform rows in columns

跟風遠走 提交于 2019-12-13 02:37:49
问题 Quite basic, but I am stuck at the moment. On an Informix database (no pivot option), I am searching for a dynamic way to transform the following table using SQL: book | info | value ----------------------------- Moby Dick | price | high Moby Dick | stock | few Hamlet | price | low Hamlet | stock | many Faust | price | medium Faust | stock | normal Resulting table: book | price | stock ----------------------------- Moby Dick | high | few Hamlet | low | many Faust | medium | normal Thanks for

Informix Group by Alias

旧巷老猫 提交于 2019-12-13 01:30:20
问题 What am I missing according to this query: SELECT mymonth, Header1 FROM ( SELECT month(startdatetime) as mymonth, (CASE WHEN MyTable.somecolumn =2 THEN count(somecolumn2) END) as Header1 FROM MyTable WHERE year(startdatetime)=2013 group by startdatetime ) x GROUP BY Header1 I've red somewhere that Informix is not supporting grouping by alias but when trying to set GROUP BY 2, there is error too Column Header1 must be in a Group by clause 回答1: Your SQL is very unusual. The Informix server is

What is the best way to populate a load file for a date lookup dimension table?

梦想的初衷 提交于 2019-12-13 01:24:02
问题 Informix 11.70.TC4: I have an SQL dimension table which is used for looking up a date (pk_date) and returning another date (plus1, plus2 or plus3_months) to the client, depending on whether the user selects a "1","2" or a "3". The table schema is as follows: TABLE date_lookup ( pk_date DATE, plus1_months DATE, plus2_months DATE, plus3_months DATE ); UNIQUE INDEX on date_lookup(pk_date); I have a load file (pipe delimited) containing dates from 01-28-2012 to 03-31-2014. The following is an

PHP7.0 & Informix DB connectors

北城余情 提交于 2019-12-13 01:18:22
问题 I am trying to connect to an Informix db remotely via php7.0 I've found the driver https://pecl.php.net/package/PDO_INFORMIX/1.3.3 Downloaded the .tar.gz. and extracted it. Prepped the php files via phpize and ran ./configure as explained in: http://php.net/manual/en/ref.pdo-informix.php However, it crashes with the following error: checking for PDO includes... configure: error: Cannot find php_pdo_driver.h. I know that PDO has been a core PHP lib for a while and probably the C header file is

Blob's migration data from Informix to Postgres

岁酱吖の 提交于 2019-12-13 00:35:28
问题 I am migrating Informix (11.7) DB to PostgreSQL(9.2). There is only one problem: how to move blob(image) from Informix to PostgreSQL(9.2)? Many thanks in advance. 回答1: I did some such conversions between various databases using Jython and JDBC. All you need is Informix and PostgreSQL JDBC drivers in CLASSPATH . I have Informix table with BYTE column, and PostgreSQL table with BYTEA column: -- Informix CREATE TABLE _blob_test ( id integer PRIMARY KEY, image BYTE ) -- PostgreSQL CREATE TABLE

WARN - Failed to getImportedKeys The cursor has been previously released and is unavailable

混江龙づ霸主 提交于 2019-12-12 21:01:41
问题 I'm running SchemaSpy v6.1.0-SNAPSHOT on a fairly hefty Informix 12.10 schema, and I get the error "WARN - Failed to getImportedKeys The cursor has been previously released and is unavailable." I know nothing about Java, but I've noticed a very similar error with Liquibase (also written in Java) and I wondered: whether anyone could advise me what causes this error and how I might avoid / work around it, given that I don't particularly want to learn Java :-) whether this is Informix-specific

Type Conversion in Informix 4GL

杀马特。学长 韩版系。学妹 提交于 2019-12-12 18:26:59
问题 I want to convert a variable of type VARCHAR to INTEGER and vice versa (i.e. from INTEGER type to VARCHAR ) in Informix 4GL. 回答1: DEFINE v VARCHAR(20) DEFINE i INTEGER LET v = "12345" LET i = v DISPLAY "i = ", i, "; v = ", v LET i = 123456 LET v = i DISPLAY "i = ", i, "; v = ", v Easy, huh? You run into problems if the string can't be converted to a number (run time errors, etc). In essence, I4GL will automatically convert between types if it is possible, only generating an error if it is

Informix Server 10 and remove CR character in select

两盒软妹~` 提交于 2019-12-12 03:32:30
问题 I need to remove the CR character in a select in Informix Server 10. The function chr doesn't exist in version 10, so when I try a replace like that REPLACE(text_column, chr(10), ' ') I get an error like that: Routine (chr) can not be resolved. [SQL State=IX000, DB Errorcode=-674] The function ascii(10) doesn't work either. Thanks in advance 回答1: I don't have access to an IDS 10 but see if this works out for you. Bear in mind that this is an example for LF : LF - ASCII Code 10, Line Feed; CR

Check constraint on date

不打扰是莪最后的温柔 提交于 2019-12-12 02:47:17
问题 I am creating a table with date column. I would like to add a check constraint to validate if the date is in future. create table test_table ( schedule_date date not null, check (schedule_date >= TODAY) ); Above sql gives me a syntax error. 09:43:37 [CREATE - 0 row(s), 0.000 secs] [Error Code: -201, SQL State: 42000] A syntax error has occurred. ... 1 statement(s) executed, 0 row(s) affected, exec/fetch time: 0.000/0.000 sec [0 successful, 0 warnings, 1 errors] How do I add a constraint on

NOT EXISTS query doesn't work on Informix while same query with NOT IN works

倖福魔咒の 提交于 2019-12-12 02:26:58
问题 select id from license where not exists( select a.id from license a,version b, mediapart c where c.version_id = b.id and b.cntnt_id = a.cntnt_id and c.is_highdef=1); This query does not gives any rows in result set. Even on using different aliases for the outer license table and the inner one. However, this one using NOT IN works fine: select id from license where id not in( select a.id from license a,version b, mediapart c where c.version_id = b.id and b.cntnt_id = a.cntnt_id and c.is