简体   繁体   English

看到 ORA-01858:在需要数字的地方发现了一个非数字字符

[英]Seeing ORA-01858: a non-numeric character was found where a numeric was expected

The following is my query for Oracle SQL Developer:以下是我对 Oracle SQL Developer 的查询:

INSERT INTO ENROLLMENTS (DATE,PARTNER_NAME,ENROLLMENTS)
    SELECT TO_CHAR(TS, 'DD-MON-YYYY HH AM') AS DATE, mrch_bnft_cd, COUNT(*)
    FROM ENROLLMENTS 
    WHERE TS > trunc(sysdate-1/24, 'HH') + 5/24 
    AND TS < trunc(sysdate, 'HH') + 5/24
    GROUP BY TO_CHAR(TS, 'DD-MON-YYYY HH AM'), mrch
    ORDER BY TO_CHAR(TS, 'DD-MON-YYYY HH AM'), mrch_bnft

I get an error我得到一个错误

ORA-01858: a non-numeric character was found where a numeric was expected error ORA-01858: 在预期为数字错误的位置发现了非数字字符

but the error is not telling me where.但错误没有告诉我在哪里。 Any ideas?有任何想法吗?

DATE = TIMESTAMP(6)
TS = TIMESTAMP(6)  
PARTNER = VARCHAR2(35 BYTE)  
ENROLLMENTS = NUMBER  
MRCH_BNFT= VARCHAR2(35 BYTE)

Basically you are trying to store a string which represents a date in a timestamp field.基本上,您试图在时间戳字段中存储一个表示日期的字符串。 If you replace:如果您更换:

TO_CHAR(TS, 'DD-MON-YYYY HH AM')

by经过

TRUNC(TS, 'hh24')

at all 4 places it should work.在所有 4 个地方它都应该工作。

INSERT INTO ENROLLMENTS (DATE,PARTNER_NAME,ENROLLMENTS)
    SELECT   TRUNC(TS, 'hh24') AS DATE, mrch_bnft_cd, COUNT(*)
    FROM     ENROLLMENTS 
    WHERE    TS > trunc(sysdate-1/24, 'HH') + 5/24 
    AND      TS < trunc(sysdate, 'HH') + 5/24
    GROUP BY TRUNC(TS, 'hh24'), mrch
    ORDER BY TRUNC(TS, 'hh24'), mrch_bnft

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ORA-01858:在期望数字的地方找到了非数字字符? - ORA-01858: a non-numeric character was found where a numeric was expected? ORA-01858: 在需要数字的地方发现了一个非数字字符(时间戳、解码) - ORA-01858: a non-numeric character was found where a numeric was expected (timestamp, decode) 可能的日期分配错误ORA-01858:在期望数字的位置找到了非数字字符 - Possible Date assignment error ORA-01858: a non-numeric character was found where a numeric was expected ORA-01858: 在需要数字的地方发现了一个非数字字符 - ORA-01858: a non-numeric character was found where a numeric was expected ORA-01858:找到一个非数字字符,其中数字是预期的? 即使数值是数字? - ORA-01858: a non-numeric character was found where a numeric was expected? Even when the values are numbers? ORA-01858: 在一个简单的选择查询需要数字的地方发现了一个非数字字符 - ORA-01858: a non-numeric character was found where a numeric was expected for a simple select query ORA-01858:找到一个非数字字符,其中数字是预期的 - oracle 10g - ORA-01858: a non-numeric character was found where a numeric was expected - oracle 10g .NET ORA-01858:找到了一个非数字字符,其中包含数字 - .NET ORA-01858: a non-numeric character was found where a numeric was expected 错误 ORA-01858:在运行查询时应为数字的位置发现了非数字字符 - Error ORA-01858: a non-numeric character was found where a numeric was expected when running query ORA-01858:找到非数字字符并期望输入数字 - ORA-01858: a non-numeric character found where a digit was expected
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM