gpt4 book ai didi

c++ - 如何摆脱使用但未定义的标签

转载 作者:太空宇宙 更新时间:2023-11-04 04:08:08 25 4
gpt4 key购买 nike

我正在尝试在嵌入式 sql 中打印表格的行。我有这段代码,其中 publication 是表,pubid 是属性。我试过这个:

    EXEC SQL DECLARE C1 CURSOR FOR SELECT pubid FROM publication;
EXEC SQL OPEN C1;
EXEC SQL WHENEVER NOT FOUND GOTO close_c1;
for(;;) {
EXEC SQL FETCH C1 INTO :pubid;
cout<<pubid<<endl;
}
close_c1:
EXEC SQL CLOSE C1;

编译器给我这个错误:错误:标签“close_c1”已使用但未定义。我该如何解决这个问题?

最佳答案

只是猜测...将 WHENEVER 行放在嵌入式 sql 序列的第一位。

来自“SQL 引用第 2 卷”:

WHENEVER
.....
Note:
.....
Every executable SQL statement in a program is within the scope of one implicit or >explicit WHENEVER statement of each type. The scope of a WHENEVER statement is related to the listing sequence of the statements in >the program, not their execution sequence.

关于c++ - 如何摆脱使用但未定义的标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3207075/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com