Re: Select from esql/c-2
Posted in 1998
Topics: SQL Development & Query Writing, Error Codes & Troubleshooting, Connectivity: ESQL/C, 4GL & Embedded SQL, Server Administration, Platform-Specific Issues
The problem is shown below
|
V
Irina Kotlova wrote:
>
> Hello!
>
> Unknown problems with cursor (OnLine 5.0 under Solaris 2.5.1). Could anybody
> advise anything? There are 13 records in DB, satisfying the condition and
> seeing in "dbaccess", but no records are retrieved neither by the user, nor
> by "root". The code is bellow.
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> #define NUMBERMESSAGESSENT_ANNOUNCE "records were discovered by \\"snap\\""
> /* includes for SQL */
> $include sqlca;
> int main()
> {
> /* Declare variables for SQL query */
> $int InputDate, tag, transkind;
> int MessNumber = 0;
> char buffer[15]; /* record buffer */
>
> /* Date setting */
> InputDate = 19971126;
> $database school;
> $declare scursor cursor for
> select tag
> into $tag
> from user_transactions
> where tdate = $InputDate and $transkind = 3;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
????????????????????????????????????
??????????? $transkind = 3 ?????????
????????????????????????????????????
> $begin work;
> $open scursor;
> for(;;)
> {
> $fetch scursor;
> if (sqlca.sqlcode != 0) break;
> sprintf(buffer, "%d", tag);
> printf("%s\\n", buffer);
> MessNumber++;
> }
> $close scursor;
> $commit work;
> printf("\\n%d %s\\n", MessNumber, NUMBERMESSAGESSENT_ANNOUNCE);
> exit(0);
> }
>
> Irina Kotlova