文章詳情頁
python - 請問cx_oracle使用where col in (:1)的方式的時(shí)候,是否可以直接傳入一個(gè)list或者tuple實(shí)現(xiàn)查詢呢?
瀏覽:75日期:2022-08-30 08:36:31
問題描述
請問cx_oracle使用where col in (:1)的方式的時(shí)候,是否可以直接傳入一個(gè)list或者tuple實(shí)現(xiàn)查詢呢?舉個(gè)例子,我想查詢的sql為select col1 form col in (’1’,’2’,’3’)但是in里面的內(nèi)容并不固定,可能是2個(gè),也可能是3個(gè)或者更多。請問如何實(shí)現(xiàn)呢?
問題解答
回答1:alist = [1]select col1 form col in(*alist)
排行榜

熱門標(biāo)簽