Search code examples
sqloracletableau-api

Why is my initial SQL (Oracle) not accepted by Tableau?


For a project I've been working on, I had to create 2 tables in Oracle using Tableau's Initial SQL window. I basically need to re-create them each time Tableau does an extract, so would have to drop and re-create them. Only using the 'DROP' statement works, but if the extract fails in the middle of it, then when it re-runs, the tables don't exist, thus it returns an error.

I tried to use the below code which works fine in SQL Developer, but Tableau doesn't seem to accept it.

--Searches and deletes table TABLEAU_LCC_LEAD_TIME if it exists
DECLARE
   does_not_exist EXCEPTION;
   PRAGMA EXCEPTION_INIT (does_not_exist, -942);
BEGIN
   EXECUTE IMMEDIATE 'DROP TABLE TABLEAU_DOC_LEAD_TIMES';
EXCEPTION
   WHEN does_not_exist
   THEN
      NULL;
END;
/

Tableau returns this error

enter image description here

Would you know of any workaround for the "/" in Tableau Initial-SQL for Oracle?


Solution

  • I think use temporary table in Oracle. Not need re-created table. https://oracle-base.com/articles/misc/temporary-tables