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,请勿见笑)

解决方案 »

  1.   

    我这里用字符串和数字测试都可以,你把完整的sql贴出来看看
    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> 
      

  2.   

    Select FieldA,FieldB,"Constant" FieldC From TableXXX ;
      

  3.   

    select 'ccc' fieldc from dual;
    执行正常,没问题呀,可能是别的地方的错误,楼主再好好检查检查吧
      

  4.   

    没什么问题啊
    select empno,'sdfsd' b from emp
      

  5.   

    I know,我用的Select *,'Constant' FieldC From TableXXX 这样不行~~~
      

  6.   

    你家个表别名 是可以的  
    select t.*,'constant' fieldc from tableXXX;
      

  7.   


    select t.*,'constant' fieldc from tableXXX t;
      

  8.   

    不要用 *
    或者 要用 select t.*, 
             'constant' fieldc from tableXXX t;
      

  9.   

    已解决,1小时后结贴。 
    请各位再看看我的另一个问题,谢谢了。!!!! 另一PL/SQL简单的Select问题,关于传入参数查询  
    http://topic.csdn.net/u/20090114/15/8fc57fc6-34a7-40dc-bcb7-a80f443bb637.html