我需要一个功能

时间:2018-03-21 07:43:32

标签: sql oracle plsql

我需要在cm_customers $ rt表中创建一个函数来验证驻留客户端,如果TAX_NUMBER是13位数,否则需要显示列表到屏幕,我是创建juste select但我需要一个函数,请帮帮我< / p>

select  TAX_NUMBER,RESIDENT
from cm_customers$rt
WHERE length (TAX_NUMBER) =13 and resident = 'Y'
;

1 个答案:

答案 0 :(得分:0)

CREATE OR REPLACE FUNCTION f_tax
RETURN NUMBER
IS
    V_tax_number  int;

BEGIN
    SELECT tax_number 
    INTO V_tax_number
    FROM E_EMP
    WHERE LENGTH(tax_number ) < 13 
                 AND residence_type = 'Y';
    RETURN V_tax_number;

END;