coa*_*ala 3 postgresql type-conversion
在我的数据库中有一个last_id类型的字段integer.该表包含多行.假设最大值last_id是104050.现在我想知道这个整数的长度.
由于这是不可能的,我试图将其转换为字符串.
SELECT to_char(MAX(last_id),'99') FROM xxxx
Run Code Online (Sandbox Code Playgroud)
我希望这会产生10与type = text,但它返回## type = text.之后我会用SELECT char_length(to_char(MAX(last_id),'99')) FROM xxx哪个应该返回2 ......
这里出了什么问题?
Erw*_*ter 11
演员的integer价值text:
SELECT length(max(last_id)::text) FROM xxx
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
17941 次 |
| 最近记录: |