wasp256
wasp256

Reputation: 6242

ORA-01861: literal does not match format string in package function

I have the following select with the returned result of one row:

        SELECT *
          FROM (SELECT   (SELECT dokdatum
                            FROM dokumente
                           WHERE dokid = '00100002LNWCAJ') AS tckdatum,
                         aktzeitdatum aktdatum,
                         (SELECT tckdokzeit
                            FROM tickets
                           WHERE tckid = '00100000000ICQ') tckzeit,
                         (hh * 60 + mm) * 60 AS aktzeit, firmaid
                    FROM (SELECT TO_DATE (aktdatumuhrzeitunitup,
                                          'DD.MM.YYYY'
                                         ) aktzeitdatum,
                                 a.firmaid,
                                 TO_NUMBER (TO_CHAR (aktdatumuhrzeitunitup, 'HH24')
                                           ) hh,
                                 TO_NUMBER (TO_CHAR (aktdatumuhrzeitunitup, 'MI')) mm
                            FROM aktivitaeten a, aktivitaetenarten aa
                           WHERE a.aktartid = aa.aktartid(+)
                             /* downtime terminated */
                             AND aktunitup = 1
                             AND tckid = '00100000000ICQ'
                             AND (aktartstatistik IS NULL OR aktartstatistik = 1)
                             AND a.aktdatumuhrzeitunitup IS NOT NULL)
                ORDER BY ((aktdatum - tckdatum) * 24 * 60 * 60 + (aktzeit - tckzeit)
                         ) DESC)
         WHERE ROWNUM < 2;

Result is:

 11.03.2016 ||  11.03.2016  ||  41334 ||  41940  ||  001

This statement is executable without errors. But when I try to use it in a package function with

 FUNCTION xy ...
 IS
        CURSOR c_cdt_aktdatumuhrzeitunitup
        IS
             --the above select

        r_cdt_aktdatumuhrzeitunitup   c_cdt_aktdatumuhrzeitunitup%ROWTYPE;

  BEGIN

        OPEN c_cdt_aktdatumuhrzeitunitup;

        --Exception is thrown with this statement
        FETCH c_cdt_aktdatumuhrzeitunitup
        INTO r_cdt_aktdatumuhrzeitunitup;

Then I receive the ORA-01861: literal does not match format string error on the FETCH...INTO line

Does anyone know why?

Upvotes: 0

Views: 260

Answers (0)

Related Questions