Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Javascript code in SQL query in Mysql 9 #34

Open
hrach opened this issue Oct 30, 2024 · 0 comments
Open

Javascript code in SQL query in Mysql 9 #34

hrach opened this issue Oct 30, 2024 · 0 comments
Assignees

Comments

@hrach
Copy link
Member

hrach commented Oct 30, 2024

https://dev.mysql.com/doc/refman/9.0/en/mysql-nutshell.html

CREATE FUNCTION gcd(a INT, b INT) 
RETURNS INT 
NO SQL 
LANGUAGE JAVASCRIPT AS
  $mle$
    let x = Math.abs(a)
    let y = Math.abs(b)
    while(y) {
      var t = y
      y = x % y
      x = t
    }
    return x
  $mle$
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants