Oracle Analytics Cloud and Server

Welcome to the Oracle Analytics Community: Please complete your User Profile and upload your Profile Picture

CASE Statement using DATES

Received Response
2
Views
2
Comments
3025352
3025352 Rank 3 - Community Apprentice

Hi all,

I'm trying to filter on the following logic: if Date Sent is null, then 0, if Date Sent is not null, then Start Date minus Date Sent

Here's the syntax I'm currently using:

CASE   WHEN "Agreement Sent Date"."Date" IS NULL  

THEN '0'  

ELSE TIMESTAMPDIFF(SQL_TSI_MONTH, "Agreement Start Date"."Date", "Agreement Sent Date"."Date") 

END

I get the following error when I run the report, and really can't make out what it's trying to tell me:

Datatype(INTEGER) nullable(1) unicode(1) external char(0) conversion to datatype(VARCHAR) nullable(1) unicode(0) external char(0) is not supported


Anyone mind explaining what I'm doing wrong?

Thank you in advance!

Answers

  • 3025352
    3025352 Rank 3 - Community Apprentice

    Do I need to cast anything?

  • SriniVEERAVALLI
    SriniVEERAVALLI Rank 6 - Analytics Lead

    CASE   WHEN "Agreement Sent Date"."Date" IS NULL 

    THEN 0

    ELSE TIMESTAMPDIFF(SQL_TSI_MONTH, "Agreement Start Date"."Date", "Agreement Sent Date"."Date")

    END


    OR


    CASE   WHEN "Agreement Sent Date"."Date" IS NOT NULL

    THEN TIMESTAMPDIFF(SQL_TSI_MONTH, "Agreement Start Date"."Date", "Agreement Sent Date"."Date")

    ELSE 0

    END