0

我有以下选择,返回的结果为一行:

        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;

结果是:

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

该语句可执行且没有错误。但是当我尝试在包函数中使用它时

 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;

然后我收到在线ORA-01861: literal does not match format string错误FETCH...INTO

有谁知道为什么?

4

0 回答 0