1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[SQL] Oracle SQL - select from view more rows than running select in the view

Discussão em 'Outras Linguagens' iniciado por Stack, Setembro 30, 2024 às 22:12.

  1. Stack

    Stack Membro Participativo

    When I run this SQL, I get 116,463 rows. select * from appsdisc.appsdisc_phones_gen_v

    When I run the select that is in the view definition script, I get 11,702 rows.

    I can't figure out why the result set is different.

    The view script is as follows.

    CREATE OR REPLACE FORCE VIEW APPSDISC.APPSDISC_PHONES_GEN_V
    (PARTY_ID, CUSTOMER_ID, CUSTOMER_NUMBER, PHONE_NUMBER, PHONE_TYPE)
    AS
    SELECT party_id,
    customer_id,
    customer_number,
    phone_number,
    phone_type
    FROM appsdisc_phones_v pv1
    WHERE pv1.phone_type LIKE
    DECODE (TRIM (SUBSTR (pv1.attribute14, 1, 4)),
    'FR', 'FR T%',
    'PHONE')
    AND pv1.contact_point_id =
    (SELECT MIN (pv2.contact_point_id)
    FROM appsdisc_phones_v pv2
    WHERE pv2.customer_id = pv1.customer_id
    AND pv2.phone_type LIKE
    DECODE (
    TRIM (SUBSTR (pv1.attribute14, 1, 4)),
    'FR', 'FR T%',
    'PHONE'));

    Continue reading...

Compartilhe esta Página