I have some SQL statements stored in our Netezza DWH. I want to run some of these (or at least one) from a new query.
I have tried a lot of things using Declare and such, but it seems not to be working on the Netezza.
This is a query that has been stored:
SELECT
"CUST-NO (CUNO)" AS KEY_REFERENCE,
'TESTDB' AS REQ_NBR,
CASE
WHEN TRIM("VAT-ID (VATID)") = ''
THEN 'InValid'
ELSE 'Valid'
END AS VALIDATION
FROM
PE_NL."Customer Name and Address Physical File (CIPNAME0)"
WHERE
"COUNTRY (CCNTRY)" = 'NL'
This is how to retrieve the query:
SELECT QUERY_STR
FROM MDM.DQM_REFERENCE_TESTDB
WHERE SOURCE_SYSTEM = 'LOTUSN'
I want to create a query which looks up the 1st query and execute it. I could not find a similar question yet on this site (for Netezza). Hope that somebody can help me. Thanks.