• SAP HANA存储过程样例(Table Type输出) 沧海


    image

    CREATE PROCEDURE getOutput( IN cnt INTEGER, IN currency VARCHAR(3),
                                OUT output_pubs tt_publishers,
                                OUT output_year tt_year)
         LANGUAGE SQLSCRIPT READS SQL DATA AS
    BEGIN
      big_pub_ids = SELECT publisher AS pid FROM books      -- Query Q1
                    GROUP BY publisher HAVING COUNT(isbn) > :cnt;
      big_pub_books = SELECT title, name, publisher,        -- Query Q2
                             year, price
                      FROM :big_pub_ids, publishers, books
                      WHERE pub_id = pid AND pub_id = publisher
                      AND crcy = :currency;
      output_pubs = SELECT publisher, name,                 -- Query Q3
                           SUM(price) AS price, COUNT(title) AS cnt
                    FROM :big_pub_books GROUP BY publisher, name;
      output_year = SELECT year, SUM(price) AS price,       -- Query Q4
                    COUNT(title) AS cnt
                    FROM :big_pub_books GROUP BY year;
    END;

    标准存储过程创建语句:

    CREATE PROCEDURE <proc_name> [(<parameter_clause>)] [LANGUAGE <lang>] [SQL SECURITY
    <mode>]
    [READS SQL DATA [WITH RESULT VIEW <view_name>]] AS
    <local_scalar_variables>
    BEGIN
       <procedure_code>
    EN

  • 相关阅读:
    网页的状态掩码
    分享到JavaScript
    右下角收缩广告
    播放列表的收缩展开
    创建文本节点createTextNode
    创建元素节点createElement
    进栈和出栈
    刚刚上班才回来,今天和你说说hash数组
    关于JS中的定时器!!!
    面向对象(程序员最呆的地方,一切皆是对象)
  • 原文地址:https://www.cnblogs.com/omygod/p/3015223.html
Copyright © 2020-2023  润新知