blogger

    blogger
  • hot log

  • comment

    twitter

    • 空间续费,加上ssl连接。。

      2018-11-22 01:04

    • 12.10.xC6出来时候碰到"Could not determine encryption mode from page zero",竟果然是BUG!http://www-01.ibm.com/support/docview.wss?rs=630&uid=swg21973408

      2015-12-21 20:15

    • 空间已经转移到新加坡,希望会好一些。

      2015-11-16 14:34

    • 增加新域名liaosnet.cc,与liaosnet.com同指向。

      2015-10-09 15:25

    • 空间迁移到香港。或许速度会快一点。。

      2014-02-13 20:10

    • More»

    blog sort

    links

    record

    banner

    GBase 8s LIST类型

    暗夜星空's Memory from Mar 6 , 2019 at 20:31 PM , under Category:IFX/GBase
    -- 1. 定义 row type
    CREATE ROW TYPE rowtype_list(id int, name varchar(40));
    
    -- 2. 创建 spl
    DROP FUNCTION IF EXISTS get_list;
    CREATE FUNCTION get_list()
      RETURNING LIST(rowtype_list not null)
      
      DEFINE v_list LIST(rowtype_list not null);
      DEFINE i int;
      
      LET v_list = list{};
      
      FOR i = 1 TO 10
        INSERT INTO TABLE(v_list) values(ROW(i,'test'||i)::rowtype_list);
      END FOR;
      
      RETURN v_list;
    END FUNCTION;
    
    --3. 查询spl返回
    select * from table(get_list());
    结果:
    > select * from table(get_list());
    
    
             id name
    
              1 test1
              2 test2
              3 test3
              4 test4
              5 test5
              6 test6
              7 test7
              8 test8
              9 test9
             10 test10
    
    10 row(s) retrieved.
    

    Post a comment:

    Your email address will not be published. Required fields are marked﹡