如果type 是int型別可以,如果id是string型別就報錯。
比如:<insert id="crView">
create or replace view as test_view
select * from tbl_teset where type=${type}
</insert>
#{id} 不能正常替換,發生例外。
uj5u.com熱心網友回復:
測驗用#{}可以 ,反而是 ${} 會出現字串無法識別的問題<insert id="createView">
create or replace view test_view as select * from tbl_teset where name= #{type}
</insert>
uj5u.com熱心網友回復:
你的type里面是不是有特殊字符,#{} 傳值會進行一些轉化,${} 是直接把傳入的值當字串處理uj5u.com熱心網友回復:
type=1 和 type='1' 是不一樣的,${XXX}是直接取XXX,#{XXX}會escape轉換,是字串就幫你加上單引號轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/211309.html
標籤:Web 開發
上一篇:https轉http快取問題
