ORA-01790: 表達式必須具有與對應表達式相同的數據類型


一、網上都是這么說的:

  出現這種錯誤,要先看一下是不是sql中有用到連接:union,unio all之類的,如果有,需要注意相同名稱字段的數據類型一定要相同。

       select a.time from A a union all select b.time from B b where a.name = b.name;

例如上現那句sql,要注意A和B中的time字段可能一個是date格式,一個是字符串格式,總之可能不是相同格式。一定要注意。

二、但是我還要補充一句

  我寫了兩個sql,使用union all連接。

select a.name  a.age from  studentTabA  a  union all   select b.name b.age from studentTabB  b 

 上述的語句是不會報錯的,但是如果像下面這樣寫也還是會報ORA-01790

select a.age  a.name from  studentTabA  a  union all   select b.name b.age from studentTabB  b

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM