0

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
Felipe Oriani
  • 37,948
  • 19
  • 131
  • 194
raag
  • 77
  • 8

2 Answers2

0

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

  • I am using the Run SQL GUI, but I have some sql statements for which i want terminator to be @ and for some ; . So I can't set it through options. – raag Oct 03 '15 at 13:38
  • What is the particular reason why you want to use different statement terminators in the same script? Can you provide an example? – Torsten Steinbach Oct 05 '15 at 06:02
0

Within the same sql script you can not use different sql termination character. If you do need to use different termination character then you need to use one script for each character and use the db2 -td

Hope this helps. Murali