PLSQL:为光标运行FORloop,最后一行打印两次

时间:2019-03-07 09:45:13

标签: oracle plsql

现在,我要做的就是将光标中的值打印在另一个下方。 最后一行被打印两次。

IF c_rules_present %ISOPEN THEN
         CLOSE c_rules_present ;
        END IF;
        OPEN c_rules_present;
            LOOP
                FETCH c_rules_present INTO rule_present_record;
                dbms_output.put_line(rule_present_record.rdr_dcd_cndtn);
                EXIT WHEN c_rules_present %notfound;
            END LOOP;
        CLOSE   c_rules_present;

POST /oauth/v2/accessToken HTTP/1.1
Host: www.linkedin.com
Content-Type: application/x-www-form-urlencoded

grant_type=authorization_code&code=987654321&redirect_uri=https%3A%2F%2Fwww.myapp.com%2Fauth%2Flinkedin&client_id=123456789&client_secret=shhdonottell



curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' -d'{"grant_type":"authorization_code","code":"AQQaI-n6TkOm9po8-a28SQ9g-rEpWE-tjTJvat-DSKhulhpgB_1j93xFpO2y9wQGnu27z7WGJ57Fi1-AbdpGGEgL00Ay0lLHJgKNggYcxGGgTRkKsaEhyDIvDtVgyIf18eanRBPe5YYMFJKXM1Ojoygdgghkhrvx4wLORRkU-eDsZnhfUi7NltX_jKzrYQ","redirect_uri":"http://localhost:3000","client_id":"81k22s8wipax2r","client_secret":"dm2rcFp1631BSMDe"}' 'www.linkedin.com/oauth/v2/accessToken HTTP/1.1'

1 个答案:

答案 0 :(得分:3)

只需将EXIT WHEN条件向上移动:

IF c_rules_present %ISOPEN THEN
         CLOSE c_rules_present ;
        END IF;
        OPEN c_rules_present;
            LOOP
                FETCH c_rules_present INTO rule_present_record;
                EXIT WHEN c_rules_present %notfound;
                dbms_output.put_line(rule_present_record.rdr_dcd_cndtn);
            END LOOP;
        CLOSE   c_rules_present;