All Apps and Add-ons

Splunk DBConnect Issue Unrecognized option: Date, case when

reverse
Contributor
Unrecognized option: Date, case when trunc(sysdate-aafa.app_recvd_dt) <=4 then 4 days or less when trunc(sysdate-aafa.app_recvd_dt) between 5 and 7 then '5 to 7 days' when trunc(sysdate-aafa.app_recvd_dt) between 8 and 15 then '8 to 15 days' when trunc(sysdate-aafa.app_recvd_dt) between 16 and 21 then '16 to 21 days' when trunc(sysdate-aafa.app_recvd_dt) between 22 and 30 then '22 to 30 days' when trunc(sysdate-aafa.app_recvd_dt) between 31 and 45 then '31 to 45 days' when trunc(sysdate-aafa.app_recvd_dt)>45 then 'More than 45 days' end as span, rtapp.description AS Application

The query is running fine in SQL explorer but not in splunk.

Query...

...
...
...
...
..
...
case when trunc(sysdate-aafa.app_recvd_dt) <=4 then '4 days or less'
when trunc(sysdate-aafa.app_recvd_dt) between 5 and 7 then '5 to 7 days'
when trunc(sysdate-aafa.app_recvd_dt) between 8 and 15 then '8 to 15 days'
when trunc(sysdate-aafa.app_recvd_dt) between 16 and 21 then '16 to 21 days'
when trunc(sysdate-aafa.app_recvd_dt) between 22 and 30 then '22 to 30 days'
when trunc(sysdate-aafa.app_recvd_dt) between 31 and 45 then '31 to 45 days'
when trunc(sysdate-aafa.app_recvd_dt)>45 then 'More than 45 days' end as span,
...
...
..
..
.
.
.
.
.
.
.
Tags (2)
0 Karma
1 Solution

reverse
Contributor

The issue was spaces in aliases. Not at all related to error thrown

View solution in original post

0 Karma

reverse
Contributor

The issue was spaces in aliases. Not at all related to error thrown

0 Karma

maciep
Champion

if you get rid of the case statements, does it run? if not, there's probably something wrong elsewhere causing the issue to show up there? If it does, then maybe try one condition in the case, then the next and so on to see where it's getting upset exactly.

0 Karma

p_gurav
Champion

try using else in case command before end.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Laser Bananas and Edge Hubs: Exploring Operational Technology (OT) Data Through a ...

  OT is a different environment to traditional IT and can have interesting challenges when interfacing the ...

Event Series: Mastering AI Tokenomics and Splunk Agent Observability

Beyond the Black Box: Correlating AI Performance and Tokenomics with Splunk Agent Observability   As ...

span_metrics: The OpenTelemetry-Idiomatic Way to See Inside Your Services

You open a trace in Splunk Observability Cloud and everything looks fine. One root span, order-pipeline, with ...