https://www.cnblogs.com/flyingsanddream/p/10815243.html
按照这个文档改一下
CREATE OR REPLACE FUNCTION FUNC_GET_WEEKOFMONTH (V_PSD DATE)
RETURN varchar2
IS
N_WEEK varchar2(11) ;
BEGIN
SELECT to_char(V_PSD,'yyyymm')||(TO_CHAR (V_PSD, 'IW') - TO_CHAR (TRUNC (V_PSD, 'MM'), 'IW') + 1) INTO N_WEEK FROM DUAL;
RETURN NVL(N_WEEK, 0);
EXCEPTION
WHEN OTHERS
THEN
select 11111111111 into N_WEEK from dual;
RETURN 0;
END FUNC_GET_WEEKOFMONTH;
这是我写的