2013-11-20 17 views
0

說我有如何將值轉換爲在Oracle/SQL靜態值

select * from table1 
join table2 
on table1.name = table2.name 
where table1.date = table2.date 

,如果在這種情況下table2.date = '13 -nov-13 12.00.00.000000 AM」 我想轉換表2 .date在靜態值 像where table1.date = somefunction(table2.date) 因此這將是

where table1.date = '13-NOV-13 12.00.00.000000 AM' 

你如何在Oracle 11g中做到這一點。 謝謝!

+0

是'table1.date'一個VARCHAR2和'table2.date'是時間戳?類型轉換的原因是什麼? – Joe

+0

table1.date也是一個時間戳。我希望table1.date使用來自table2.date的靜態值來進行給定的搜索。 – user2846737

回答

0

可以格式化日期,使用內置的功能to_date,比方說,一個字符串:

where table1.date = to_date(table2.date, 'dd-mmm-yyyy hh:mi:ss')