Is it possible to access (CURRVAL/NEXTVAL) 4GL sequence from SQL ? How to do it ?
I've tried to use KB article https://knowledgebase.progress.com/articles/Article/P183766 but I've got SQL syntax error.
Yes, if you're running it from a Progress program.
You could use sql explorer command line utility:
proenv>sqlexp -db <dbname> -H <host|ip> -S <port|service> -user <userid> -pass <password>
SQLExplorer>SELECT PUB.NextCustNum.CURRVAL from PUB."_File" WHERE "_File-Name" = 'Customer'.
Why do you want to do it from SQL? You can get the same value from ABL using the example I provided.
Kenneth S. McIntosh
Principal Technical Support Engineer
What is your sql statement and the exact text of the error? Also what version are you using?
SELECT PUB.NextCustNum.CURRVAL from PUB."_File" WHERE "_File-Name" = 'Customer'.
** Niezrozumiały tekst po -- "CURRVAL from PUB". (247)
** Linia 1 -- Niewłaściwe wyrażenie SQL. (945)
I see you're running this from the ABL, not SQL-92. When using the ABL to execute SQL it uses SQL-89 (and btw this is deprecated functionality). I believe the NEXTVAL stuff only applies in SQL 92. You can use the NEXT-VALUE() function to get the next value from the sequence, as follows:
Is Developer Studio using SQL-89 too? How to use SQL-92 and display CURRVAL?
I was using ODBC access only for reporting. And now I'm trying to use it for updating too. Is it possible ?