VastbaseE100

基于开源技术的HTAP数据库管理系统。性能优异,稳定可靠,提供诸多专属领域特性。

Menu

兼容WITH FUNCTION

atlasdb=# WITH FUNCTION withfunc(x INTEGER) RETURNS INTEGER AS $$
atlasdb$# BEGIN
atlasdb$#     RETURN x+1;
atlasdb$# END
atlasdb$# $$,
atlasdb-# FUNCTION withfunc2(x INTEGER, y INTEGER) RETURNS INTEGER AS $$
atlasdb$# BEGIN
atlasdb$#     RETURN x+y;
atlasdb$# END;
atlasdb$# $$,
atlasdb-# FUNCTION withfunc3(x TEXT) RETURNS TEXT AS $$
atlasdb$# BEGIN
atlasdb$#     RETURN x || '-test';
atlasdb$# END;
atlasdb$# $$
atlasdb-# SELECT withfunc(1),withfunc2(2,3),withfunc3('4');

 withfunc | withfunc2 | withfunc3 
----------+-----------+-----------
        2 |         5 | 4-test
(1 row)