db2中存储过程调用存储过程的输出参数怎么写

 我来答
匿名用户
2017-01-18
展开全部
db2 => CREATE PROCEDURE HelloWorld2 ( \
db2 (cont.) => IN vUserName <a href="https://www.baidu.com/s?wd=VARCHAR&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLuhnznjFWPjmduHRvuAn30ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EP1fdnHDsPjc4rHcLPHRdrjDz" target="_blank" class="baidu-highlight">VARCHAR</a>(10), \
db2 (cont.) => OUT vOutValue <a href="https://www.baidu.com/s?wd=VARCHAR&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLuhnznjFWPjmduHRvuAn30ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EP1fdnHDsPjc4rHcLPHRdrjDz"target="_blank" class="baidu-highlight">VARCHAR</a>(10), \
db2 (cont.) => INOUT vInOutValue <a href="https://www.baidu.com/s?wd=VARCHAR&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLuhnznjFWPjmduHRvuAn30ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EP1fdnHDsPjc4rHcLPHRdrjDz" target="_blank" class="baidu-highlight">VARCHAR</a>(10)) \
db2 (cont.) => LANGUAGE SQL \
db2 (cont.) => BEGIN \
db2 (cont.) => INSERT INTO test_helloworld \
db2 (cont.) => VALUES('Hello ' || vUserName || vInOutValue); \
db2 (cont.) => SET vOutValue = 'A'; \
db2 (cont.) => SET vInOutValue = 'B'; \
db2 (cont.) => <a href="https://www.baidu.com/s?wd=END&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLuhnznjFWPjmduHRvuAn30ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EP1fdnHDsPjc4rHcLPHRdrjDz" target="_blank" class="baidu-highlight">END</a>
DB20000I SQL 命令成功完成。

db2 => truncate table test_helloworld IMMEDIATE
DB20000I SQL 命令成功完成。

db2 => BEGIN \
db2 (cont.) => DECLARE p_outval VARCHAR(10); \
db2 (cont.) => DECLARE p_inoutval VARCHAR(10); \
db2 (cont.) => SET p_inoutval = '~Hi~'; \
db2 (cont.) => call HelloWorld2('<a href="https://www.baidu.com/s?wd=Edward&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLuhnznjFWPjmduHRvuAn30ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EP1fdnHDsPjc4rHcLPHRdrjDz" target="_blank" class="baidu-highlight">Edward</a>', p_outval, p_inoutval); \
db2 (cont.) => INSERT INTO test_helloworld VALUES('p_outval=' || p_outval); \
db2 (cont.) => INSERT INTO test_helloworld VALUES('p_inoutval=' || p_inoutval)
; \
db2 (cont.) => <a href="https://www.baidu.com/s?wd=END&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLuhnznjFWPjmduHRvuAn30ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EP1fdnHDsPjc4rHcLPHRdrjDz" target="_blank" class="baidu-highlight">END</a>
DB20000I SQL 命令成功完成。

db2 => select * from test_helloworld
<a href="https://www.baidu.com/s?wd=DATA&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLuhnznjFWPjmduHRvuAn30ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EP1fdnHDsPjc4rHcLPHRdrjDz" target="_blank" class="baidu-highlight">DATA</a>
--------------------
Hello <a href="https://www.baidu.com/s?wd=Edward&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLuhnznjFWPjmduHRvuAn30ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EP1fdnHDsPjc4rHcLPHRdrjDz" target="_blank" class="baidu-highlight">Edward</a>~Hi~
p_outval=A
p_inoutval=B
3 条记录已选择。
本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式