【KingbaseES】实现MySql函数WEEKS_BETWEEN

WEEKS_BETWEEN

CREATE OR REPLACE FUNCTION weeks_between(start_date date, end_date date) 
RETURNS integer AS $$ BEGIN RETURN EXTRACT(WEEK FROM end_date) - EXTRACT(WEEK FROM start_date); 
END; 
$$ LANGUAGE plpgsql IMMUTABLE;

结果展示
【KingbaseES】实现MySql函数WEEKS_BETWEEN_第1张图片

你可能感兴趣的:(金仓数据库KingbaseES,PostgreSQL,MySql,mysql,数据库)