Change delimiter in a DB2 script

  db2, dbeaver, docker, sql

I have setup DB2 v11.5.5.1 in a Docker container and accessed it via DBeaver.

I want to run a script with a CREATE PROCEDURE statement on DB2 database.

But it returns SQL Error [42601]: An unexpected token "END-OF-STATEMENT" was found following "E IF EXISTS TEMP_IDS".

The sample script I tried is here.

--#SET DELIMITER $$
CREATE PROCEDURE create_new_temp_ids_table ()
BEGIN
    DROP TABLE IF EXISTS TEMP_IDS;
    CREATE TABLE TEMP_IDS (
            TEMP_ID VARCHAR (20) NOT NULL,
            NAME VARCHAR (100),
            PRIMARY KEY (TEMP_ID));
END$$

How can I solve this delimiter issue in DB2 script? I think the issue with changing the delimiter.

Source: Docker Questions

LEAVE A COMMENT