Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Andras Simon — — source: Informix-list mailing list archive (1991-1998)
How do I SELECT a single row using a user supplied search criterion
into a host variable in 4gl?
It seems that I need to PREPARE the select statement (because of the
variable part) and I thought I could use EXECUTE .. INTO .. to fetch
the result. But the compiler disagrees :-(
DATABASE mydbase
main
define stmnt char(100)
define crit char(30)
define this like tbl.name
let crit = "rowid=1" -- so the result will be unique
let stmnt = "select name from tbl where ", crit
prepare p from stmnt
execute p into this
|_____________^
|
| A grammatical error has been found on line 12, character 15.
| The construct is not understandable in its context.
| See error number -4373.
I would appreciate any help!
Andras
ps. I can do this with a cursor, but that seems to be an overkill when
I know I'll get at most one row.
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.