Jonvy

导航

Postgres函数使用

1.length, char_length函数计算字符串个数

用法: length(字段名)

如:

查找t_stocpf中客户条码的长度

select char_length(stocpf_no_cli),stocpf_no_cli from t_stocpf where datemodif='20221019' and et_refcmp='P60007131'

2.IntToHex(t_Spare,1);

把整数值转化为16进制字符串,返回值为字符串

3.cast 

cast定义一个新的类型转换。


select cast(t.tranch_no_start as integer) as tranch_no_start, t.tranch_taille, t.tranch_nbuse from t_tranch t inner join
t_refcmp r on t.et_fampf = r.et_fampf where r.id_refcmp = '655392500FE0' and
t.et_prod = '1204' and t.tranch_nbuse < t.tranch_taille order by t.tranch_nbuse desc, 1 asc limit 1

 

posted on 2022-10-19 16:01  不亮  阅读(38)  评论(0)    收藏  举报