Oracle
 sql >> Base de données >  >> RDS >> Oracle

vérifier les lignes nulles dans la requête select

Utilisez la structure sqlca

EXEC SQL include "sqlca.h"
#define NO_ROWS_FOUND (sqlca.sqlcode==1403)
EXEC SQL BEGIN DECLARE SECTION;
    int val=0;
    short ind=0;
EXEC SQL END DECLARE SECTION;

EXEC SQL 
    select value
    int :val :ind 
      from mytable where rownum=1;
if(NO_ROWS_FOUND)
   printf("No rows found\n");