Skip site navigation (1) Skip section navigation (2)

ECPG error: break statement not within loop or switch

From: Hans-Jürgen Schönig <hs(at)cybertec(dot)at>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: ECPG error: break statement not within loop or switch
Date: 2001-05-23 14:19:03
Message-ID: 3B0BC6D7.E6C65E2A@cybertec.at (view raw or flat)
Thread:
Lists: pgsql-interfaces
I have written a small application but I can't compile the code because
of an error I have never seen before:

ecpg retrieve.pgc -o file.c
gcc -g -I /usr/include/pgsql -o prog file.c -L /usr/share/pgsql -lecpg
-lpq
retrieve.pgc: In function `main':
retrieve.pgc:57: break statement not within loop or switch
make: *** [x] Fehler 1

What does it mean?
I have listed the crucial piece of code below:

 EXEC SQL DECLARE mycursor CURSOR FOR mystatement;
        EXEC SQL OPEN mycursor;

        EXEC SQL WHENEVER NOT FOUND DO BREAK;
        while   (1)
        {
                EXEC SQL FETCH IN mycursor INTO :id, :name;
                flag=1;
                printf("records found: %i, %s\n\n", id, name);
        }

        if      (flag == 0)
        {
                printf("Insert the name of the OS: ");
                scanf("%256s", inos);

                EXEC SQL INSERT INTO os (id, name) VALUES (':intext',
':inos');         // THE ERROR OCCURS HERE
                if      (sqlca.sqlcode)
                {
                        printf("%s\n", sqlca.sqlerrm.sqlerrmc);
                        exit(0);
                }
        }

        EXEC SQL CLOSE mycursor;
        EXEC SQL DISCONNECT;

Can anybody help me?

    Hans


Responses

pgsql-interfaces by date

Next:From: Zachary BeaneDate: 2001-05-23 20:34:32
Subject: DBD::Pg or DBI breakage?
Previous:From: Tatsuo IshiiDate: 2001-05-23 00:59:39
Subject: Re: Pgaccess - localization problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group