请大家帮我看看Oracle建立视图的语句
我写的视图语句是这样的create or replace view j_customer_view as
select C.CUSTOMER_ID,C.CUSTOMER_NAME,C.PARENT_CUSTOMER_ID,C.TRADE_NAME,(select name from J_REGION B where C.PROV_REGION_CODE=B.REGION_CODE) AS NAME1,
(select name from J_REGION B where C.CITY_REGION_CODE=B.REGION_CODE) AS NAME2,
(select name from J_REGION B where C.SUB_CITY_REGION_CODE=B.REGION_CODE) AS NAME3,C.CUSTOMER_ADDRESS,
C.POSTMAIL,,,,,C.WEB_SITE,C.EMAIL,,
C.SOURCE_FLAG,C.REGISTERED_MARK,(select U.LOGINNAME from J_USER U where U.USERID=C.CREATE_EMPL_ID ),C.CREATE_EMPL_ID,C.STATUS,C.COLL_EMPL,
(select U1.LOGINNAME from J_USER U1 where U1.USERID=C.AUDIT_EMPL_ID ),C.AUDIT_EMPL_ID,C.AUDIT_TIME,
C.CREATE_TIME,C.INT_ORG_ID
from J_INT_ORG C where C.AUDIT_EMPL_ID is not null and C.AUDIT_TIME is not null order by C.INT_ORG_ID;
产生的错误是:ORA-00998 必须使用列别名命名此表达式
上述语句中产生错误的是:
(select U.LOGINNAME from J_USER U where U.USERID=C.CREATE_EMPL_ID )和
(select U1.LOGINNAME from J_USER U1 where U1.USERID=C.AUDIT_EMPL_ID )
因为我必须从J_USER中取得LOGINNAME,而连接条件就是U.USERID=C.CREATE_EMPL_ID
C表是下面出现的。我不知怎么改了,大家帮忙看看,谢谢!