简体   繁体   English

DB2,PLSQL:我的脚本不起作用

[英]DB2, PLSQL : My script doesn't work

I'm trying to run a PL/SQL script on my REDHAT VM 我正在尝试在我的REDHAT VM上运行PL / SQL脚本

This is my script : 这是我的脚本:

connect to WWW user XXX using VVV
DECLARE
   message  varchar2(20):= 'Hello, World!';
BEGIN
   dbms_output.put_line(message);
END;
/

And this is my command : 这是我的命令:

 db2 -td/ -vf test.sql

And this is my error: 这是我的错误:

SQL0104N An unexpected token "DECLARE" was found following "". SQL0104N在“”后面找到意外的令牌“DECLARE”。
Expected tokens may include: "NEW". 预期的代币可能包括:“新”。 SQLSTATE=42601 SQLSTATE = 42601

I tried many things and the result is always the same. 我尝试了很多东西,结果总是一样的。 Can someone help me? 有人能帮我吗?

You define the statement terminator as / , but don't use any statement terminator with the connect to statement. 您将语句终止符定义为/ ,但不要将任何语句终止符与connect to语句一起使用。 Append a / and it should work. 附加一个/它应该工作。

Also, please check that PL/SQL support is turned on. 另外,请检查PL/SQL支持是否已打开。 You need to set the DB2_COMPATIBILITY_VECTOR to enable syntax support for Oracle PL/SQL. 您需要设置DB2_COMPATIBILITY_VECTOR以启用对Oracle PL / SQL的语法支持。 See this section in the DB2 documentation for details. 有关详细信息,请参阅DB2文档中的此部分

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM