Oracle doesn't return all rows

392 Views Asked by At

I created a simple application for getting some data from Oracle. The application is written in Lazarus and uses ZeosLib and Oracle client (oci.dll) for connecting to the server. Oracle admin prepared me a View for getting my data. i don't knot how is it build. When I get run the script using field IDWYDZ then about 200 rows is returned (not all), when I comment out the field IDWYDZ or when I replace it with empty field ie. '' as IDWYDZ then I get all 500 rows. Why including or excluding column affects the number of rows returned?

SELECT
    SKROT as IDPROD
    , substr( REPLACE( LTRIM(RTRIM(CAST(NAZWA AS NVARCHAR2(100)))), '''', '`'), 1, 49) as NAZPROD
    , substr( REPLACE( LTRIM(RTRIM(CAST(OPIS1 AS NVARCHAR2(255)))), '''', '`'), 1, 49) as OPIS1
    , substr( REPLACE( LTRIM(RTRIM(CAST(OPIS2 AS NVARCHAR2(255)))), '''', '`'), 1, 49) as OPIS2
    , substr( REPLACE( LTRIM(RTRIM(CAST(PREFIX AS NVARCHAR2(255)))), '''', '`'), 1, 49) as OPIS3
    , substr( LTRIM(RTRIM(CAST(OPIS1 AS NVARCHAR2(100)))), 1, 30) as IDGRUPY
    , SUBSTR(JM,1, 10) AS JM
    , CENA_SPRZ AS CENA
    , EAN AS EAN13
    , 'R' as TYPBOM
    , case when SKROT<'140000' then 'M' else 'K' end as TYPPROD
    --, FD_DZIAL AS IDWYDZ
FROM
    ACME.EXPORT_VIEW_KAS
WHERE
    DATA_MODYF>=(CURRENT_DATE-7) AND
    LENGTH(SKROT)>0
order by 
    IDPROD
0

There are 0 best solutions below