SQL Date Formatting Issue
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I am connecting to a certain DB and using the "Connect IN DB" tool. In the SQL Editor I have this:
Select
T0."GRP_NBR_PFX" || LPAD(T0."GRP_NBR_SFX",6,'0'),
T0."GRP_NAM_1",
T0."GRP_ORL_CTR_DAT",
T0."GRP_STS_CD",
T0."GRP_TPA_CTA_CD"
From "GO"."GRP_HST" T0
Where (T0."GRP_APT_CTA_CD" = 'Yxx246'
And T0."GRP_ORL_CTR_DAT" > {d '2019-01-01'}
)
I get the Error: ORA-00936: missing expression error. I'm not sure how to adjust the SQL for the date so that Alteryx accepts it. This is how the SQL is written in another DB and it works perfectly fine, but I have a feeling Alteryx requires it differently, but I am not sure how to format that date for it to accept it. Any ideas?
Solved! Go to Solution.
- Labels:
- In Database
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hey @RCern, if you try this without the d{}, does that work?
Select
T0."GRP_NBR_PFX" || LPAD(T0."GRP_NBR_SFX",6,'0'),
T0."GRP_NAM_1",
T0."GRP_ORL_CTR_DAT",
T0."GRP_STS_CD",
T0."GRP_TPA_CTA_CD"
From "GO"."GRP_HST" T0
Where (T0."GRP_APT_CTA_CD" = 'Yxx246'
And T0."GRP_ORL_CTR_DAT" > '2019-01-01')
If not, can you provide a sample of your data please, or some screenshots?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
When I do that I get this error: Error: ORA-01861: literal does not match format string
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Here is the data when I run it in my other DB with the original SQL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@RCern can you try using TO_DATE?
Select
T0."GRP_NBR_PFX" || LPAD(T0."GRP_NBR_SFX",6,'0'),
T0."GRP_NAM_1",
T0."GRP_ORL_CTR_DAT",
T0."GRP_STS_CD",
T0."GRP_TPA_CTA_CD"
From "GO"."GRP_HST" T0
Where (T0."GRP_APT_CTA_CD" = 'Yxx246'
And T0."GRP_ORL_CTR_DAT" > To_date('2019-01-01','YYYY-MM-DD'))
I've used YYYY-MM-DD above so just switch it it YYYY-DD-MM if necessary.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you!
