可以的.检查程序中在那出错
SQL> select * from aa;ID FID
-- ---
1 0
2 1
3 1
4 2
5 3
6 4
6 57 rows selectedSQL> select * from bb;A B
-- --
1 0
2 1
3 1
4 2
5 3
6 4
6 57 rows selectedSQL> select id,fid from aa
2 union all
3 select a,null from bb;ID FID
-- ---
1 0
2 1
3 1
4 2
5 3
6 4
6 5
1
2
3
4
5
6
6 14 rows selected
SQL> select * from aa;ID FID
-- ---
1 0
2 1
3 1
4 2
5 3
6 4
6 57 rows selectedSQL> select * from bb;A B
-- --
1 0
2 1
3 1
4 2
5 3
6 4
6 57 rows selectedSQL> select id,fid from aa
2 union all
3 select a,null from bb;ID FID
-- ---
1 0
2 1
3 1
4 2
5 3
6 4
6 5
1
2
3
4
5
6
6 14 rows selected
to_date(null,'yyyy-mm-dd') g
from (select t3005.p_code a,
t3017.c_name b,
t3020.rank_name c,
t3005.fly_hours d,
t3020.rank_no e,
t3005.flight_date f,
T3035.EXAM_DATE g ,
decode(T3035.RESULT, '1', 'ÒÑÍê³É', '2', 'δͨ¹ý', '--') h
from t3005, t3017, t3035, t3020
where t3005.crew_link_line=' & crew_link & '
and t3005.p_code=t3017.p_code
and t3005.p_code=t3035.p_code
and t3005.flight_date=t3035.EXAM_DATE
and t3005.rank_no=t3020.rank_no
and To_Char(t3005.flight_date,'YYYY-MM-DD')=' & sDay & '
union all
select t3016.p_code a,
t3017.c_name b,
t3020.rank_name c,
t3016.fly_hours d,
t3020.rank_no e,
t3016.flight_date f,
null g ,
null h
from t3016, t3017, t3020
where t3016.stew_link_line=' & stew_link & '
and t3017.p_code=t3016.p_code
and t3020.rank_no=t3016.rank_no
and To_Char(t3016.flight_date,'YYYY-MM-DD')=' & sDay & ') abc
order by abc.e;看不出有什么错啊,在sqlplus中执行一下看看问题出在哪一行
将null 改为to_date(null) 即可!