在 DB2 SQL 存储过程中使用 XML
2009-11-23 00:00:00 来源:WEB开发网CREATE PROCEDURE ex_proc(IN inpdoc XML)
LANGUAGE SQL
NO EXTERNAL ACTION
BEGIN
IF XMLEXISTS('$d/request[@action="add"]' PASSING inpdoc AS "d") THEN
SIGNAL SQLSTATE '75002' SET MESSAGE_TEXT = 'F(x) add';
ELSEIF XMLEXISTS('$d/request[@action="update"]' PASSING inpdoc AS "d") THEN
SIGNAL SQLSTATE '75002' SET MESSAGE_TEXT = 'F(x) update';
ELSE
SIGNAL SQLSTATE '75002' SET MESSAGE_TEXT = 'F(x) invalid';
END IF;
END
清单 17. IF/THEN/ELSE,输入值(1)
<request action="add">
<name>Jean Luc Picard</name>
</request>
Output:
SQL0438N Application raised error with diagnostic text: "F(x) add".
SQLSTATE=75002
清单 18. IF/THEN/ELSE,输入值(2)
<request action="update">
<name>Jean Luc Picard</name>
</request>
Output:
SQL0438N Application raised error with diagnostic text: "F(x) update".
SQLSTATE=75002
清单 19. IF/THEN/ELSE,输入值(3)
<request action="delete">
<name>Jean Luc Picard</name>
</request>
Output:
SQL0438N Application raised error with diagnostic text: "F(x) invalid".
SQLSTATE=75002
- ››sql server自动生成批量执行SQL脚本的批处理
- ››sql server 2008亿万数据性能优化
- ››SQL Server 2008清空数据库日志方法
- ››sqlserver安装和简单的使用
- ››SQL Sever 2008 R2 数据库管理
- ››SQL SERVER无法安装成功,sqlstp.log文件提示[未发...
- ››Sql Server中通过父记录查找出所有关联的子记录
- ››SqlServer触发器、存储过程和函数
- ››SQL Server 中的事务(含义,属性,管理)
- ››Sqlite数据库插入和读取图片数据
- ››Sql server 2005拒绝了对对象 'xx表' (数...
- ››Sql server 2005拒绝了对对象 'xx表' (数...
更多精彩
赞助商链接