SQL日期转换结果为" ORA-01481:无效的数字格式模型"在TO_DATE之后更改为TO_CHAR

时间:2016-11-28 13:55:16

标签: oracle11g

我在尝试运行此查询时遇到错误(如下所示):

<div class="folio-image">
    <a href="images/slider/coverimage.jpg" rel="prettyPhoto[gallery]">
      <div class="overShadow"></div>
      <h3>Slider title</h3>

      <img src="images/slider/image1.jpg" class="img-responsive max-400" />
    </a>
    <a href="images/slider/31.jpg" rel="prettyPhoto[gallery3]" width="0" height="0" style="display:none; visibility: hidden;">
      <img src="images/slider/31.jpg"" width="0" height="0" style="display:none; visibility: hidden;"/>
    </a>
</div>

最初它给出了错误 -

SELECT 
TO_DATE (TERMIN_DATE,'YYYYMMDDHH24MISS') AS TERMIN_DATE
FROM DRG_HDA_VOICE_VW T,DRG_CELL;

因此我使用TO_CHAR代替TO_DATE,但现在它显示此错误

ORA-12801: error signaled in parallel query server P069 
ORA-01840: input value not long enough for date format

&#34; TERMIN_DATE&#34;的data_type是VARCHAR2(14字节)。

DATA_TYPE(TERMIN_DATE)_image

此查询的任何解决方案?

1 个答案:

答案 0 :(得分:0)

感谢大家的建议。 @ mathguy-我试过那个查询,结果如下:

&#13;
&#13;
select termin_date from  DRGUSER01.DRG_HDA_VOICE_16281 where length(termin_date) < 14
TERMIN_DATE
+0800
+1000
+1200
+0500...

select termin_date from  DRGUSER01.DRG_HDA_VOICE_16281 where length(termin_date) > 14
empty

select termin_date from  DRGUSER01.DRG_HDA_VOICE_16281 where length(termin_date) = 14
TERMIN_DATE
20161128020303
20161128020304
20161128020010....
&#13;
&#13;
&#13;

我认为问题在于输入数据格式本身就像你们所怀疑的一样。 在使用更正的输入数据测试查询后,我会确认回来。