Greenplum的Oracle兼容性函数
来源:互联网 发布:现在卖域名还赚钱吗 编辑:程序博客网 时间:2024/05/07 12:14
许多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, integer) does not exist
LINE 1: select nvl(null,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的兼容函数了。
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, integer) does not exist
LINE 1: select nvl(null,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的兼容函数了。
0 0
- Greenplum的Oracle兼容性函数
- Greenplum函数
- GreenPlum 集群中通过orafunc实现Oracle兼容函数
- Greenplum同步到Oracle
- oracle导入到GreenPlum
- 安装Greenplum导致oracle rac无法启动的事故
- 安装Greenplum导致oracle rac无法启动的事故
- Greenplum中的函数
- GREENPLUM中的gp_dist_random()函数
- GreenPlum常用函数(日期)
- greenplum last_value()函数
- GreenPlum常用字符串函数
- GreenPlum常用时间函数
- Greenplum自定义递归函数
- Greenplum聚合函数的两种实现:HashAggregate与GroupAggregate
- Greenplum聚合函数的两种实现:HashAggregate与GroupAggregate
- greenplum 日期及时间函数及时间的加减
- DB2V9.7和Oracle的兼容性
- 第一篇iOS博客
- From detailed models to formal spiking neurons
- hadoop-2.7.2运行WordCount
- B+树|MYSQL索引使用原则
- 点击控件以外的地方隐藏控件
- Greenplum的Oracle兼容性函数
- BZOJ 3060
- TextView属性的简单使用
- 【C/C++】:string到double和string到int的转换
- 李航《统计机器学习》第5章 决策树
- Centos 安装 nodejs、npm
- 详解属性封装
- 如何用C#将输出到文本文件中的内容换行?
- iOS id、NSObject、id<NSObject>的区别