Search code examples
postgresqltalend

How to create postgres table in talend using create query


i am trying to create table in talend using below code i see no error but in database this table is not getting created do $$ declare begin execute 'DROP TABLE IF EXISTS tname'; execute 'CREATE TABLE IF NOT EXISTS tname (ACTIVITY VARCHAR(32))'; end $$ ;

Please help me i am new in Talend


Solution

  • Should be something like this

    DO
    $$ 
    DECLARE BEGIN 
        EXECUTE  'DROP TABLE IF EXISTS tname';      
        EXECUTE  'CREATE TABLE IF NOT EXISTS tname (ACTIVITY VARCHAR(32))'; 
    END; 
    $$