Databases 4 min read

Why MySQL Now Lets You Write Stored Procedures in JavaScript

Oracle announced preview support for JavaScript‑based stored procedures in MySQL, showing how to write, call, and debug them using GraalVM, while industry reactions highlight both excitement and concerns about mixing languages in database logic.

ITPUB
ITPUB
ITPUB
Why MySQL Now Lets You Write Stored Procedures in JavaScript
Anything that can be done with JavaScript will eventually be done with JavaScript.

Background

Oracle recently announced on the official MySQL blog that MySQL now supports writing stored procedures in JavaScript. The announcement links to https://blogs.oracle.com/mysql/post/introducing-javascript-support-in-mysql and positions JavaScript—the most popular programming language—against the most popular database, suggesting developers no longer need to choose between them.

How to Use JavaScript Stored Procedures

Below is a simple example of a JavaScript stored procedure (shown in the image). The procedure can be created with the CREATE PROCEDURE statement using JavaScript syntax. To invoke it, call the procedure from standard SQL just like any other stored routine.

Debugging follows the familiar pattern of using print statements and throwing exceptions.

Oracle ensures the safety and performance of JavaScript execution inside MySQL by leveraging its own GraalVM runtime.

Industry Reactions

The feature is still in preview and limited to MySQL Enterprise Edition and the HeatWave cloud service, but it has already sparked strong reactions on Reddit and Hacker News. Users joke about the inevitable rise of new JavaScript frameworks for the database layer and share personal experiences of mixing SQL and JavaScript in stored procedures.

One Hacker News comment notes that using JavaScript in Snowflake stored procedures makes code harder to read but can protect a developer’s role because analysts must rely on them to update logic that spans both languages.

Conclusion

MySQL’s strong community presence makes the JavaScript addition a hot topic, though jokes about “running out of memes” abound.

The feature’s first author previously spent three years on the Alibaba Cloud Database team.

PostgreSQL still leads in JavaScript support via PLV8, a more mature solution.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

JavaScriptdatabasemysqlgraalvmStored Procedures
ITPUB
Written by

ITPUB

Official ITPUB account sharing technical insights, community news, and exciting events.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.