Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2002
    Posts
    7

    Unanswered: 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 10:30.

  2. #2
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    780
    Hi,

    Please define d3 as char(11).
    Gustavo.

  3. #3
    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.

  4. #4
    Join Date
    Jun 2002
    Posts
    7
    Quote Originally Posted by hbe
    Solution is define d3 as interval.
    Thank you.

    Joachim

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •