From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
Cc: | walther(at)technowledgy(dot)de, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Sergey Shinderuk <s(dot)shinderuk(at)postgrespro(dot)ru>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, dean(dot)a(dot)rasheed(at)gmail(dot)com, er(at)xs4all(dot)nl, joel(at)compiler(dot)org, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Schema variables - new implementation for Postgres 15 |
Date: | 2024-06-05 05:21:56 |
Message-ID: | CAFj8pRAFMCe=aCytqNvN2vV8XGERWHxGu=BwAXzUKhfMveq+2A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> 6. Oracle
>
> Oracle PL/SQL allows the use of package variables. PL/SQL is +/- ADA
> language - and package variables are "global" variables. They are not
> directly visible from SQL, but Oracle allows reduced syntax for functions
> without arguments, so you need to write a wrapper
>
> CREATE OR REPLACE PACKAGE my_package
> AS
> FUNCTION get_a RETURN NUMBER;
> END my_package;
> /
>
> CREATE OR REPLACE PACKAGE BODY my_package
> AS
> a NUMBER(20);
>
> FUNCTION get_a
> RETURN NUMBER
> IS
> BEGIN
> RETURN a;
> END get_a;
> END my_package;
>
> SELECT my_package.get_a FROM DUAL;
>
> Inside SQL the higher priority has SQL, inside non SQL commands like CALL
> or some PL/SQL command, the higher priority has packages.
>
The risk of collision's identifier is in some PL/SQL statements less than
in Postgres, because SQL can be used only on dedicated positions (minimally
in older Oracle's versions). Against other databases there is not allowed
to use SQL everywhere as an expression. PL/SQL is an independent language,
environment with its own expression executor (compiler). Other databases
allow you to use an SQL subselect (I tested MySQL, PL/pgSQL, and I think
(if I remember docs well) it is in standard SQL/PSM (related part of
ANSI/SQL)) as expression. The integration of SQL into PL/SQL is not too
deep and stored procedures look more like client code executed on the
server side.
Regards
Pavel
From | Date | Subject | |
---|---|---|---|
Next Message | Kyotaro Horiguchi | 2024-06-05 05:25:15 | Re: Add last_commit_lsn to pg_stat_database |
Previous Message | Alexander Pyhalov | 2024-06-05 05:19:04 | Re: Partial aggregates pushdown |