gpt4 book ai didi

Postgresql 错误没有函数匹配给定的名称和参数类型。您可能需要添加显式类型转换

转载 作者:行者123 更新时间:2023-12-02 02:51:16 25 4
gpt4 key购买 nike

declare r double precision; b double precision; c double precision;
begin

r:=9.2;
b:=2.3;
c:=r/b;

select log(2.7, c);
...

但是我收到这段代码的错误:

ERROR: function log(numeric, double precision) does not exist LINE 1: select log(2.7, c)

HINT: No function matches the given name and argument types. You might need to add explicit type casts.

QUERY: select log(2.7, c) CONTEXT: PL/pgSQL function inline_code_block line 11 at SQL statement SQL state: 42883

最佳答案

As documented in the manual带有两个参数的 log() 函数需要 numeric 而不是 double precision

do
$$
declare
r numeric;
b numeric;
c numeric;
result numeric;
begin

r:=9.2;
b:=2.3;
c:=r/b;

result := log(2.7, c);
raise notice 'Result %', result;
end;
$$

关于Postgresql 错误没有函数匹配给定的名称和参数类型。您可能需要添加显式类型转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61935033/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com