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
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
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
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>
You might want to try to quote the sequence name, SQL doesn’t like identifiers that contains hyphen :)
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
Beware that Marian slipped in a special double quote before _sequence.