日期:2014-05-17  浏览次数:21040 次

SQL command not properly ended的错误
在pl/sql   developer上运行这样一条sql语句:  
select   t1.borrow_id   as   borrow_id,
t2.El_Name   as   resource_name,
t2.El_LabelID   as   resource_labelid,
t3.user_name   as   user_name,
t3.user_organization   as   user_unit,
t1.Borrow_Date   as   resource_date,
t1.Borrow_ID   as   objid
from   INTEL.CS_EleBorrowInfo   t1,
intel.CS_ElectronicInfo   t2,
cs_userinfo   t3
where   t1.Borrow_ObjectID   =   t2.El_ID
and   t1.Borrow_UserID   =   t3.user_id
and   t1.Borrow_Date   >   to_date( '2007-9-4 ',   'yyyy-mm-dd ')
and   t1.Borrow_Date   <   to_date( '2007-9-5 ',   'yyyy-mm-dd ')
order   by   t1.Borrow_Date   desc   --   错误出现在这里
union
select   t1.borrow_id   as   borrow_id,
t2.Film_Name   as   resource_name,
t2.Film_LabelID   as   resource_labelid,
t3.user_name   as   user_name,
t3.user_organization   as   user_unit,
t1.Borrow_Date   as   resource_date,
t1.Borrow_ID   as   objid
from   INTEL.CS_FilmBorrowInfo   t1,   intel.CS_FilmInfo   t2,   cs_userinfo   t3
where   t1.Borrow_ObjectID   =   t2.Film_ID
and   t1.Borrow_UserID   =   t3.user_id
and   t1.Borrow_Date   >   to_date( '2007-9-4 ',   'yyyy-mm-dd ')
and   t1.Borrow_Date   <   to_date( '2007-9-5 ',   'yyyy-mm-dd ')
order   by   t1.Borrow_Date   desc
union
select   t1.borrow_id   as   borrow_id,
t2.ReliefMap_Name   as   resource_name,
t2.ReliefMap_LabelID   as   resource_labelid,
t3.user_name   as   user_name,
t3.user_organization   as   user_unit,
t1.Borrow_Date   as   resource_date,
t1.Borrow_ID   as   objid
from   INTEL.CS_MapBorrowInfo   t1,
intel.CS_ReliefMapInfo   t2,
cs_userinfo   t3
where   t1.Borrow_ObjectID   =   t2.ReliefMap_ID
and   t1.Borrow_UserID   =   t3.user_id
and   t1.Borrow_Date   >   to_date( '2007-9-4 ',   'yyyy-mm-dd ')
and   t1.Borrow_Date   <   to_date( '2007-9-5 ',   'yyyy-mm-dd ')
order   by   t1.Borrow_Date   desc
union
select   t1.borrow_id   as   borrow_id,
t2.Book_Name   as   resource_name,
t2.Book_LabelID   as   resource_labelid,
t3.user_name   as   user_name,
t3.user_organization   as   user_unit,
t1.Borrow_Date   as   resource_date,
t1.Borrow_ID   as   objid
from   INTEL.CS_BookBorrowInfo   t1,   intel.CS_BookInfo   t2,   cs_userinfo   t3
where   t1.Borrow_ObjectID   =   t2.Book_ID
and   t1.Borrow_UserID   =   t3.user_id
and   t1.Borrow_Date   >   to_date( '2007-9-4 ',   'yyyy-mm-dd ')
and   t1.Borrow_Date   <   to_date( '2007-9-5 ',   'yyyy-mm-dd ')
order   by   t1.Borrow_Date   desc
union
select   t1.borrow_id   as   borrow_id,
t2.Maga_Name   as   resource_name,
t2.Maga_LabelID   as   resource_labelid,
t3.user_name   as