If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Subtractiong DATETIMES in 7.1 SPL

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-28-05, 09:17
jthuex jthuex is offline
Registered User
 
Join Date: Jun 2002
Posts: 7
Subtracting DATETIMES in 7.3 SPL

Hi Folks,

I know it's stupid and I thought I understood it, but it looks otherwise:


CREATE PROCEDURE xt_test() RETURNING DATETIME YEAR TO SECOND;
DEFINE d1 DATETIME YEAR TO SECOND;
DEFINE d2 DATETIME YEAR TO SECOND;
DEFINE d3 INTERVAL DAY TO SECOND;
LET d1 = '2005-11-27 10:00:00';
LET d2 = '2005-11-27 11:00:00';
LET d3 = d2 - d1;
RETURN d3;
END PROCEDURE;
EXECUTE PROCEDURE xt_test();

results in:

SQL Error (-1260): It is not possible to convert between the specified types.


Do I have to rescale the INTERVAL variable "d3" with "EXTEND" ... ? And if so - how?

tx,

Joachim

Last edited by jthuex; 11-28-05 at 09:30.
Reply With Quote
  #2 (permalink)  
Old 11-28-05, 09:23
gurey gurey is offline
Registered User
 
Join Date: Aug 2003
Location: Argentina
Posts: 780
Hi,

Please define d3 as char(11).
Gustavo.
Reply With Quote
  #3 (permalink)  
Old 11-30-05, 09:44
hbe hbe is offline
Registered User
 
Join Date: Nov 2005
Location: Belgium
Posts: 3
Hi,

The problem is :

....Returnning DATETIME......
AND d3 is define as INTERVAL. So when you return the value engine must convert interval to datetime. Solution is define d3 as interval.
Reply With Quote
  #4 (permalink)  
Old 11-30-05, 09:54
jthuex jthuex is offline
Registered User
 
Join Date: Jun 2002
Posts: 7
Quote:
Originally Posted by hbe
Solution is define d3 as interval.
Thank you.

Joachim
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On