表名称:imaging_mode
字段:mode(主键)、img_width,img_height,img_infoSELECT * FROM imaging_mode a WHERE a.mode = 'BM256';这个语句在PL/SQL中无法通过,请问这样的sql语句咋写呢?后面的程序已经查询该表了,所以不能修改表字段名称。程序中使用的语句没有问题。SELECT * FROM imaging_mode;
字段:mode(主键)、img_width,img_height,img_infoSELECT * FROM imaging_mode a WHERE a.mode = 'BM256';这个语句在PL/SQL中无法通过,请问这样的sql语句咋写呢?后面的程序已经查询该表了,所以不能修改表字段名称。程序中使用的语句没有问题。SELECT * FROM imaging_mode;
SELECT a.* FROM imaging_mode a WHERE a.mode = 'BM256';
或
SELECT a.* FROM imaging_mode a WHERE a.mode = 'BM256';
如果有别名,就全加上别名;如果没有,就都不要。
这种情况没必要用别名了。SELECT * FROM imaging_mode WHERE mode = 'BM256';如果一定要用,那就:
SELECT a.* FROM imaging_mode a WHERE a.mode = 'BM256';
请将你们写的SQL语句放到PL/SQL Developer或者是SQL*PLUS中试一试?
mode这个词好像是ORACLE中的一个关键字。
2 select 'BM256' "mode",2 img_width,3 img_height,'X' img_info from dual
3 union all
4 select 'BM258' "mode",5 img_width,4 img_height,'Y' img_info from dual)
5 select * from imaging_mode where "mode"='BM256';
mode IMG_WIDTH IMG_HEIGHT IMG_INFO
----- ---------- ---------- --------
BM256 2 3 X
SQL>
select t.*
from (SELECT mode as mode1, img_width, img_height, img_info FROM imaging_mode) t
where t.mode1 = 'BM256'方法2:
select t.*
from (SELECT mode "mode", img_width, img_height, img_info FROM imaging_mode) t
where t."mode" = 'BM256'