网上拷贝的一个简单存储过程很简单例子,不知道为啥出错
$ db2levelDB21085IInstance "fexuser" uses "64" bits and DB2 code release "SQL08020"
with level identifier "03010106".
Informational tokens are "DB2 v8.1.1.64", "s040812", "U498350", and FixPak "7".
Product is installed at "/usr/opt/db2_08_01".
$
$ cat 8.sql
CREATE PROCEDURE get_datetime (out cdate date, out ctime time )
P1: BEGIN
VALUES CURRENT DATE INTO cdate;
VALUES CURRENT TIME INTO ctime;
END P1;
$
$ db2 -tvf 8.sql
CREATE PROCEDURE get_datetime (out cdate date, out ctime time )
P1: BEGIN
VALUES CURRENT DATE INTO cdate
DB21034EThe command was processed as an SQL statement because it was not a
valid Command Line Processor command.During SQL processing it returned:
SQL0104NAn unexpected token "END-OF-STATEMENT" was found following "RENT
DATE INTO cdate".Expected tokens may include:"<psm_semicolon>".LINE
NUMBER=3.SQLSTATE=42601
VALUES CURRENT TIME INTO ctime
SQL0104NAn unexpected token "CTIME" was found following "".Expected tokens
may include:"".SQLSTATE=42601
END P1
DB21034EThe command was processed as an SQL statement because it was not a
valid Command Line Processor command.During SQL processing it returned:
SQL0104NAn unexpected token "END-OF-STATEMENT" was found following "END P1".
Expected tokens may include:"JOIN <joined_table>".SQLSTATE=42601
$ 行分隔符的问题!
用db2 -td @ -vf 8.sql
在8.sql最后一行加上@
页:
[1]