# Date Conversion in Loop Bug

**URL:** <https://forums.toadworld.com/t/date-conversion-in-loop-bug/48449>\
**Category:** Toad Data Point & Toad Intelligence Central\
**Created:** [December 12, 2019, 5:15pm UTC](https://forums.toadworld.com/t/date-conversion-in-loop-bug/48449 "2019-12-12T17:15:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![toad.user](https://avatars.discourse-cdn.com/v4/letter/t/e19b73/32.png) [@toad.user](https://forums.toadworld.com/u/toad.user)\
**Post date:** [December 12, 2019, 5:15pm UTC](https://forums.toadworld.com/t/date-conversion-in-loop-bug/48449/1 "2019-12-12T17:15:35Z")

</div>

Trying to understand why TDP is returning 'To\_date('11/20/2019 00:00:00.00', 'MM/DD/YYYY HH24:MI:SS.SS')' when using a Loop Dataset that includes a date value being returned from Teradata without any formatting. Using TO\_DATE results in an invalid number of parameters error so if this is physically being inserted it would make formatting a date relatively impossible without some kind of substring function to extract it.

This is what the log returned as attempted when an exception occurred:

INSERT INTO send\_log  
(TRANS\_DT,HR\_NUMBER,EMPLOYEE\_NM,SLS\_PRSN\_ID,EMAIL\_ADDRESS,MAIL\_STATUS)  
VALUES  
('To\_date('11/20/2019 00:00:00.00', 'MM/DD/YYYY HH24:MI:SS.SS')','2537839','Darlene Hick','E234','darlene.hick@email.com','SENT')

This doesn't work either: trans\_dt (FORMAT 'mm/dd/yyyy')

Find and replace or substr doesn't work either. Surprised something like this could go unnoticed.
