免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3918 | 回复: 1
打印 上一主题 下一主题

网上拷贝的一个简单存储过程很简单例子,不知道为啥出错 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-12-16 14:12 |只看该作者 |倒序浏览
$ db2level
DB21085I  Instance "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
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0104N  An 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
SQL0104N  An unexpected token "CTIME" was found following "".  Expected tokens
may include:  "".  SQLSTATE=42601

END P1
DB21034E  The command was processed as an SQL statement because it was not a
valid Command Line Processor command.  During SQL processing it returned:
SQL0104N  An unexpected token "END-OF-STATEMENT" was found following "END P1".
Expected tokens may include:  "JOIN <joined_table>".  SQLSTATE=42601

$

论坛徽章:
11
数据库技术版块每日发帖之星
日期:2016-06-25 06:20:00数据库技术版块每日发帖之星
日期:2016-06-24 06:20:00数据库技术版块每日发帖之星
日期:2016-05-03 06:20:00数据库技术版块每日发帖之星
日期:2016-04-21 06:20:00数据库技术版块每日发帖之星
日期:2016-01-23 06:20:00数据库技术版块每日发帖之星
日期:2015-12-03 06:20:00综合交流区版块每周发帖之星
日期:2015-12-02 15:03:53数据库技术版块每日发帖之星
日期:2015-10-19 06:20:00数据库技术版块每日发帖之星
日期:2015-08-20 06:20:002015年辞旧岁徽章
日期:2015-03-03 16:54:15数据库技术版块每日发帖之星
日期:2016-07-30 06:20:00
2 [报告]
发表于 2010-12-19 18:03 |只看该作者
行分隔符的问题!
用db2 -td @ -vf 8.sql
在8.sql最后一行加上@
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP