码迷,mamicode.com
首页 > 数据库 > 详细

PLSQL语句执行正确,而VB执行错误。ORA-01830 date format picture ends before converting entire input string

时间:2015-02-11 16:18:26      阅读:825      评论:0      收藏:0      [点我收藏+]

标签:

 1   TO_CHAR(FIRDATE - (TO_DATE(TO_CHAR(FIRDATE ,YYYY/MM/DD)   || 07:30:00,YYYY/MM/DDHH24:MI:SS) - TRUNC(SYSDATE)),MM/DD )
 2           || (CASE WHEN TO_NUMBER(TO_CHAR(FIRDATE - 0.5 / 24,HH24)) >=7 
 3                     AND TO_NUMBER(TO_CHAR(FIRDATE - 0.5 / 24,HH24)) <19 THEN D ELSE N END) INPUTDATE
 4      
 5 FROM (SELECT A.UPN UPN,
 6               C.DESCRIPTION DESCRIPTION,       
 7               MIN(CASE WHEN A.STAGE=IJ THEN A.FIRSTTESTDATE END)   FIRDATE 
 8           FROM ALLIE_USNYRDATA A,SFCUSN B,ERPITEMMASTER C
 9           WHERE A.USN=B.USN
10           AND B.UPN=C.CPN 
11           GROUP BY ......

注意TO_DATE,TO_CHAR 之间的转换。
存在FIRDATE - 0.5 / 24运算,故为date型。小的查询里面FIRDATE为date型。TO_date()—>TO_CHAR()—>TO_NUMBER().

后面连接为char型。故FIRDATE再转为CHAR型。

 例如:

SELECT to_date(‘2010-08-19 18:05:09‘,‘yyyy-mm-dd‘) FROM dual

这样的格式是不允许的,经过修改为:
SELECT to_date(‘2010-08-19‘,‘yyyy-mm-dd‘) FROM dual;

PLSQL语句执行正确,而VB执行错误。ORA-01830 date format picture ends before converting entire input string

标签:

原文地址:http://www.cnblogs.com/xxh-2014/p/4286223.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!