暂无图片
分享
暂无图片 匿名用户
怎么处理金仓数据库中Boolean 与numeric 无法互转的问题

numeric=boolean 报错,无法进行转换

收藏
分享
1条回答
默认
最新
嫣然

V8R6 版本下,无法实现boolean 与 numeric 之间的互转。

具体问题如下:

test=# create or replace function sys_catalog.bool_eq_numeric(bool, numeric) returns bool as $$ select $1::numeric = $2; $$ language sql;

CREATE FUNCTION

test=# create operator sys_catalog.= (procedure = bool_eq_numeric,leftarg = bool,rightarg = numeric,commutator = =);

CREATE OPERATOR

test=#

test=# create or replace function sys_catalog.numeric_eq_bool(numeric, bool) returns bool as $$ select $1 = $2::numeric; $$ language sql;

CREATE FUNCTION

test=# create operator sys_catalog.= (procedure = numeric_eq_bool,leftarg = numeric,rightarg = bool,commutator = =);

CREATE OPERATOR

test=# select 1::numeric=1::int;

ERROR:  operator is not unique: numeric = integer

LINE 1: select 1::numeric=1::int;

                         ^

HINT:  Could not choose a best candidate operator. You might need to add explicit type casts.

暂无图片 评论
暂无图片 有用 0
回答交流
提交
问题信息
请登录之后查看
邀请回答
暂无人订阅该标签,敬请期待~~
暂无图片墨值悬赏