CHARINDEX(‘,’,@src)
在postgresql里是
POSITION(‘,’ in :src)
ISNULL
在postgresql里是
COALESCE len
在postgresql里是
length
STUFF(@arr1,1,CHARINDEX(@split,@arr1+@split)+@splitlen,”)
在postgresql里是
replace($1,substring($1,1,POSITION(split in $1 || split)+splitlen),”);
WHILE pos>1 LOOP
结束要
END LOOP
if
end if
CASE WHEN a=’1′ THEN
END CASE
CASE WHEN a=’1′ THEN
WHEN a=’2′
ELSE
END CASE 类型转换:
直接是 ‘123’::character varying 就转成字符串了
123::character varying
赋值
:=
例如:
DECLARE result character varying;
result := 123;
在pgAdmin里测试代码块,需要用到匿名代码块:
do $$declare a varchar;
begin
select max(act_id)+1 into a from ledm_admin_action;
raise notice ‘%’,a;
end$$;
参考http://www.postgresql.org/docs/9.2/static/sql-do.html