您知道为什么下面的函数调用在参数中使用通配符不起作用吗?
CREATE OR REPLACE FUNCTION ABC("CUSTCODE" VARCHAR, "CUSTNAME" VARCHAR)
RETURNS TABLE ("CUSTOMER_CODE" VARCHAR, CUSTOMERNAME VARCHAR)
LANGUAGE SQL
AS $$
SELECT CUSTOMER_CODE, CUSTOMERNAME FROM DIM_CUSTOMER
WHERE CUSTNAME is null AND CUSTOMER_CODE ILIKE '%CUSTCODE%'
$$;
我没有得到错误,但也没有找到记录
它似乎不喜欢类似"%CUSTCODE%"的位
感谢
您在代码块内有串引号'
,但代码块用单引号标记。所以以太币兑换成双倍美元$$
CREATE OR REPLACE FUNCTION ABC("CUSTCODE" VARCHAR)
RETURNS TABLE ("CUSTOMER_CODE" VARCHAR, CUSTOMERNAME VARCHAR)
LANGUAGE SQL
AS $$
SELECT CUSTOMER_CODE, CUSTOMERNAME FROM DIM_CUSTOMER
WHERE CUSTOMER_CODE ILIKE '%CUSTCODE%'
$$;
或者在里面用双单曲。。
CREATE OR REPLACE FUNCTION ABC("CUSTCODE" VARCHAR)
RETURNS TABLE ("CUSTOMER_CODE" VARCHAR, CUSTOMERNAME VARCHAR)
LANGUAGE SQL
AS '
SELECT CUSTOMER_CODE, CUSTOMERNAME FROM DIM_CUSTOMER
WHERE CUSTOMER_CODE ILIKE ''%CUSTCODE%''
';