From: | HYip <hualinyip(at)earthlink(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | select error with null string -- error code -209 |
Date: | 2001-05-04 15:48:00 |
Message-ID: | 3AF2C10C.F877EB06@earthlink.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I am using following codes to get the accountname, and account from the
Table Account;
accountname, and account are varchar(30) and it can be null.
The code has no problem when both accountname, and account are not
null. It gives me an errror code of -209 when the account is null.
Anyone has any idea of fixing it.
the output looks like :
error in fetch -209
Thanks,
EXEC SQL BEGIN DECLARE SECTION;
char query_string[256];
char name[30];
char account[30];
EXEC SQL END DECLARE SECTION;
EXEC SQL CONNECT TO :dbname user :userid/:passwd;
if(sqlca.sqlcode) {
printf("error in connect\n");
return FALSE;
}
sprintf(query_string, "SELECT accountname, account FROM Account where
AccountID = %d", customerId);
EXEC SQL PREPARE sql_command FROM :query_string;
EXEC SQL DECLARE c_cursor2 CURSOR FOR sql_command;/* DECLARE a cursor
*/
EXEC SQL OPEN c_cursor2;
if(sqlca.sqlcode) {
printf("error in cursor\n");
return FALSE;
}
EXEC SQL FETCH c_cursor2 INTO :name, :account;
if(sqlca.sqlcode) {
printf("error in fetch %d\n", sqlca.sqlcode);
return FALSE;
}
From | Date | Subject | |
---|---|---|---|
Next Message | Martín Marqués | 2001-05-04 15:56:13 | how to see rules |
Previous Message | Gyozo Papp | 2001-05-04 15:37:14 | arbitrary number of values from a sequence |