I have multiple databases from diferent DBMS (Oracle, SQLServer, DB2 and PostgreSQL) and my scripts are idempotent PL/SQL blocks.
Here you can see an example. Oracle script:
DECLARE TABLE NUMBER :=0; FIELD NUMBER :=0; BEGIN SELECT COUNT(*) INTO TABLE FROM USER_TABLES WHERE TABLE_NAME = 'TABLE_NAME'; IF TABLE>0 THEN SELECT COUNT(*) INTO FIELD FROM USER_TAB_COLS WHERE TABLE_NAME = 'TABLE_NAME' AND COLUMN_NAME = 'FIELD_NAME'; IF FIELD=0 THEN EXECUTE IMMEDIATE 'ALTER TABLE TABLE_NAME ADD FIELD_NAME DATA_TYPE'; ELSE DBMS_OUTPUT.PUT_LINE ('THE FIELD FIELD_NAME DOESNT_EXIST'); END IF; ELSE DBMS_OUTPUT.PUT_LINE ('THE TABLE_NAME DOESNT EXIST'); END IF; END; /
When I execute this type of scripts on SQLDeveloper I’m able know which databases have not the specified object (without failing the script, like creating a an exception for example), and now Im trying to pass update my all databases with liquibase and I’m losing this capacity to see the dbms output.
Do you know how could I handle this situation or about something other alternative to know if my scripts are executed completely (creating the object or displaying some message when it doesnt exists)?
Thank you in advance.