sql - How to avoid 'unique constraint' error message when creating a view -


i have normal view , iam getting error message :

[error] execution (6: 83): ora-00604: error occurred @ recursive sql level 1 ora-00001: unique constraint (sys.i_col1) violated 

but don't doing wrong. says bacl.description, batl.description, bagl.description violating uniqueness constraint.

    create or replace force view cci.vw_ta04_bac_page_4_2    select            bac.id,           bac.code code,           bacl.description,           bac.order_key,          bac.bat_id,           batl.description,           bac.bag_id,           bagl.description,           bac.weight_factor,           bac.display      bart_categories bac,           bart_categories_lae bacl,           bart_category_groups bag,           bart_category_groups_lae bagl,           bart_category_types bat,           bart_category_types_lae batl     bacl.lae_id = pkg_process.language     , batl.lae_id = pkg_process.language     , bagl.lae_id = pkg_process.language      , (bac.bag_id = bag.id)     , (bac.bat_id = bat.id)           , (bacl.bac_id = bac.id)     , (bagl.bag_id = bag.id)     , (batl.bat_id = bat.id) 

thanks advice.

" says bacl.description, batl.description, bagl.description violating uniqueness constraint"

your view has columns same name 3 different tables. column name must unique in view. need alias columns. instance trick:

create or replace force view cci.vw_ta04_bac_page_4_2 select        bac.id,       bac.code code,       bacl.description bac_description,       bac.order_key,      bac.bat_id,       batl.description bat_description,       bac.bag_id,       bagl.description  bag_description,       bac.weight_factor,       bac.display 

" tought writing "bacl" in front or enough."

we need both. table alias tells sql engine table provides referenced value not part of column name.


Comments

Popular posts from this blog

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -