Progress sequence access via ODBC driver SQL

Posted by Andrzej.Sz on 29-Mar-2018 03:24

How can I access (CURRVAL/NEXTVAL) Progress DB sequences using ODBC driver SQL statement? I need it for INSERTing new records into Progress DB (OE11.6.4) from PHP application.

Regards

Andrzej

Posted by Marek Bujnarowski on 29-Mar-2018 06:00

SQLExplorer>select PUB.NextCustNum.CURRVAL from PUB."_File" where "_File-Name" = 'Customer';

   sequence_current

--------------------

               3020

SQLExplorer>select PUB.NextCustNum.NEXTVAL from PUB."_File" where "_File-Name" = 'Customer';

      sequence_next

--------------------

               3025

All Replies

Posted by Marek Bujnarowski on 29-Mar-2018 06:00

SQLExplorer>select PUB.NextCustNum.CURRVAL from PUB."_File" where "_File-Name" = 'Customer';

   sequence_current

--------------------

               3020

SQLExplorer>select PUB.NextCustNum.NEXTVAL from PUB."_File" where "_File-Name" = 'Customer';

      sequence_next

--------------------

               3025

Posted by Andrzej.Sz on 29-Mar-2018 10:28

With "sports" DB it works but with my DB I've got syntax error

SQLExplorer>SELECT PUB.sq-firma.CURRVAL FROM PUB."_File" WHERE "_File-Name" = 'firmy';

=== SQL Exception 1 ===

SQLState=HY000

ErrorCode=-210056

[DataDirect][OpenEdge JDBC Driver][OpenEdge] Syntax error in SQL statement at or about "CURRVAL FROM PUB."_File" WHERE "_File-Na" (10713)

Without ending colon SQL Explorer displays 1>

Posted by marian.edu on 29-Mar-2018 12:18

You might want to try to quote the sequence name, SQL doesn’t like identifiers that contains hyphen :)


select PUB."sq-firma".CURRVAL from “_sequence" where "_seq-name" = 'sq-firma'

Marian Edu

Acorn IT 
+40 740 036 212

Posted by Andrzej.Sz on 29-Mar-2018 14:13

SQLExplorer doesn't accept this correction - no change (what does ">1" mean?)

but "DB Navigator" and ODBC driver like it !!!

Marek & Marian, thank you for your assistance.

Andrzej

Posted by Stefan Drissen on 30-Mar-2018 00:26

Beware that Marian slipped in a special double quote before _sequence.

This thread is closed