试试!
strncpy((char *) my_id.arr, temp_char, strlen(temp_char));
if (strlen(temp_char)<1)
strncpy((char *) my_id.arr, "EI",2);
strncpy((char *) my_id.arr, temp_char, strlen(temp_char));
if (strlen(temp_char)<1)
strncpy((char *) my_id.arr, "EI",2);
char temp_char[100];
printf("\nPlease Enter id (default: EI): ");
gets(temp_char);
if (strlen(temp_char)<1)
strcpy(temp_char,"EI");strncpy((char *) my_id.arr, temp_char, strlen(temp_char));
my_id.len=strlen((char *) my_id.arr);如果ID 的类型是varchar2,
EXEC SQL DECLARE bucket_cursor CURSOR FOR SELECT * FROM mytable WHERE ID=:my_id;
如果id 的类型是CHAR 用 WHERE rtrim(ID) = :my_id;