Answering my own question in case anyone else is interested.
I am now using:
case 0 when 1 then 'a' end.
This results in a native query with all processing passed to the database:
WITH
"Query1" AS
(
SELECT DISTINCT
"PRESENTATION_SHARED_D_CAL0"."CAL_YEAR_NAME" AS "Year0",
CAST(NULL AS VARCHAR2(1)) AS "Data_Item1"
FROM
"PRESENTATION_SHARED"."D_CAL" "PRESENTATION_SHARED_D_CAL0"
)
SELECT DISTINCT
"Union1"."Year0" AS "Year0",
"Union1"."Data_Item1" AS "Data_Item1"
FROM
(
SELECT
"Query1"."Year0" AS "Year0",
"Query1"."Data_Item1" AS "Data_Item1"
FROM
"Query1"
UNION
SELECT
"Query1"."Year0" AS "Year0",
"Query1"."Data_Item1" AS "Data_Item1"
FROM
"Query1"
) "Union1"
------------------------------
Marc Reed
------------------------------
Original Message:
Sent: Thu August 08, 2024 08:09 AM
From: Marc Reed
Subject: Nullif( ) causes local processing for different data types
I wonder if anyone can shed light on why DQM handles the nullif() function differently depending on the datatypes? I use this function to get a null in a query.
nullif( 1, 1 ) is sent to the database. If I create a simple query with this calculation, the native sql is:
SELECT DISTINCT
"PRESENTATION_SHARED_D_CAL0"."CAL_YEAR_NAME" AS "Year0",
null AS "Data_Item1"
FROM
"PRESENTATION_SHARED"."D_CAL" "PRESENTATION_SHARED_D_CAL0"
compare that to when a nullif( 'a', 'a') is used. When the null is added with local processing.
If anyone knows of an alternative way of coding a null into a calc which doesnt require local processing or db specific functions please post. I try an avoid {null} as thats a db thing.
Thanks.
------------------------------
Marc Reed
------------------------------