Results 1 to 6 of 6
  1. #1
    Join Date
    May 2004
    Posts
    8

    Unanswered: insert date field in a datetime field

    Hi,
    is it possible to convert a date field into a datetime field. I've got this error :

    -1262 Non-numeric character in datetime or interval.

    on

    create procedure "informix".ins_notimportant(
    p_date VARCHAR(50)) -- date parameter
    DEFINE l_datetime like tablename.datetimefield;

    LET l_datetime = p_date;
    ...

    In this procedure, I have to insert a date field into a datetime field. I tried extend() but it don't seems to work... can somebody help ?

    thanks

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

    Please check you program or SPL.

    This conversion is posible.
    Consider following example:

    create raw table notimportant
    ( colchar varchar(50)
    )
    insert into notimportant
    select columnvarchar from anytable

    This run fine.

    Gustavo

  3. #3
    Join Date
    May 2004
    Posts
    8

    no, It don't works

    I've got error -1262 when i try to put a date in a datetime variable.

    when i try

    Let l_datetime = l_date;
    (datetime year to day) (date)

    this line generates the error -1262... I can try :

    SELECT extend(p_date, year to day)
    INTO l_datetime
    FROM dual;

    Where dual have only 1 row and It gives me the same error!

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

    Ok, please test with:
    SELECT MDY(p_date)
    INTO l_datetime
    FROM dual

    Gustavo.

  5. #5
    Join Date
    May 2004
    Posts
    8

    Red face thanks

    Thanks a lot, MDY() works...

  6. #6
    Join Date
    Jul 2003
    Location
    Beijing China
    Posts
    36
    LET l_datetime = current;

    --return OS time

    --format "2004-05-18 14:58:58"
    MSN:jianghua1213@hotmail.com
    Beijing China
    http://www.91talk.net
    http://www.91talk.com

Posting Permissions

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