Home > Software design >  How to create postgres table in talend using create query
How to create postgres table in talend using create query

Time:09-29

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

CodePudding user response:

You will have to just use this component tDBRow

enter image description here

And a very important thing is to to use tDBCommit after the tDBRow if not the table would not be created in your Postgres Database
or just tick the commit (in advanced settings if you are using tDBConnection component)

enter image description here

enter image description here

CodePudding user response:

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; 
$$
  • Related