1

wondering if the ANSI SQL standard has a portable way to create a sequence object and get values from it?

I can't find a portable way, but search engines seem to confuse ANSI sql with MS SQL server, so maybe I'm just missing it...

asked Sep 9, 2024 at 11:20
3
  • Can you define what you mean by "portable"? Commented Sep 9, 2024 at 12:13
  • Sure, I mean portable across database platforms. It's why I'm asking for ANSI sql. I can write a join with ANSI syntax and it'll work on any ANSI compliant DB, so it's portable. Commented Sep 9, 2024 at 13:43
  • Fair enough. Endrju's answer is what I was going to say, if that's the case. Essentially there is no single portable syntax or even feature across all of the main RDBMS. Commented Sep 9, 2024 at 22:21

1 Answer 1

1

The CREATE SEQUENCE statement is defined in ANSI SQL:2003 which is unfortunately not freely available. There's an overview of new features which describes sequences. As for the portability, it varies. For example SQLite and MySQL don't implement it, but Oracle, SQL Server, PostgreSQL, IBM DB2 do. Basic syntax is the same, but for example Oracle some more options.

So it's not universally portable. You need to define engines that you want to support.

answered Sep 9, 2024 at 16:47

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.