BEGIN ATOMIC DECLARE @ROWCOUNT INT NOT NULL DEFAULT 0; SELECT COUNT(*) INTO @ROWCOUNT FROM QSYS2.SYSTABLES WHERE TABLE_NAME = 'View1' and TABLE_SCHEMA = CURRENT_SCHEMA; IF(NOT @ROWCOUNT > 0) THEN CREATE OR REPLACE VIEW View1 AS SELECT * FROM Users; SIGNAL SQLSTATE VALUE '99998' SET MESSAGE_TEXT = 'VIEW View1 CREATED'; ELSE SIGNAL SQLSTATE VALUE '99999' SET MESSAGE_TEXT = 'VIEW View1 EXISTS'; END IF; END
75300cookie-checkiSeries: Check if table exists + return message in embedded statement