From: Atli T. <at...@ga...> - 2004-05-27 17:51:11
|
Hi, I am dealing with an inconsistency between replies from db2. The following comparison works fine using db2 command line select ... from ... where a.time >= CURRENT TIMESTAMP - '3 hours' but when using pydb2 I get: SQLSTATE : 42818, NATIVE ERROR CODE : -401 [IBM][CLI Driver][DB2/6000] SQL0401N The data types of the operands for the operation ">=" are not compatible. SQLSTATE=42818 Any ideas? Atli Thorbjornsson. |
From: <yu...@ad...> - 2004-05-28 11:02:33
|
Quoting Atli Thorbjornsson <at...@ga...>: > Hi, > I am dealing with an inconsistency between replies from db2. The following > comparison works fine using db2 command line > > select ... from ... where a.time >= CURRENT TIMESTAMP - '3 hours' > > but when using pydb2 I get: > > SQLSTATE : 42818, NATIVE ERROR CODE : -401 > [IBM][CLI Driver][DB2/6000] SQL0401N The data types of the operands for the > operation ">=" are not compatible. SQLSTATE=42818 > > Any ideas? > Atli Thorbjornsson. I'm assuming that a.time is defined to be of type timestamp, right ? ------------------------------------------------- This mail sent through IMP: http://horde.org/imp/ |
From: Atli T. <at...@ga...> - 2004-05-28 11:36:16
|
That's correct. I have to use a different time duration for this to work with pydb2 like current timestamp - decimal(030000,6) which is a bitch because I am actua= lly porting a bunch of sql code from ingres and the less I have to change the better. Atli -----Original Message----- From: yu...@ad... [mailto:yu...@ad...] Sent: 28. ma=ED 2004 10:48 To: at...@ga... Cc: pyd...@li... Subject: Re: [PyDB2-discuss] inconsistency Quoting Atli Thorbjornsson <at...@ga...>: > Hi, > I am dealing with an inconsistency between replies from db2. The following > comparison works fine using db2 command line > > select ... from ... where a.time >=3D CURRENT TIMESTAMP - '3 hours' > > but when using pydb2 I get: > > SQLSTATE : 42818, NATIVE ERROR CODE : -401 > [IBM][CLI Driver][DB2/6000] SQL0401N The data types of the operands fo= r the > operation ">=3D" are not compatible. SQLSTATE=3D42818 > > Any ideas? > Atli Thorbjornsson. I'm assuming that a.time is defined to be of type timestamp, right ? ------------------------------------------------- This mail sent through IMP: http://horde.org/imp/ |
From: Atli T. <at...@ga...> - 2004-05-28 14:43:24
|
It seems to have something to do with having '3 hours' enclosed in quotes. If I remove the quotes then pydb2 works fine. Does that clarify? Atli -----Original Message----- From: yu...@ad... [mailto:yu...@ad...] Sent: 28. ma=ED 2004 10:48 To: at...@ga... Cc: pyd...@li... Subject: Re: [PyDB2-discuss] inconsistency Quoting Atli Thorbjornsson <at...@ga...>: > Hi, > I am dealing with an inconsistency between replies from db2. The following > comparison works fine using db2 command line > > select ... from ... where a.time >=3D CURRENT TIMESTAMP - '3 hours' > > but when using pydb2 I get: > > SQLSTATE : 42818, NATIVE ERROR CODE : -401 > [IBM][CLI Driver][DB2/6000] SQL0401N The data types of the operands fo= r the > operation ">=3D" are not compatible. SQLSTATE=3D42818 > > Any ideas? > Atli Thorbjornsson. I'm assuming that a.time is defined to be of type timestamp, right ? ------------------------------------------------- This mail sent through IMP: http://horde.org/imp/ |
From: <yu...@ad...> - 2004-05-28 15:25:23
|
Quoting Atli Thorbjornsson <at...@ga...>: > It seems to have something to do with having '3 hours' enclosed in quotes. > If I remove the quotes then pydb2 works fine. Does that clarify? > Atli I dont understand... you simply write CURRENT TIMESTAMP - '3 hours' ? I mean '3 hours' as a string ? Cause if so, try to replace '3 hours' with ''3 hours'' but i dont think that's the case (I wasn't even aware that you could subtract timestamps in that manner) ------------------------------------------------- This mail sent through IMP: http://horde.org/imp/ |
From: Atli T. <at...@ga...> - 2004-05-28 15:32:00
|
I am porting an ingres application over to db2, hence the strange syntax. Extra quotes do not help but as I said removing them does. I can live wit= h that fix myself but I was just wondering why it works in command line db2 and not in pydb2. Atli. -----Original Message----- From: yu...@ad... [mailto:yu...@ad...] Sent: 28. ma=ED 2004 15:11 To: at...@ga... Cc: pyd...@li... Subject: RE: [PyDB2-discuss] inconsistency Quoting Atli Thorbjornsson <at...@ga...>: > It seems to have something to do with having '3 hours' enclosed in quot= es. > If I remove the quotes then pydb2 works fine. Does that clarify? > Atli I dont understand... you simply write CURRENT TIMESTAMP - '3 hours' ? I mean '3 hours' as a string ? Cause if so, try to replace '3 hours' with ''3 hours'' but i dont think that's the case (I wasn't even aware that you could subtract timestamps in that manner) ------------------------------------------------- This mail sent through IMP: http://horde.org/imp/ |
From: <yu...@ad...> - 2004-05-28 18:00:51
|
Quoting Atli Thorbjornsson <at...@ga...>: > I am porting an ingres application over to db2, hence the strange syntax. > Extra quotes do not help but as I said removing them does. I can live with > that fix myself but I was just wondering why it works in command line db2 > and not in pydb2. I have no idea... single quotes in the command line don't work for me actually... ------------------------------------------------- This mail sent through IMP: http://horde.org/imp/ |