日期:2014-05-17  浏览次数:20915 次

一个sql语句中的字符串等值判断问题,在线等
在PRO-C中,student表中有一Student_ID字段:

char   StudentID[50]   =   's001 ';

select   *   from   student
                  where   Student_ID   =   :StudentID;
请问可以这样直接比较是否相等吗?我做了好像不行啊
用Student_ID   =   to_char(:StudentID);也不行
请问有什么解决方法?谢谢!


------解决方案--------------------
可以这样比较的。
c语言里面要这样:
char StudentID[50] = "s001 ";
不是单引号。
------解决方案--------------------
rtrim(Student_ID) = rtrim(:StudentID)

------解决方案--------------------
strcomp