【发布时间】:2020-04-28 19:05:27
【问题描述】:
错误:查询没有结果数据的目的地
提示:如果要丢弃 SELECT 的结果,请改用 PERFORM。
上下文:PL/pgSQL 函数 inline_code_block 第 11 行的 SQL 语句
DO $$
DECLARE
id_renovacion integer := (select Id_renovacionContrato
from BEA.DIM_RENOVACION_CONTRATO where upper(Desc_renovacionContrato) = 'UNDEFINED');
id_renovacionpending integer := (select Id_renovacionContrato
from BEA.DIM_RENOVACION_CONTRATO where upper(Desc_renovacionContrato) = 'PENDING');
BEGIN
SELECT count(id_contrato) as id_cantidad,
CASE when count(id_contrato) = 0 THEN 'ImagesHappyMaritransparente1.png'
when count(id_contrato) is null THEN 'ImagesHappyMaritransparente1.png'
when count(id_contrato) = 1 THEN 'ImagesTITIhappymarycontratos-off-1_145.png'
when count(id_contrato) = 2 THEN 'ImagesTITIhappymarycontratos-off-2_145.png'
when count(id_contrato) = 3 THEN 'ImagesTITIhappymarycontratos-off-3_145.png'
when count(id_contrato) = 4 THEN 'ImagesTITIhappymarycontratos-off-4_145.png'
when count(id_contrato) = 5 THEN 'ImagesTITIhappymarycontratos-off-5_145.png'
when count(id_contrato) = 6 THEN 'ImagesTITIhappymarycontratos-off-6_145.png'
when count(id_contrato) = 7 THEN 'ImagesTITIhappymarycontratos-off-7_145.png'
when count(id_contrato) = 8 THEN 'ImagesTITIhappymarycontratos-off-8_145.png'
when count(id_contrato) = 9 THEN 'ImagesTITIhappymarycontratos-off-9_145.png'
when count(id_contrato) > 9 THEN 'ImagesTITIhappymarycontratos-off-9+_145.png'
END
FROM BEA.FACT_CONTRATOS
WHERE cantDiasDif > 0 AND Id_rangoContrato IN (id_renovacion, id_renovacionpending);
END
$$
LANGUAGE plpgsql; ```
【问题讨论】:
-
错误信息非常具有描述性。你明白它在说什么吗?您打算如何处理选定的数据?
-
您的问题是什么? “你如何避免:
ERROR: query has no destination for result data”?
标签: postgresql