查看: 4133|回复: 4

[原创] NETEZZA数据库支持for循环和游标,sql递归操作吗?

[复制链接]
论坛徽章:
3
优秀写手
日期:2014-04-05 06:00:12慢羊羊
日期:2015-03-04 14:53:332015年新春福章
日期:2015-03-06 11:58:39
跳转到指定楼层
1#
发表于 2015-10-13 15:49 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
NETEZZA数据库支持for循环和游标,sql递归操作吗?
如题,请问NETEZZA支持吗?
客户使用的是NETEZZA数据库,公司的产品代码得从oracle上面迁移过去,请问netezza数据库的功能上面有什么不支持oracle语法的吗?

之前查了netezza对正则函数的支持,好像regexp_replace,regexp_like是支持的,但是没有regexp_substr函数。

求教大神啊~~~~

论坛徽章:
38
授权会员
日期:2005-10-30 17:05:332012新春纪念徽章
日期:2012-02-13 15:12:09现任管理团队成员
日期:2011-11-07 09:46:59ITPUB十周年纪念徽章
日期:2011-11-01 16:19:41ITPUB9周年纪念徽章
日期:2010-10-08 09:31:21版主3段
日期:2012-05-15 15:24:112009新春纪念徽章
日期:2009-01-04 14:52:282010新春纪念徽章
日期:2010-03-01 11:06:202009日食纪念
日期:2009-07-22 09:30:00祖国60周年纪念徽章
日期:2009-10-09 08:28:00
2#
发表于 2015-10-16 01:29 | 只看该作者

使用道具 举报

回复
论坛徽章:
3
优秀写手
日期:2014-04-05 06:00:12慢羊羊
日期:2015-03-04 14:53:332015年新春福章
日期:2015-03-06 11:58:39
3#
 楼主| 发表于 2015-10-19 09:19 | 只看该作者
guostong 发表于 2015-10-16 01:29
https://www-304.ibm.com/support/knowledgecenter/SSULQD_7.2.0/com.ibm.nz.sproc.doc/c_sproc_iterative_ ...

感谢版主啊!对ibm的东西一直不那么熟悉,想另外问一下,这个是IBM产品的知识库,怎么查不到db2的内容呢?

使用道具 举报

回复
论坛徽章:
3
优秀写手
日期:2014-04-05 06:00:12慢羊羊
日期:2015-03-04 14:53:332015年新春福章
日期:2015-03-06 11:58:39
4#
 楼主| 发表于 2015-10-23 15:16 | 只看该作者
guostong 发表于 2015-10-16 01:29
https://www-304.ibm.com/support/knowledgecenter/SSULQD_7.2.0/com.ibm.nz.sproc.doc/c_sproc_iterative_ ...

版主大虾,netezza执行动态sql的时候,除了能执行动态DML,DDL语句,能获取出动态执行的结果放到变量里吗?类似这样:
v_sql := 'select round(2.222,2) from dual '
execute immediate v_sql into v_cnt

使用道具 举报

回复
论坛徽章:
3
优秀写手
日期:2014-04-05 06:00:12慢羊羊
日期:2015-03-04 14:53:332015年新春福章
日期:2015-03-06 11:58:39
5#
 楼主| 发表于 2015-10-23 15:30 | 只看该作者
guostong 发表于 2015-10-16 01:29
https://www-304.ibm.com/support/knowledgecenter/SSULQD_7.2.0/com.ibm.nz.sproc.doc/c_sproc_iterative_ ...

E文阅读能力有限....
仔细看了你发的ibm知识库网站,找到了如下内容:
https://www-304.ibm.com/support/ ... ynamic_queries.html

A query run by an EXECUTE IMMEDIATE statement is prepared each time the statement is run. The query string can be dynamically created within the procedure to do actions on different tables and fields.

The results from SELECT queries are discarded by EXECUTE IMMEDIATE, and SELECT INTO is not currently supported within EXECUTE IMMEDIATE. So, the only way to extract a result from a dynamically created SELECT is to use the FOR ... EXECUTE form, described in Iterate through the records of a query.

好像是说select into 不能用在execute immediate里,唯一能提取动态select结果是使用 FOR...EXECUTE .
然后按照提示的有点开了:Iterate through the records of a query.

https://www-304.ibm.com/support/ ... hrough_records.html

The FOR-IN EXECUTE statement is another way to iterate over records:
[<<label>>]
FOR record | row IN EXECUTE text_expression LOOP
    statements
END LOOP;
This form is similar to the previous form, except that the source SELECT statement is specified as a string expression. The main difference between the two is the syntax and use of variables to build the SQL to run. The first form is faster to evaluate.

这里看了个半懂,但是没有例子,还是不清楚怎么用。版主能帮我看下吗?

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表