Please, the condition don't filter, Why??????

  • From: "Juan Carlos Reyes Pacheco" <jreyes@xxxxxxxxxxxxxxxx>
  • To: "oracle-l@xxxxxxxxxxxxx" <oracle-l@xxxxxxxxxxxxx>
  • Date: Fri, 19 Nov 2004 22:29:55 -0400

Hi I can't filter a query, what I'm doing wrong, please
 
This is the query
SELECT TIPO, CTP_COD, CTP_NOMBRE
FROM SOA.VEW_STR_CONTRAPARTE 
WHERE ((CTP_TIPO_CTPTE IS NULL OR CTP_TIPO_CTPTE= 'AGB' )) AND 
(INC_CODCLI_TIT = NVL(NULL,-1) OR INC_CODCLI_TIT IS NULL ) AND
INC_TIPO = 'P' AND CTP_COD='CNC';
and it returns all rows from the table ( in thery it only have to return the
one that has CTP_COD='CNC'
 
The reason is the CTP_TIPO_CTPTE IS NULL , even when it is in parenthesis,
it works like a LIKE '%'
Some one understands why?
I suppose this is a bug or is this a misunderstanding of sql.
Thanks.
 
This is the query
CREATE OR REPLACE VIEW soa.vew_str_contraparte (
tipo,
ctp_cod,
ctp_nombre,
ctp_tipo_ctpte,
inc_tipo,
inc_codcli_tit )
AS
SELECT 'Z' TIPO,'ZZE' CTP_COD, 'EMISOR' CTP_NOMBRE, NULL CTP_TIPO_CTPTE,
NULL INC_TIPO, NULL INC_CODCLI_TIT 
FROM DUAL
UNION ALL
SELECT 'Z' TIPO,'ZZC' CTP_COD, 'CLIENTE' CTP_NOMBRE, NULL CTP_TIPO_CTPTE,
NULL INC_TIPO, NULL INC_CODCLI_TIT 
FROM DUAL
UNION ALL
SELECT 'C' TIPO, CTP_COD, CTP_NOMBRE,CTP_TIPO_CTPTE, NULL INC_TIPO, NULL
INC_CODCLI_TIT 
FROM CONTRAPARTE
UNION ALL
SELECT 'I' TIPO,A.INT_COD CTP_COD,EMP_NOMBRE CTP_NOMBRE, NULL CTP_TIPO_CTPTE
 INC_TIPO , INC_CODCLI_TIT
FROM SOA.INTERM A, ADM.EMPRESAS B, INTERM_CTA C
WHERE A.EMP_RUC=B.EMP_RUC AND A.INT_COD=C.INT_COD
ORDER BY 1,2
/
 
Juan Carlos Reyes Pacheco
OCP
--
//www.freelists.org/webpage/oracle-l

Other related posts: