View with columns based on function - problem with query

Hi,
I'm using Oracle 9i;
I've created a view which has columns based on a table columns (multiple columns from 1 table) and funtion (multiple columns based on 1 function).
The function takes ID as the first argument and name of the column to determine which value to return as the second one.
Here is a sample of such function (simplified):
FUNCTION my_function
(in_id IN NUMBER, in_col_name IN VARCHAR2)
RETURN VARCHAR2
IS
c_name VARCHAR2(100);
c_last_name VARCHAR2(100);
BEGIN
SELECT T.NAME, T.LAST_NAME
INTO c_name, c_last_name
FROM TABLE_1 T, TABLE_2 Z
WHERE T.PK = Z.FK
AND Z.ID = in_id;
IF in_col_name = 'NAME' THEN
RETURN c_name;
ELSIF in_col_name = 'LAST_NAME' THEN
RETURN c_last_name;
END IF;
END;
For simplicty I've restricted the number of columns.
CREATE OR REPLACE VIEW my_view
(ID, NAME, LAST_NAME)
AS
SELECT
T.ID ID
,CAST(my_function(T.ID,'NAME') AS VARCHAR2(100)) NAME
,CAST(my_function(T.ID,'LAST_NAME') AS VARCHAR2(100)) LAST_NAME
FROM TABLE T;
There is no problem with query:
SELECT * FROM my_view;
The problem arises when I query the view (regardles of '=' or 'LIKE'):
SELECT * FROM my_view
WHERE name LIKE '%some_part_of_name%'
The query returns rows for same names, for same it doesn't. If I put '=' and the whole name the query returns nothing, but when I put 'LIKE' and the first letter it returns rows in some cases.
I've tried to debug this situation and I've discovered that the function recives ID not in the proper order and not the same amount of times - in explicit:
for each ID in (1, 2, 3, 4, 5, 6, ... , 100) the function should be called twice for each ID and in the same order, but it does not.
I get 1, 1, 2, 3, 3, 6, 20, 20 and so on.
Help needed.
Greetings.

The problem is more complicated than the solutions provided here.
The reason why I'm using the function is this:
the original view was constructed using multiple union all selects and the speed was terrible. I've created the index on the base table to obtain a proper sort. For retriving all records at once the view works perfectly, but if one wants to query by columns based on function the results are suprisng - sometimes there are, some times there are none, or if you serch with "like" and only a part of string there are results, but with "=" there are no results.
Here are real DDLs:
View:
CREATE OR REPLACE VIEW V_DOK_ARCH
(ID_ZDAR, TYP, STAN, DATE_CREATED, CREATED_BY,
DATE_MODIFIED, MODIFIED_BY, SPRA_ID_SPRA, PODM_ID_PODM, PODM_UMOW_ID_UMOW,
NR_WFS, WFS_NR_INTER, UWAGI_OPER, FUNDUSZ, NUMER,
DATA_PODPISANIA, RODZAJ, TYP_PRZY, TYP_UBEZ, NAZWISKO,
IMIE, IMIE_OJCA, NAZWA_FIRMY, NAZWA_FIRMY_SKR, DANE_KLIE)
AS
SELECT /*+ INDEX(Z ZDAR_DATE_CREATED_DESC_I) */
Z.ID_ZDAR ID_ZDAR
, Z.TYP TYP
, Z.STAN STAN
, Z.DATE_CREATED DATE_CREATED
, Z.CREATED_BY CREATED_BY
, Z.DATE_MODIFIED DATE_MODIFIED
, Z.MODIFIED_BY MODIFIED_BY
, Z.SPRA_ID_SPRA SPRA_ID_SPRA
, Z.PODM_ID_PODM PODM_ID_PODM
, Z.PODM_UMOW_ID_UMOW PODM_UMOW_ID_UMOW
, Z.NR_WFS NR_WFS
, Z.WFS_NR_INTER WFS_NR_INTER
, Z.UWAGI_OPER UWAGI_OPER
, Z.FUNDUSZ FUNDUSZ
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'NUMER') AS VARCHAR2(30)) NUMER
, F_Rej_Zdar_Date(Z.ID_ZDAR, 'DATA_PODPISANIA') DATA_PODPISANIA
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'RODZAJ') AS VARCHAR2(4)) RODZAJ
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'TYP_PRZY') AS VARCHAR2(4)) TYP_PRZY
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'TYP_UBEZ') AS VARCHAR2(3)) TYP_UBEZ
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'NAZWISKO') AS VARCHAR2(30)) NAZWISKO
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'IMIE') AS VARCHAR2(30)) IMIE
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'IMIE_OJCA') AS VARCHAR2(30)) IMIE_OJCA
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'NAZWA_FIRMY') AS VARCHAR2(300)) NAZWA_FIRMY
, CAST(F_Rej_Zdar_Char(Z.ID_ZDAR, 'NAZWA_FIRMY_SKR') AS VARCHAR2(100)) NAZWA_FIRMY_SKR
, CAST(LTRIM(F_Rej_Zdar_Char(Z.ID_ZDAR, 'NAZWISKO')||' '||F_Rej_Zdar_Char(Z.ID_ZDAR, 'IMIE')||' '||F_Rej_Zdar_Char(Z.ID_ZDAR, 'IMIE_OJCA')||F_Rej_Zdar_Char(Z.ID_ZDAR, 'NAZWA_FIRMY')||DECODE(F_Rej_Zdar_Char(Z.ID_ZDAR, 'NAZWA_FIRMY'),NULL,F_Rej_Zdar_Char(Z.ID_ZDAR, 'NAZWA_FIRMY_SKR'),NULL)) AS VARCHAR2(492)) DANE_KLIE
FROM T_ZDARZENIA Z
WHERE F_Rej_Zdar_Char(Z.ID_ZDAR, 'JEST') = 'T';
and functions:
CREATE OR REPLACE FUNCTION F_Rej_Zdar_Char
(WE_ID_ZDAR IN NUMBER
,WE_KOLUMNA IN VARCHAR2
RETURN VARCHAR2
IS
c_numer           T_PRZYSTAPIENIA.NUMER%TYPE;--VARCHAR2(30);
c_rodzaj           T_KLIENCI.RODZAJ%TYPE;--VARCHAR2(1);
c_typ_przy           T_PRZYSTAPIENIA.TYP_PRZY%TYPE;--VARCHAR2(1);
c_typ_ubez           T_PRZYSTAPIENIA.TYP_UBEZ%TYPE;--VARCHAR2(3);
c_nazwisko           T_KLIENCI.NAZWISKO%TYPE;--VARCHAR2(30);
c_imie                T_KLIENCI.IMIE%TYPE;--VARCHAR2(30);
c_imie_ojca      T_KLIENCI.IMIE_OJCA%TYPE;--VARCHAR2(30);
c_nazwa_firmy      T_KLIENCI.NAZWA_FIRMY%TYPE;--VARCHAR2(300);
c_nazwa_firmy_skr T_KLIENCI.NAZWA_FIRMY%TYPE;--VARCHAR2(100);
c_jest                VARCHAR2(1) := 'T';
c EXCEPTION;
BEGIN
--dbms_output.put_line('id zdar wykonania '||WE_ID_ZDAR);
BEGIN
SELECT p.NUMER, k.RODZAJ,p.TYP_PRZY,p.TYP_UBEZ,k.nazwisko, k.imie, k.imie_ojca, k.nazwa_firmy, k.nazwa_firmy_skr
INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
FROM T_KLIENCI k, T_PRZYSTAPIENIA p, T_ZDARZENIA z, T_PODMIOTY D1, T_PODMIOTY D2
WHERE p.KLIE_ID_KLIE = k.ID_KLIE
AND z.PODM_ID_PODM = D1.ID_PODM
AND D1.KLIE_ID_KLIE = p.KLIE_ID_KLIE
AND Z.PODM_UMOW_ID_UMOW = D2.ID_PODM
AND D2.PRZY_ID_PRZY = P.ID_PRZY
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
     WHEN NO_DATA_FOUND THEN
     BEGIN
     SELECT p.NUMER, k.RODZAJ,p.TYP_PRZY,p.TYP_UBEZ,k.nazwisko, k.imie, k.imie_ojca, k.nazwa_firmy, k.nazwa_firmy_skr
     INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
     FROM T_KLIENCI k, T_PRZYSTAPIENIA p, T_ZDARZENIA z, T_PODMIOTY D
     WHERE z.PODM_UMOW_ID_UMOW IS NULL
     AND z.PODM_ID_PODM = D.ID_PODM
     AND D.KLIE_ID_KLIE = k.ID_KLIE
     AND p.KLIE_ID_KLIE = k.ID_KLIE
     AND z.ID_ZDAR = WE_ID_ZDAR;
     EXCEPTION
          WHEN NO_DATA_FOUND THEN
          BEGIN
          SELECT NULL NUMER, NULL RODZAJ,NULL TYP_PRZY,NULL TYP_UBEZ, I.nazwisko, I.imie, I.imie_ojca, I.NAZWA NAZWA_FIRMY, I.NAZWA_SKR nazwa_firmy_skr
          INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
          FROM T_ZDARZENIA z, T_INSTYTUCJE I
          WHERE Z.TYP IN ('WFS526','WFS542','WFS553','WFS609','WFS611','WYP_KS','WYP_PO','WYP_SB','DI_ZAT')
          AND z.PODM_UMOW_ID_UMOW IS NULL
          AND Z.PODM_ID_PODM = I.ID_INST
          AND z.ID_ZDAR = WE_ID_ZDAR;
          EXCEPTION
               WHEN NO_DATA_FOUND THEN
               BEGIN
               SELECT p.NUMER NUMER, DECODE(a.TYP_AGENTA,'A','F','P') RODZAJ, DECODE(a.TYP_AGENTA,'P','R',a.TYP_AGENTA) TYP_PRZY,NULL TYP_UBEZ,a.nazwisko, a.imie, a.imie_ojca, a.nazwa_firmy, a.nazwa_firmy_skr
               INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
               FROM T_AG_AGENCI a, T_AG_UMOWY p, T_ZDARZENIA z
               WHERE a.ID_AGAG = p.AGAG_ID_AGAG
               AND z.PODM_UMOW_ID_UMOW = p.ID_AGUM
               AND z.ID_ZDAR = WE_ID_ZDAR;
               EXCEPTION
                    WHEN NO_DATA_FOUND THEN
                    BEGIN
                    SELECT p.NUMER NUMER, DECODE(a.TYP_AGENTA,'A','F','P') RODZAJ, DECODE(a.TYP_AGENTA,'P','R',a.TYP_AGENTA) TYP_PRZY,NULL TYP_UBEZ,a.nazwisko, a.imie, a.imie_ojca, a.nazwa_firmy, a.nazwa_firmy_skr
                    INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
                    FROM T_AG_AGENCI a, T_AG_UMOWY p, T_ZDARZENIA z
                    WHERE a.ID_AGAG = p.AGAG_ID_AGAG
                    AND z.PODM_ID_PODM = a.ID_AGAG
                    AND z.PODM_UMOW_ID_UMOW IS NULL
                    AND z.ID_ZDAR = WE_ID_ZDAR;
                    EXCEPTION
                         WHEN NO_DATA_FOUND THEN
                         BEGIN
                         SELECT p.NUMER_UMOWY NUMER, DECODE(p.TYP_AGENTA,'A','F','P') RODZAJ, DECODE(p.TYP_AGENTA,'P','R',p.TYP_AGENTA) TYP_PRZY,NULL TYP_UBEZ,p.nazwisko, p.imie_pierwsze, p.imie_ojca, p.nazwa_firmy, p.nazwa_firmy_skr
                         INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
                         FROM T_AG_KANDYDACI a, T_AG_UMOWY_TAB p, T_ZDARZENIA z
                         WHERE a.ID_AGKAN = p.TECH_PODM_ID_PODM
                         AND z.PODM_UMOW_ID_UMOW = p.TECH_ID_AGUMT
                         AND z.ID_ZDAR = WE_ID_ZDAR;
                         EXCEPTION
                              WHEN NO_DATA_FOUND THEN
                              BEGIN
                              SELECT p.NUMER_UMOWY NUMER, DECODE(p.TYP_AGENTA,'A','F','P') RODZAJ, DECODE(p.TYP_AGENTA,'P','R',p.TYP_AGENTA) TYP_PRZY,NULL TYP_UBEZ,p.nazwisko, p.imie_pierwsze, p.imie_ojca, p.nazwa_firmy, p.nazwa_firmy_skr
                              INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
                              FROM T_AG_KANDYDACI a, T_AG_UMOWY_TAB p, T_ZDARZENIA z
                              WHERE a.ID_AGKAN = p.TECH_PODM_ID_PODM
                              AND z.PODM_ID_PODM = a.ID_AGKAN
                              AND z.PODM_UMOW_ID_UMOW IS NULL
                              AND z.ID_ZDAR = WE_ID_ZDAR;
                              EXCEPTION
                                   WHEN NO_DATA_FOUND THEN
                                   BEGIN
                                   SELECT k.NUMER_UMOWY NUMER, DECODE(k.TYP_PRZYSTAPIENIA,'P','F','P') RODZAJ,k.TYP_PRZYSTAPIENIA TYP_PRZY,'NPO' TYP_UBEZ, k.nazwisko, k.imie_pierwsze, k.imie_ojca, k.nazwa_firmy nazwa_firmy, k.nazwa_firmy_skr nazwa_firmy_skr
                                   INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
                                   FROM T_WE_UM_NPO_TAB k, T_ZDARZENIA z
                                   WHERE z.ID_ZDAR = k.TECH_ZDAR_ID_ZDAR
                                   AND k.TYP_PRZYSTAPIENIA IN ('P','W')
                                   AND z.PODM_ID_PODM IS NULL
                                   AND z.PODM_UMOW_ID_UMOW IS NULL
                                   AND z.ID_ZDAR = WE_ID_ZDAR;
                                   EXCEPTION
                                        WHEN NO_DATA_FOUND THEN
                                        BEGIN
                                        SELECT k.NUMER_UMOWY NUMER, 'F' RODZAJ,'-' TYP_PRZY,'OPS' TYP_UBEZ, k.nazwisko, k.imie_pierwsze, k.imie_ojca, NULL nazwa_firmy, NULL nazwa_firmy_skr
                                        INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
                                        FROM T_WE_UM_OPS_TAB k,T_ZDARZENIA z
                                        WHERE z.ID_ZDAR = k.TECH_ZDAR_ID_ZDAR
                                        AND z.PODM_ID_PODM IS NULL
                                        AND z.PODM_UMOW_ID_UMOW IS NULL
                                        AND z.ID_ZDAR = WE_ID_ZDAR;
                                        EXCEPTION
                                             WHEN NO_DATA_FOUND THEN
                                             BEGIN
                                             SELECT NULL NUMER, NULL RODZAJ,NULL TYP_PRZY,NULL TYP_UBEZ, NULL nazwisko, NULL imie_pierwsze, NULL imie_ojca, NULL nazwa_firmy, NULL nazwa_firmy_skr
                                             INTO c_numer, c_rodzaj, c_typ_przy, c_typ_ubez, c_nazwisko, c_imie, c_imie_ojca, c_nazwa_firmy, c_nazwa_firmy_skr
                                             FROM T_ZDARZENIA z
                                             WHERE z.TYP NOT IN ('UM_OPS','UM_NPO','NPO_OP','UZUP_U')
                                             AND z.PODM_ID_PODM IS NULL
                                             AND z.PODM_UMOW_ID_UMOW IS NULL
                                             AND z.ID_ZDAR = WE_ID_ZDAR;
                                             EXCEPTION
                                                  WHEN NO_DATA_FOUND THEN
                                                       --dbms_output.put_line('id zdar wykonania '||WE_ID_ZDAR||' ostatni wyjatek');
                                                       NULL;
                                             END;
                                        END;
                                   END;
                              END;
                         END;
                    END;
               END;
          END;
     END;
END;
--raise c;
IF WE_KOLUMNA = 'NUMER' THEN
RETURN c_numer;
ELSIF WE_KOLUMNA = 'RODZAJ' THEN
RETURN c_rodzaj;
ELSIF WE_KOLUMNA = 'TYP_PRZY' THEN
RETURN c_typ_przy;
ELSIF WE_KOLUMNA = 'TYP_UBEZ' THEN
RETURN c_typ_ubez;
ELSIF WE_KOLUMNA = 'NAZWISKO' THEN
RETURN c_nazwisko;
ELSIF WE_KOLUMNA = 'IMIE' THEN
RETURN c_imie;
ELSIF WE_KOLUMNA = 'IMIE_OJCA' THEN
RETURN c_imie_ojca;
ELSIF WE_KOLUMNA = 'NAZWA_FIRMY' THEN
RETURN c_nazwa_firmy;
ELSIF WE_KOLUMNA = 'NAZWA_FIRMY_SKR' THEN
RETURN c_nazwa_firmy_skr;
ELSIF WE_KOLUMNA = 'JEST' THEN
RETURN c_jest;
END IF;
END;
CREATE OR REPLACE FUNCTION F_Rej_Zdar_Date
(WE_ID_ZDAR IN NUMBER
,WE_KOLUMNA IN VARCHAR2
RETURN DATE
IS
d_data DATE;
BEGIN
BEGIN
SELECT p.DATA_PODPISANIA
INTO d_data
FROM T_KLIENCI k, T_PRZYSTAPIENIA p, T_ZDARZENIA z, T_PODMIOTY D1, T_PODMIOTY D2
WHERE p.KLIE_ID_KLIE = k.ID_KLIE
AND z.PODM_ID_PODM = D1.ID_PODM
AND D1.KLIE_ID_KLIE = p.KLIE_ID_KLIE
AND Z.PODM_UMOW_ID_UMOW = D2.ID_PODM
AND D2.PRZY_ID_PRZY = P.ID_PRZY
AND z.ID_ZDAR = WE_ID_ZDAR;
EXCEPTION
     WHEN NO_DATA_FOUND THEN
     BEGIN
     SELECT p.DATA_PODPISANIA
     INTO d_data
     FROM T_KLIENCI k, T_PRZYSTAPIENIA p, T_ZDARZENIA z, T_PODMIOTY D
     WHERE z.PODM_UMOW_ID_UMOW IS NULL
     AND z.PODM_ID_PODM = D.ID_PODM
     AND D.KLIE_ID_KLIE = k.ID_KLIE
     AND p.KLIE_ID_KLIE = k.ID_KLIE
     AND z.ID_ZDAR = WE_ID_ZDAR;
     EXCEPTION
          WHEN NO_DATA_FOUND THEN
          BEGIN
          SELECT NULL DATA_PODPISANIA
          INTO d_data
          FROM T_ZDARZENIA z, T_INSTYTUCJE I
          WHERE Z.TYP IN ('WFS526','WFS542','WFS553','WFS609','WFS611','WYP_KS','WYP_PO','WYP_SB','DI_ZAT')
          AND z.PODM_UMOW_ID_UMOW IS NULL
          AND Z.PODM_ID_PODM = I.ID_INST
          AND z.ID_ZDAR = WE_ID_ZDAR;
          EXCEPTION
               WHEN NO_DATA_FOUND THEN
               BEGIN
               SELECT p.DATA_PODPISANIA DATA_PODPISANIA
               INTO d_data
               FROM T_AG_AGENCI a, T_AG_UMOWY p, T_ZDARZENIA z
               WHERE a.ID_AGAG = p.AGAG_ID_AGAG
               AND z.PODM_UMOW_ID_UMOW = p.ID_AGUM
               AND z.ID_ZDAR = WE_ID_ZDAR;
               EXCEPTION
                    WHEN NO_DATA_FOUND THEN
                    BEGIN
                    SELECT p.DATA_PODPISANIA DATA_PODPISANIA
                    INTO d_data
                    FROM T_AG_AGENCI a, T_AG_UMOWY p, T_ZDARZENIA z
                    WHERE a.ID_AGAG = p.AGAG_ID_AGAG
                    AND z.PODM_ID_PODM = a.ID_AGAG
                    AND z.PODM_UMOW_ID_UMOW IS NULL
                    AND z.ID_ZDAR = WE_ID_ZDAR;
                    EXCEPTION
                         WHEN NO_DATA_FOUND THEN
                         BEGIN
                         SELECT p.DATA_PODPISU_AGENTA DATA_PODPISANIA
                         INTO d_data
                         FROM T_AG_KANDYDACI a, T_AG_UMOWY_TAB p, T_ZDARZENIA z
                         WHERE a.ID_AGKAN = p.TECH_PODM_ID_PODM
                         AND z.PODM_UMOW_ID_UMOW = p.TECH_ID_AGUMT
                         AND z.ID_ZDAR = WE_ID_ZDAR;
                         EXCEPTION
                              WHEN NO_DATA_FOUND THEN
                              BEGIN
                              SELECT p.DATA_PODPISU_AGENTA DATA_PODPISANIA
                              INTO d_data
                              FROM T_AG_KANDYDACI a, T_AG_UMOWY_TAB p, T_ZDARZENIA z
                              WHERE a.ID_AGKAN = p.TECH_PODM_ID_PODM
                              AND z.PODM_ID_PODM = a.ID_AGKAN
                              AND z.PODM_UMOW_ID_UMOW IS NULL
                              AND z.ID_ZDAR = WE_ID_ZDAR;
                              EXCEPTION
                                   WHEN NO_DATA_FOUND THEN
                                   BEGIN
                                   SELECT k.DATA_PODPISANIA_UM DATA_PODPISANIA
                                   INTO d_data
                                   FROM T_WE_UM_NPO_TAB k, T_ZDARZENIA z
                                   WHERE z.ID_ZDAR = k.TECH_ZDAR_ID_ZDAR
                                   AND k.TYP_PRZYSTAPIENIA IN ('P','W')
                                   AND z.PODM_ID_PODM IS NULL
                                   AND z.PODM_UMOW_ID_UMOW IS NULL
                                   AND z.ID_ZDAR = WE_ID_ZDAR;
                                   EXCEPTION
                                        WHEN NO_DATA_FOUND THEN
                                        BEGIN
                                        SELECT k.DATA_PODPISANIA_UM DATA_PODPISANIA
                                        INTO d_data
                                        FROM T_WE_UM_OPS_TAB k,T_ZDARZENIA z
                                        WHERE z.ID_ZDAR = k.TECH_ZDAR_ID_ZDAR
                                        AND z.PODM_ID_PODM IS NULL
                                        AND z.PODM_UMOW_ID_UMOW IS NULL
                                        AND z.ID_ZDAR = WE_ID_ZDAR;
                                        EXCEPTION
                                             WHEN NO_DATA_FOUND THEN
                                             BEGIN
                                             SELECT NULL DATA_PODPISANIA
                                             INTO d_data
                                             FROM T_ZDARZENIA z
                                             WHERE z.TYP NOT IN ('UM_OPS','UM_NPO','NPO_OP','UZUP_U')
                                             AND z.PODM_ID_PODM IS NULL
                                             AND z.PODM_UMOW_ID_UMOW IS NULL
                                             AND z.ID_ZDAR = WE_ID_ZDAR;
                                             EXCEPTION
                                                  WHEN NO_DATA_FOUND THEN
                                                       d_data := NULL;
                                             END;
                                        END;
                                   END;
                              END;
                         END;
                    END;
               END;
          END;
     END;
END;
IF WE_KOLUMNA = 'DATA_PODPISANIA' THEN
RETURN d_data;
END IF;
END;

Similar Messages

  • Materialized View with column based on PL/SQL function returning object

    I have the following problem - it is known that materialized view wants PL/SQL functions used in it to be DETERMINISTIC. And it appears that a function which returns SDO_GEOMETRY cannot be DETERMINISTIC - I can add DETERMINISTIC modifier to my function which returns sdo_geometry based on USNG grid ID and save the package, and it compiles and runs fine with regular queries, but when it comes to materialized view (mview), the following error is thrown:
    ORA-12018: following error encountered during code generation for "SCHEMA"."MVIEW_NAME"
    ORA-00932: inconsistent datatypes: expected NUMBER got MDSYS.SDO_GEOMETRY
    Looks like DETERMINISTIC modifier is not fully supported for object types. I have tried to use SDO_CS.FROM_USNG Oracle's function, and it appeared that this function is also non-deterministic - I cannot refresh mview with P or F on-demand refresh method (see http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14223/refresh.htm#i1008349 for a list of on-demand refresh methods). Without that function I can refresh mview with P or F flags.

    Hi,
    Yes, the Chart Series can be based on "Function Returing SQL Query" and the "SQL" would be something like:
    DECLARE
    vSQL VARCHAR2(1000);
    BEGIN
    vSQL := 'SELECT NULL LINK, ENAME LABEL, SAL VALUE FROM EMP ORDER BY ENAME';
    RETURN vSQL;
    END;You should tick the "Save query without validation" underneath that. Without this, there is a validation error - the ; at the end is required to get the chart to function correctly but the validator sees this as an error.
    You would need to create this separately from the report. No matter how you did it, the chart would still run a SQL statement to generate the output. If you wanted to use the "same data", then you could create a collection using the PL/SQL and base both the report and the chart on the collection instead.
    Andy

  • TS1362 my iTunes wont play music or videos when i open it it comes up with "iTunes has detected a problem with your audio with your configuration AudioVideo playback may not operate properly"

    my iTunes wont play music or videos when i open it it comes up with "iTunes has detected a problem with your audio with your configuration AudioVideo playback may not operate properly" i have uninstalled it and reinstalled it twice and it stil lcomes up with that message every time I opentheiTunes icon I dont knowwhat to do

    Hello Wade,
    This is typically indicative of an issue with the installation of QuickTime on your computer. The following article provides steps for reinstalling QuickTime to resolve the issue.
    "iTunes cannot run because it has detected a problem with your audio configuration"
    Resolution
    QuickTime may need to be reinstalled. Follow the steps below to uninstall QuickTime and then download and install QuickTime using the QuickTime standalone Installer.
    On the Start menu, click Control Panel.
    Follow the steps appropriate for your Windows operating system below.
    Windows XP and Windows 2000: Open the Add or Remove Programs control panel and selectQuickTime in the list of currently installed programs.
    Windows Vista and Windows 7: Click Uninstall a program (or if using Windows Vista's Classic View of the Control Panel, click Programs and Features) and select QuickTime in the list of currently installed programs.
    Click the Remove button (or Uninstall for Windows Vista and Windows 7) and follow the prompts to remove QuickTime from your computer.
    Download QuickTime. Note: There are two options for downloading QuickTime, be sure to select the option that does not include iTunes.
    During the download:
    If you choose to run the installer, proceed to the next step.
    If you choose to save the download, double click the QuickTimeInstaller file, then proceed to next step.
    Follow the on-screen instructions to install QuickTime.
    Reopen iTunes.
    iTunes for Windows: iTunes cannot run because it detects an issue with QuickTime
    http://support.apple.com/kb/TS1371
    Cheers,
    Allen

  • Using a IP191 monitor, have random horizontal streaks on display - have no problem with other browsers; also no problem with FF on other family PC's

    Using a IP191 monitor, have random horizontal streaks on display - have no problem with other browsers; also no problem with FF on other family PC's.
    These "streaks" appear to be area of too high frequency scanning; they can be cleared by scrolling up and/or down.

    hello, maybe that's an issue with hardware acceleration - please try [[Upgrade your graphics drivers to use hardware acceleration and WebGL|updating your graphics driver]], or in case this doesn't solve the issue or there is no new version available at the moment, disable hardware acceleration in the firefox ''menu [[Image:New Fx Menu]] > options > advanced > general''.

  • HT4623 can someone assist me with a solution to the problem with my iphone 5. I upgraded to IOS 6.1.4 and since then i have had the problem of No Sim. I restored to the factory settings using i tunes as i have my back up on my pc but still the same proble

    can someone assist me with a solution to the problem with my iphone 5. I upgraded to IOS 6.1.4 and since then i have had the problem of No Sim. I restored to the factory settings using i tunes as i have my back up on my pc but still the same problem. I have swapped sim and my Sim is working on other iphone with ios 6.1.3

    Try a new SIM from your carrier.  If that doesn't work, make a Genius Bar appointment and get your phone evaluated.

  • Got a new iPhone today and tried to restore from my old phone using icloud but kept coming up with a message that said problem with my icloud back up please help

    Got a new iPhone today and tried to restore from my old phone using icloud but kept coming up with a message that said problem with my icloud back up please help

    Hi there Clairemcaula,
    You may find the troubleshooting steps in the article below helpful.
    iCloud: Troubleshooting restoring an iCloud backup
    http://support.apple.com/kb/ts4036
    -Griff W. 

  • Please can anyone help with the continuing password rejection problem with email.Ipad and other systems work fine but despite reloading my password on imac it bounces back.Apple store has been visited and I have tried everything they suggest.

    Please can anyone help with the continuing password rejection problem with email on my imac.My Ipad and other systems work fine but despite reloading my password on imac it bounces back.Apple store has been visited and I have tried everything they suggest.

    I use free Yahoo mail webMail access because folders I created in webmail access doesn't get set up in Apple Mail. While I was searching for post about password and keychain issues, I stumbled on several threads that complain about Mail folder issues, so I'm holding off on Apple Mail.
    On the password and keychain issue that your post is all about.  I've been using login keychain to save and automatical fill my login screens for a year or so successfully, with Safari and Chrome. Automatic form fill also works for Facebook login. Unfortunately, about 4 to 6 months ago, automatic password form fill stopped working with Yahoo webmail, while still worked for GMail (Safari and Chrome). I tried deleting the password entry for my two Yahoo email accounts to start fresh, but neither Safari not Chrome will even ask me if I want to save the password. I was so frustrated that I eventually installed the keypassX 0.43 (password manager) that is quite primitive sompare to OS X's keychain (when it works). Probably no surprise to you yet.
    The surprise, to me at least, is that, for whatever reason, password auto form-fill from keychain started working again for Yahoo webmail login on Safari about 5-7 days ago. Still doesn't work on Chrome!
    Two tips I can share, at least with webmail access:
    1. Password is save only for one of my yahoo mail accounts. When I login in with my other yahoo account, I get no prompt to save the password, and form fill doesn't work when I try to log in a second time with my other Yahoo mail account.
    2. On inspection of my login keychain, I see a webform password item saved for my Yahoo account that works with keychain. The name of the password is: login.yahoo.com(MyAccountName1#). When I open the password item and look in the Access Control tab, I see Safari and Chome are listed as allowed to access this password item..
         I also an "Internet password" item with a name of just login.yahoo.com. When I open the the password item, it looks just like the password item created for MyAccountName#1, but the MyAccountName#2 is listed in the Account field. Inside the Access Control tab, no apps are listed in access permission. I added Safari and Chrome to the lists of allowed app, saved the password item.
    Now when I bring up the Yahoo login page(by bookmark) on Safari, form fill fills in MyAccountname#1 for name and the proper password and I can login in. When I change the name to MyAccountName#2, the correct password is retrieved and I can log in! Alas, it still doesn't work on Chrome.
    BTW, I changed the password item type from "Internet password" to "Web Form password" and saw no difference! I also edited the name to be "login.yahoo.com (MyAccountName#2)" to look like the web form password item that works, but it has no effect either.
    From my experimentation, here's my observation:
    1. A Web Form password item is created for the first account name(MyAccountName#1) for login.yahoo.com and typed as Web Form password. When I log in using MyAccountName#2, an Internet Password is created, but no applications are listed as allowed to access the password item, even when the password item was created after just logged in and logged out to yahoo with the account name and password for MyAccountName#2.
    2. Manually adding Safari as an app that is allowed to use the password item works. Doesn't work with Chrome!
    The version of Safari I'm using is Version 5.1.7 (6534.57.2). My installed version of Chrome is Version 21.0.1180.79 beta.

  • HT2020 if you have internet sharing on imac with Mountain Lion its stil problem with sleep mode ! why ???

    if you have internet sharing on imac with Mountain Lion its stil problem with sleep mode ! why ???

    Log a bug with Apple, with whatever details you can provide.  In the interrim, consider acquiring a router; either a repurposed x86 box running open-source networking or gateway software, or a commercial device.

  • My phone is iphone 4 (GSM)-american type with IOS5.11 , i have problem with sim card failer (korek type)

    my phone is iphone 4 (GSM)-american type with IOS5.011 , i have problem with sim card failer (korek type)

    Sounds like your iPhone is locked to AT&T. Contact them to see
    if you qualify for unlocking.
    This link may provide some assistance:
    unlocking AT&T iPhones (thanks to wjosten for the link)
    http://www.att.com/esupport/article.jsp?sid=KB414532#fbid=Ont7guWFCdY

  • Is someone with iMac 2010 users  have problems with the monitor. I mean horizontal  stripes and dark screen ?

    Is someone with iMac 2010 users  have problems with the monitor. I mean horizontal  stripes and dark screen ?

    Mine's a late '09, but there have been display issues with iMacs.
    Contact Apple Service, iMac Service or Apple's Express Lane. Do note that if you have AppleCare's protection plan and you're within 50 miles (80 KM) of an Apple repair station, you're eligible for onsite repair since yours is a desktop machine.

  • IPad mini with retina still having wifi problems with iOS 8.0.2 - slow or none. Resetting temporarily fixes problem it very annoying. Please fix Apple! Not up to scratch.

    iPad mini with retina still having wifi problems with iOS 8.0.2 - slow or none. Resetting temporarily fixes problem it very annoying. Please fix Apple! Not up to scratch.

    I Have followed these steps, and tried others, such as resetting all my network settings. At best these only temporarily fix the problem - wifi still becomes slow or stops. I have other Apple devices connecting fine to my airport express. why is my iPad mini not working? Is it related to the fact it is 3G and I don't have a sim card installed? It is the current top of the range model with iOS 8.0.2. I paid over the odds for the best, and it is almost completely redundant.  Apple - I'm losing faith. You need to keep the public better informed and fix this problem fast, otherwise I will leave you for good.

  • Function module based generic extractor - Problem with the selection

    Hi all
    The following is my code in the function module. I am able to get the entire data if i dont give any selections and the number of records is also correct. But when i select a MATNR value, it returns 0 records where as it needs to return 3 records. If i give selection based on bukrs, werks, lgort its working fine. But if i give selection based on MATNR, then it is not working.... I think there is a problem in the bold part of my code. If i debug, LS_MATNR is having the correct value which indicates that there is no problem with the value being passed to LS_MATNR from my selection screen of my datasource in RSA3. Even GT_WERKS is also having data. Please help.
    OPEN CURSOR WITH HOLD S_CURSOR FOR
    SELECT  MARA~MANDT
            MARA~MATNR
            MARC~WERKS
            MARD~LGORT
            MARA~MEINS
            MARD~LABST
            MARD~EINME
            MARD~SPEME
            MARD~RETME
            MARD~INSME
            MARD~UMLME
            MARD~VMLAB
            MARD~VMEIN
            MARD~VMSPE
            MARD~VMRET
            MARD~VMINS
            MARD~VMUML
            MARC~XCHPF
            MARD~KLABS
            MARD~KEINM
            MARD~KSPEM
            MARD~KINSM
    from MARA inner join MARC on
    MARAMANDT = MARCMANDT AND
    MARAMATNR = MARCMATNR
    inner join MARD on
    MARAMANDT = MARDMANDT AND
    MARAMATNR = MARDMATNR
    AND MARCWERKS = MARDWERKS
    for all entries in gt_werks
    where MARC~werks EQ gt_werks-werks
    AND MARA~MATNR in LS_MATNR.
        ENDIF.                             "First data package ?
    Fetch records into interface table.
      named E_T_'Name of extract structure'.
        FETCH NEXT CURSOR S_CURSOR
                   APPENDING CORRESPONDING FIELDS
                   OF TABLE E_T_DATA
                   PACKAGE SIZE S_S_IF-MAXSIZE.

    try this
    select marc~matnr MARC~WERKS into t_marc for all entries in gt_werks
    where werks EQ gt_werks-werks and lvorm = space.
    if t_marc is not initial.
    select MARD~LGORT MARD~WERKS MARA~MEINS MARD~LABST MARD~EINME
    MARD~SPEME MARD~RETME MARD~INSME MARD~UMLME
    MARD~VMLAB MARD~VMEIN MARD~VMSPE MARD~VMRET
    MARD~VMINS MARD~VMUML MARC~XCHPF MARD~KLABS
    MARD~KEINM MARD~KSPEM MARD~KINSM  MARA~MEINS  from
    mard inner join MARA on mard~matnr = mara~matnr
    for all entries in t_marc where  mard~matnr = t_marc-matnr and mard-werks = t_marc-matnr
    and mard~lvorm = space.

  • Analitic functions (problem with SELECT)

    Hi!
    I've got a problem with analitic functions (I'm newbie in this topic).
    I have a table gpw_notowania which have colums: not_open, not_minimum, not_maximum, not_close, not_volume, not_sp_id and not_date.
    I need to receive from database the information: what is the open, minimum, maximum, close and sum of volume in every week? I have tried the code below but it tells me: ORA-01791 (marking not_date in ORDER clause).
    Help me, please.
    SELECT     distinct
         FIRST_VALUE(not_open)      OVER (partition by to_char(not_date,'WW') ORDER BY not_date)          as open,
         MIN(not_minimum)     OVER (partition by to_char(not_date,'WW') ORDER BY not_date)          as minimum,
         MAX(not_maximum)     OVER (partition by to_char(not_date,'WW') ORDER BY not_date)          as maximum,
         FIRST_VALUE(not_close)     OVER (partition by to_char(not_date,'WW') ORDER BY not_date DESC)     as close,
         sum(not_volume)          OVER (partition by to_char(not_date,'WW'))                    as volume
    FROM     gpw_notowania
    WHERE     not_sp_id = 80
    ORDER BY not_date;

    This is an interesting question.
    create table SortWithDistinct(Val1,Val2,sortKey,SubSortKey) as
    select 1,3,10,1 from dual union all
    select 1,3,10,1 from dual union all
    select 1,3,10,1 from dual union all
    select 2,4,30,2 from dual union all
    select 2,4,30,2 from dual union all
    select 3,5,20,1 from dual union all
    select 3,5,20,1 from dual union all
    select 4,6,10,3 from dual union all
    select 5,5,10,2 from dual union all
    select 5,5,10,2 from dual union all
    select 9,9,10,4 from dual union all
    select 6,4,20,2 from dual union all
    select 6,4,20,2 from dual union all
    select 7,3,30,1 from dual union all
    select 7,3,30,1 from dual;
    select distinct Val1,Val2
      from SortWithDistinct
    order by sortKey,SubSortKey;
    ORA-01791: not a SELECTed expressionIt is one way that we use "group by".
    for instance
    select Val1,Val2
      from SortWithDistinct
    group by Val1,Val2
    order by max(sortKey),max(SubSortKey);
    Val1  Val2
       1     3
       5     5
       4     6
       9     9
       3     5
       6     4
       7     3
       2     4It is one way that we use "Inline View".
    for instance
    select Val1,Val2
    from (select distinct Val1,Val2,sortKey,SubSortKey
    from SortWithDistinct)
    order by sortKey,SubSortKey;
    Furthermore, we may use below alternative solution which uses "dense_Rank".
    select Val1,Val2
    from (select distinct Val1,Val2,
          dense_Rank() over(order by sortKey,SubSortKey) as willSortKey
            from SortWithDistinct)
    order by willSortKey;Because "distinct" works after OLAP.
    for instance
    SQL> select distinct ColA,ColB,Row_Number() over(order by 1) as Rank
      2  from (select 1 as ColA,1 as ColB from dual
      3  union all select 1,1 from dual
      4  union all select 1,1 from dual
      5  union all select 1,1 from dual
      6  union all select 2,2 from dual
      7  union all select 2,2 from dual
      8  union all select 2,2 from dual)
      9  order by 1,2,3;
    ColA  ColB  Rank
       1     1     1
       1     1     2
       1     1     3
       1     1     4
       2     2     5
       2     2     6
       2     2     7my site :-)
    http://www.geocities.jp/oraclesqlpuzzle/1-6.html

  • Virtual function problem with SC 4.2

    Hi
    I'm using SC CC 4.2
    [CC -V
    CC: WorkShop Compilers 4.2 18 Sep 1997 C++ 4.2 patch 104631-04]
    not the latest patch, I realize.
    The following bit of code:
    ProcessParameters *ppp = &(_config.process_params_);
    ppp->save_to_file(String("abc"));
    config.processparams_.save_to_file(String("xyz"));
    does not work as I'd expect it to!
    config.processparams_ is of type ProcessParametersEnhanced,
    and the definition of this, and its base class, looks like:
    class ProcessParameters
    public:
    virtual int save_to_file(String filename);
    and
    class ProcessParametersEnhanced : public ProcessParameters
    public:
    virtual int save_to_file(String filename);
    (I've cut everything else out of the class definitions for clarity, and I've changed the names a bit as well, hopefully without typos).
    ppp->save_to_file(String("abc"));
    calls ProcessParameters::save_to_file(String)
    even though ppp points to an instance of ProcessParametersEnhanced, and the function is virtual.
    I've tried building a small test application, using the minimum class interfaces, but this works as I'd expect (it also works fine with gcc).
    I'm getting deseperate. Is there a bug in SC4.2 whereby it fails to resolve virtual functions correctly?
    TIA
    Paul Floyd

    Oh well, it was an SC4.2 bug
    Patch-ID# 104631-07
    Keywords: C++ 4.2 SC4.2
    Synopsis: SPARCompiler C++ 4.2: C++ 4.2 patch for Solaris 2.x
    Date: Jul/17/98
    4066271 C++ has a problem with a copy constructor using virtual and multiple inheritance
    It seems as though the copy ctor doesn't copy the vtbl.
    Cheers
    Paul

  • Oracle.adf.view.rich.pprNavigation.OPTIONS on give problem with servlets

    I recentrly fix ADF_FACES-60058 using in web.xml:
    <context-param>
    <param-name>oracle.adf.view.rich.newWindowDetect.OPTIONS</param-name>
    <param-value>on</param-value>
    </context-param>
    and now bc this change, when i call a sevlet using ajax.. all my servlets stop working...
    =( This mean this is not good fix...

    Hi i am getting now after fix problem with my servlet( Delete servlet and use Backing bean instead)
    javax.servlet.ServletException: java.lang.InternalError: name is too long to represent
    at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:266)
    at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:410)
    at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
    at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
    at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
    at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
    at org.apache.myfaces.trinidadinternal.context.FacesContextFactoryImpl$OverrideDispatch.dispatch(FacesContextFactoryImpl.java:267)
    at com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:473)
    at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:141)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:189)
    at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:193)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:685)
    at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:261)
    =/

Maybe you are looking for