在EXEC SQL 中怎么在条件中加in呢?需直接在EXEC SQL语句中写,不拼装SQL后使用游标。
我这样写查不出数据,为啥?请教高手。
create table tt_temp
(
user_id number(2),
oper_type number(4)
);insert into tt_temp(user_id,oper_type) values(1,321);
insert into tt_temp(user_id,oper_type) values(2,123);
commit;EXEC SQL BEGIN DECLARE SECTION;
int Q_iUserID = -1;
char Q_cOperType[20] = "321,123";
EXEC SQL END DECLARE SECTION;EXEC SQL SELECT min(user_id) into :Q_iUserID from tt_temp where oper_type in (:Q_cOperType) ;为啥查不出数据,要是在条件中加in应该怎么写?谢谢!!
我这样写查不出数据,为啥?请教高手。
create table tt_temp
(
user_id number(2),
oper_type number(4)
);insert into tt_temp(user_id,oper_type) values(1,321);
insert into tt_temp(user_id,oper_type) values(2,123);
commit;EXEC SQL BEGIN DECLARE SECTION;
int Q_iUserID = -1;
char Q_cOperType[20] = "321,123";
EXEC SQL END DECLARE SECTION;EXEC SQL SELECT min(user_id) into :Q_iUserID from tt_temp where oper_type in (:Q_cOperType) ;为啥查不出数据,要是在条件中加in应该怎么写?谢谢!!
比如
int a=321, b=123;然后
EXEC SQL SELECT min(user_id) into :Q_iUserID from tt_temp where oper_type in (:a, :b); 这样肯定是可以的。