SQL:错误
ERROR: function decode(integer, integer, integer, integer) does not exist at character 30
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
In statement:
请高手指点这句错在哪里?谢谢.
select (trunc(fcall_time/60)+decode(mod(fcall_time,60),0,0,1)) from t_prepaid_history where to_char(fcall_start_time,'YYYYMM')='200809' group by fdest_phone_country_code;
ERROR: function decode(integer, integer, integer, integer) does not exist at character 30
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
In statement:
请高手指点这句错在哪里?谢谢.
select (trunc(fcall_time/60)+decode(mod(fcall_time,60),0,0,1)) from t_prepaid_history where to_char(fcall_start_time,'YYYYMM')='200809' group by fdest_phone_country_code;
RETURNS bytea AS
'binary_decode'
LANGUAGE 'internal' IMMUTABLE STRICT
COST 1;
ALTER FUNCTION decode(text, text) OWNER TO postgres;
COMMENT ON FUNCTION decode(text, text) IS 'convert ascii-encoded text string into bytea value';postgre只有这一个decode的定义,没有你调用的形式
功能描述:把早先用encode编码的,存放在 string 里面的二进制数据解码。 参数类型和encode一样。
例子:decode('MTIzAAE=', 'base64')
RETURNS double precision AS
'dfloor'
LANGUAGE 'internal' IMMUTABLE STRICT
COST 1;
ALTER FUNCTION floor(double precision) OWNER TO postgres;
COMMENT ON FUNCTION floor(double precision) IS 'largest integer <= value';我还没有找到天花板函数。
这个叫地板函数,针对你这样需求的
/60.0后取天花板就是你要的了
CREATE OR REPLACE FUNCTION ceiling(double precision)
RETURNS double precision AS
'dceil'
LANGUAGE 'internal' IMMUTABLE STRICT
COST 1;
ALTER FUNCTION ceiling(double precision) OWNER TO postgres;
COMMENT ON FUNCTION ceiling(double precision) IS 'smallest integer >= value';
select cast((consume_time/60)+1 as integer) from a