postgresql 字符串轉整數 int、integer


 

--把'1234'轉成整數
select cast ( '1234' as integer ) ;
--用substring截取字符串,從第8個字符開始截取2個字符:結果是12
select cast ( substring ( '1234abc12' ,8,2) as integer )
---使用to_number函數來轉換成整數
---to_number(text, text)  返回的類型 numeric     把字串轉換成numeric   to_number('12,454.8-', '99G999D9S')
select to_number( '12121' , '999999999' )


免責聲明!

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



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