thegritche
Programmer
I am currently working on queries convertion from Informix to Postgres. I have to convert tons of lines of esql/c scripts (informix) into ecpg scripts (postgres). Hence i use AWK scripts to acheve this job.
My problem is about the $FETCH LAST <cursor_name> INTO ... request. The LAST keyword means that the fetch instruction will put the "last" cursor line. I couldn't find an equivalent in the postgres documentation without faking the request.(with FETCH NEXT/PRIOR/ALL ...)
Can someone tell me if he/she has a solution ?
My constraints are :
- make the least changes to the original source code.
- use an iterative converting process (do not add instructions anywhere in the source code).
- do NOT modify the value of "sqlca.sqlcode" (it is generaly tested just after the FETCH for succes/failure)
All the statements i work on look like this :
> declare <name> cursor for select (...)
> ...
> open <name>
> ...
> fetch "last" <name> into <variable>
> test "sqlca.sqlcode" for errors
> ...
> close <name>
Note : there are no other FETCH in the statement.
My problem is about the $FETCH LAST <cursor_name> INTO ... request. The LAST keyword means that the fetch instruction will put the "last" cursor line. I couldn't find an equivalent in the postgres documentation without faking the request.(with FETCH NEXT/PRIOR/ALL ...)
Can someone tell me if he/she has a solution ?
My constraints are :
- make the least changes to the original source code.
- use an iterative converting process (do not add instructions anywhere in the source code).
- do NOT modify the value of "sqlca.sqlcode" (it is generaly tested just after the FETCH for succes/failure)
All the statements i work on look like this :
> declare <name> cursor for select (...)
> ...
> open <name>
> ...
> fetch "last" <name> into <variable>
> test "sqlca.sqlcode" for errors
> ...
> close <name>
Note : there are no other FETCH in the statement.