Hello Community,
i have the challenge to extract and transform data from various SAP System und to combine them.
My problem is, that there are tables who are filled or not depending on the system. If not filled, there is also no table in the schema. So I get an error while running the SQL script.
My question: Is there an option to check with the SQL script if the table exists or not.
In my example below: How to check if TABLE1 is existing or not. If yes all fine, if no only run the TABLE2 part.
Thank you
Thomas
CREATE VIEW TEST_VIEW AS
SELECT
"TABLE1"."MANDT" AS MANDT,
"TABLE1"."TKNUM" AS TKNUM,
"TABLE1"."TSNUM" AS TSNUM
FROM "TABLE1"
UNION ALL
SELECT
"TABLE2"."MANDT" AS MANDT,
"TABLE2"."TKNUM" AS TKNUM,
"TABLE2"."TSNUM" AS TSNUM,
FROM "TABLE2"