最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plsql - Does Oracle DB allow using a custom Procedural Language? - Stack Overflow

programmeradmin3浏览0评论

Oracle DB allows writing procedures in the language PL/SQL. These procedures are compiled and stored in database, and are executed within the same server process as the database, thus removing overhead related to transferring query results between processes or over the network.

PostgreSQL also has such a language, called PL/pgSQL. However, PostgreSQL also allows using a user-defined Procedural Language by writing a so-called Procedural Language Handler.

My question is: does Oracle DB allow using a user-defined Procedural Language?

I tried searching the web for "oracle" "Procedural Language Handler" but saw no relevant results.

Oracle DB allows writing procedures in the language PL/SQL. These procedures are compiled and stored in database, and are executed within the same server process as the database, thus removing overhead related to transferring query results between processes or over the network.

PostgreSQL also has such a language, called PL/pgSQL. However, PostgreSQL also allows using a user-defined Procedural Language by writing a so-called Procedural Language Handler.

My question is: does Oracle DB allow using a user-defined Procedural Language?

I tried searching the web for "oracle" "Procedural Language Handler" but saw no relevant results.

Share Improve this question asked Mar 19 at 12:00 user29990691user29990691 1 1
  • Also, SQL Server has CLR user-defined functions written in any .NET language (C#, F#, VB.NET) – phuzi Commented Mar 19 at 13:21
Add a comment  | 

2 Answers 2

Reset to default 3

Oracle databases do not support embedding code written in arbitrary third-party languages into the database.


However, Oracle does allows you to embed Java code into the database using the CREATE JAVA statement or the loadjava utility. Then SQL procedures and functions can be written to call the Java code that has been embedded into the database.

More details can be found in the Oracle Database Java Developer's Guide.

  • An example of embedding a simple hello world function into the database and then calling it from SQL is given in this answer.
  • A more complicated example of using Java to unzip a BLOB stored in the database is given in this answer.

And in 21 and above, you have DBMS_MLE (https://docs.oracle/en/database/oracle/oracle-database/21/arpls/dbms_mle.html) supporting Javascript.

Example:

CREATE OR REPLACE FUNCTION json_keys(inputObject JSON) RETURN JSON
AS MLE LANGUAGE JAVASCRIPT 
{{
    return Object.keys(INPUTOBJECT);
}};
/

发布评论

评论列表(0)

  1. 暂无评论