pl/sql中,如何实现此功能:
Select FieldA,FieldB,'Constant' FieldC From TableXXX在Sqlserver中这个语句的语法是正确的,可是PL/SQL中就提示
Error report:
SQL Error: ORA-00936: missing expression
00936. 00000 - "missing expression"正确的语句如何写,请各位指教。
(初次使用Oracle,请勿见笑)
Select FieldA,FieldB,'Constant' FieldC From TableXXX在Sqlserver中这个语句的语法是正确的,可是PL/SQL中就提示
Error report:
SQL Error: ORA-00936: missing expression
00936. 00000 - "missing expression"正确的语句如何写,请各位指教。
(初次使用Oracle,请勿见笑)
SQL> select empno, 'Constant' fieldC from emp; EMPNO FIELDC
---------- --------
7369 Constant
7499 Constant
7521 Constant
7566 Constant
7654 Constant
7698 Constant
7782 Constant
7788 Constant
7839 Constant
7844 Constant
7876 Constant EMPNO FIELDC
---------- --------
7900 Constant
7902 Constant
7934 Constant14 rows selected.SQL> select empno, 2222 FieldC from emp; EMPNO FIELDC
---------- ----------
7369 2222
7499 2222
7521 2222
7566 2222
7654 2222
7698 2222
7782 2222
7788 2222
7839 2222
7844 2222
7876 2222 EMPNO FIELDC
---------- ----------
7900 2222
7902 2222
7934 222214 rows selected.SQL>
执行正常,没问题呀,可能是别的地方的错误,楼主再好好检查检查吧
select empno,'sdfsd' b from emp
select t.*,'constant' fieldc from tableXXX;
select t.*,'constant' fieldc from tableXXX t;
或者 要用 select t.*,
'constant' fieldc from tableXXX t;
请各位再看看我的另一个问题,谢谢了。!!!! 另一PL/SQL简单的Select问题,关于传入参数查询
http://topic.csdn.net/u/20090114/15/8fc57fc6-34a7-40dc-bcb7-a80f443bb637.html