如何在oracle上修复重复的列名?

时间:2017-02-17 23:16:52

标签: sql oracle

我目前正在处理来自Oracle Developer的OE Schema的数据。我试图创建一个显示所有列并加入代码中列出的所有表的视图。但是,在运行代码时,我得到了这个错误:

Error at Command Line:8 Column:55
Error report:
SQL Error: ORA-00957: duplicate column name
00957. 00000 -  "duplicate column name"

这是我的代码

CREATE VIEW QUESTION8 AS 
SELECT      c.customer_id, c.cust_first_name, c.cust_last_name, 
            c.cust_address.street_address, c.cust_address.postal_code, c.cust_address.city, c.cust_address.state_province, c.cust_address.country_id, 
            oe.get_phone_number_f(1, c.phone_numbers) AS Phone_Number,
            c.nls_language, c.nls_territory, c.credit_limit, c.cust_email, c.account_mgr_id,
            c.cust_geo_location.sdo_point.x AS Longitude, c.cust_geo_location.sdo_point.y AS Latitude,
            c.date_of_birth, c.marital_status, c.gender, c.income_level,
            o.order_id, o.order_date, o.order_mode, o.customer_id, o.order_status, o.order_total,o.sales_rep_id, o.promotion_id,
            oi.order_id, oi.line_item_id, oi.product_id, oi.unit_price, oi.quantity,
            pi.product_id, pi.product_name, pi.product_description, pi.category_id, pi.weight_class, pi.warranty_period, pi.supplier_id, pi.product_status, pi.list_price, pi.min_price, pi.catalog_url,
            ct.category_name, ct.category_description, ct.category_id, ct.parent_category_id
FROM        oe.customers c JOIN
            oe.orders o ON
            c.customer_id = o.customer_id JOIN
            oe.order_items oi ON
            o.order_id = oi.order_id JOIN
            oe.product_information pi ON
            oi.product_id = pi.product_id JOIN
            oe.categories_tab ct ON
            pi.category_id = ct.category_id

从我的代码中可以看出,o.customer_id实际上并不重复。我该如何解决这个问题?

0 个答案:

没有答案