Delete rows from a table if table exists in Redshift otherwise ignore deletion -


i using redshift. want query delete selected rows redshift table if table exists otherwise ignore statement.

redshift's sql dialect doesn't contain control-of-flow statements if.. not going able in single sql statement.

your application or process need first query redshift table metadata determine if table exists e.g.

select 1 pg_tables schemaname = 'myschema' , tablename = 'myschema'; 

if data returned (i.e. table exists) application or process execute delete statement, if no data returned application or process nothing. need handle "if this" logic externally redshift.


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -