哪些 SQL 实现具有类似 PSM 的功能?

发布于 2024-09-07 22:24:22 字数 442 浏览 7 评论 0原文

尽管 Oracle 是最早创建存储过程 (PL/SQL) 的公司之一,但 Informix 与 (SPL) 除了 DB2 之外,还有哪些 RDBMS 产品在 1998 年之后实现了 SQL/PSM 或其子集?.. 哪些 RDBMS 可以支持类似的过程下面的例子?:

 CREATE OR REPLACE FUNCTION foo1(a integer)
RETURNS void AS $$
  CASE a
    WHEN 1, 3, 5, 7, 9 THEN
      PRINT a, 'is odd number';
    WHEN 2, 4, 6, 8, 10 THEN
      PRINT a. 'is odd number';
    ELSE 
      PRINT a, 'isn't from range 1..10';
  END CASE;
$$ LANGUAGE plpgpsm;

Although Oracle is one of the earliest to create stored procedures (PL/SQL) then Informix with (SPL) which RDBMS products besides DB2 have implemented SQL/PSM or a subset of it after 1998?.. Which RDBMS' can support procs like in the following example?:

 CREATE OR REPLACE FUNCTION foo1(a integer)
RETURNS void AS $
  CASE a
    WHEN 1, 3, 5, 7, 9 THEN
      PRINT a, 'is odd number';
    WHEN 2, 4, 6, 8, 10 THEN
      PRINT a. 'is odd number';
    ELSE 
      PRINT a, 'isn't from range 1..10';
  END CASE;
$ LANGUAGE plpgpsm;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情深如许 2024-09-14 22:24:22

据我所知,只有 DB2 接近 PSM。 Sybase 很早就推出了 Transact-SQL;微软借用了这一点。值得关注的三匹黑马是 MySQL、PostgreSQL 和 Ingres。然而,当我查看他们的代码时,我不记得认为他们中的任何一个与 PSM 接近。

然而,Google 搜索“mysql psm”表明 MySQL 5.x 和 PostgreSQL 8.2 支持接近标准的 PSM 形式。 (搜索“ingres psm”表明 Ingres 中的 PSM 是一种“部分排序合并”连接技术。)

Only DB2 is close to PSM, AFAIK. Sybase had its Transact-SQL very early on; Microsoft borrowed that. Three dark horses that perhaps bear checking out are MySQL, PostgreSQL and Ingres. However, I don't recall thinking that any of them were close to PSM when I've looked at their code.

However, a Google search for 'mysql psm' suggests that MySQL 5.x and PostgreSQL 8.2 support a form of PSM close to the standard. (The search for 'ingres psm' shows that PSM in Ingres is a 'Partial Sort Merge' join technique.)

这个俗人 2024-09-14 22:24:22

似乎每个产品都包含自己的存储模块实现,但大多数都非常相似。例如,您的示例可以用 Oracle 的 PL/SQL 重写如下:

CREATE OR REPLACE PROCEDURE foo1(a integer) AS
BEGIN
  CASE
    WHEN a IN (1, 3, 5, 7, 9) THEN
      DBMS_OUTPUT.PUT_LINE(a || ' is odd number');
    WHEN a IN (2, 4, 6, 8, 10) THEN 
      DBMS_OUTPUT.PUT_LINE(a || ' is even number'); 
    ELSE
      DBMS_OUTPUT.PUT_LINE(a || ' isn''t FROM RANGE 1..10');
  END CASE;
END;

分享并享受。

It seems that each product contains its own implementation of stored modules, but most are pretty similar. For instance, your example could be rewritten in Oracle's PL/SQL as follows:

CREATE OR REPLACE PROCEDURE foo1(a integer) AS
BEGIN
  CASE
    WHEN a IN (1, 3, 5, 7, 9) THEN
      DBMS_OUTPUT.PUT_LINE(a || ' is odd number');
    WHEN a IN (2, 4, 6, 8, 10) THEN 
      DBMS_OUTPUT.PUT_LINE(a || ' is even number'); 
    ELSE
      DBMS_OUTPUT.PUT_LINE(a || ' isn''t FROM RANGE 1..10');
  END CASE;
END;

Share and enjoy.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文