Luis Jorge Castro wrote :

>I am trying in a DBPROC to assign a char variable to a date 
>variable but 
>there is a message "Datetime field overflow;-3048 POS(1) 
>Invalid date format:ISO". �How can I convert the string to a 
>date variable?
>
>The procedure is the next:
>**********************************************************************
>CREATE DBPROC FECHAS AS
>    VAR DIA INTEGER; MES INTEGER; ANIO INTEGER; FECHA DATE; 
>INI_DIA DATE; 
>ULT_DIA DATE; FECHA_CHAR CHAR(30);
>
>TRY
>    SET DIA='01'; SET MES='01'; SET ANIO='2000'; SET 
>FECHA='2000-01-01'; SET FECHA_CHAR='2000-01-01';
> 
>    SET FECHA_CHAR = '2000-01-01';
>
>    SET INI_DIA = FECHA_CHAR;
>
>CATCH
>    IF $rc <> 100 THEN STOP ($rc, 'unexpected error');
>**********************************************************************
>When I execute the sentence there is no errors: "Last 
>statement: Statement 
>Succesfully executed. No Result"
>
>When I execute the DBPROC: 
>CALL FECHAS WITH COMMIT
>
>There is the message: "At least one error ocurred" with the next text:
>Auto Commit: On, SQL Mode: Internal, Isolation Level: Committed
> Datetime field overflow;-3048 POS(1) Invalid date format:ISO
>
>
>Waiting a soon answer!
>
>Regards,
>
>Luis Jorge Castro
>

Inside a db-procedure the date variables are always stored in INTERNAL format. 
If you assign a literal,
the compiler automatically transforms your current format (ISO in your case) 
into INTERNAL format.
If you assign a char variable, the compiler does not make any transformations, 
i.e. the char variable
must contain the date value in INTERNAL format. The following should work :

  SET FECHA_CHAR = '20000101';
  SET INI_DIA = FECHA_CHAR;

Best Regards,
Thomas  

--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to