Search code examples
ibm-clouddashdb

dashDB for Bluemix --#SET TERMINATOR @ is not working


By default the statement terminator is ; in dashDB. I want to execute a statement with terminator as @

--#SET TERMINATOR @;
CREATE TABLE employee (id INT, 
                       name VARCHAR(10), 
                       salary DECIMAL(9,2))@

It fails with below exception :

An unexpected token @ was found following salary DECIMAL(9,2)). 
Expected tokens may include: "END-OF-STATEMENT".. SQLCODE =-104, SQLSTATE=42601

Solution

  • What SQL client are you using? If you are using the built-in Run SQL GUI in dashDB web console then you can set a custom statement terminator in the by clicking on the blue Options button.

    If you are using the DB2 command line processor client, then you can set a custom statement terminator with the -td option, e.g. "-td@". See also https://www-01.ibm.com/support/knowledgecenter/?lang=en#!/SSEPGG_9.7.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0010410.html?cp=SSEPGG_9.7.0%2F3-6-2-0-2