加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Greenplum的Oracle兼容性函数

发布时间:2020-12-12 16:21:58 所属栏目:百科 来源:网络整理
导读:许多Oracle的SQL函数可以应用到Greenplum数据库中。Greenplum默认安装完成后并不能使用Oracle的兼容性函数。 template1=# select nvl(null,2); ERROR: function nvl(unknown,integer) does not exist LINE 1: select nvl(null,2); 在使用任何Oracle兼容函数之
许多Oracle的SQL函数可以应用到Greenplum数据库中。Greenplum默认安装完成后并不能使用Oracle的兼容性函数。 template1=# select nvl(null,2); ERROR: function nvl(unknown,integer) does not exist LINE 1: select nvl(null,2); 在使用任何Oracle兼容函数之前,你必须为每个数据库执行下面的安装脚本(示例为testdb数据库): psql -d testdb -f $GPHOME/share/postgresql/contrib/orafunc.sql 当然你也可以卸载Oracle函数: psql -d testdb -f $GPHOME/share/postgresql/contrib/uninstall_orafunc.sql 安装完成后,如果直接在testdb数据库中使用还会找不到Oracle的相关函数,比如: testdb=# select nvl(null,8); ERROR: function nvl(unknown,8); ^ HINT: No function matches the given name and argument types. You may need to add explicit type casts. 我们查看schema是搜索路径: testdb=# show search_path ; search_path ---------------- "$user",public Oracle的兼容函数都安装在oracompat的schema下面。为了访问这些Oracle函数,可以指定oracompat前缀或者修改数据库的搜索路径: ALTER DATABASE testdb SET search_path = "$user",public,oracompat; 然后重新登录Greenplum环境: [gpadmin@cdha postgresql]$ psql -d testdb psql (8.2.15) Type "help" for help. testdb=# select nvl(null,8); nvl ----- 8 可以看到Greenplum中可以正常使用Oracle的兼容函数了。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读