Reputation: 21
I got error while creating procedure in db2.
Error is - Expected tokens may include: psm_semicolon.. SQLCODE=-104
Help Me....
CREATE PROCEDURE update_new()
LANGUAGE SQL
BEGIN
CREATE TABLE TEMP(METADATA_KEY varchar(40),NEW_METADATA_KEY varchar(40));
END;
Upvotes: 0
Views: 1585
Reputation: 19001
In whatever tool you're using, change the statement terminator to something other than semicolon and put that terminator at the end of the CREATE PROCEDURE
statement.
For example, if using the command line processor, save this to a file (note the "@" symbol at the end:
CREATE PROCEDURE update_new()
LANGUAGE SQL
BEGIN
CREATE TABLE TEMP(METADATA_KEY varchar(40),NEW_METADATA_KEY varchar(40));
END@
then execute the file: db2 -td@ -f myproc.sql
The reason for doing this is that semicolons are always used as terminators within the procedure code, so you must use something else to terminate the CREATE PROCEDURE
statement.
Upvotes: 1