CREATE MATERIALIZED VIEW ORA-00957
Hi
I have tried using this query to create a MVIEW and I get an ORA-00957 (duplicate column name)
select t.month
,t.year
,t.entity_code
,t.itemref_local
,t.qty
,t.revenue
,t.cogs
,t.ppv
,t.FD
,t.var_labor
,t.var_ovhd
,n.code entity_code
,n.name entity_name
,n.finance_responsible
,c.local_name
,c.emea_name
,c.segment
,c.country
,c.origin_entity
,c.icp_code
,c.type
,c.rmm
,c.sales_rep
,c.sales_leader
,c.emea_director
,c.nat_accounts
,o.code country_code
,o.NAME country_name
,o.REGION country_region
,e.ELIMINATED
,i.PART_NUMBER
,i.DESCRIPTION part_description
,i.PRODUCT_GROUP
,i.LINE
,i.CATEGORY
,i.FAMILY
,i.RANGE
,i.SUPPLIER
,i.PLM
FROM hsce_transactions T
, hsce_entity N
, hsce_customers C
, hsce_country O
, hsce_elim E
, HSCE_ITEMS I
, HSCE_MAPPING M
WHERE T.entity_code = N.code
AND T.customer_code = C.customer_code
AND C.ICP_CODE = E.ICP_CODE
AND C.country = O.code
AND T.ITEMREF_LOCAL = M.ITEM_REF
and M.PART_NUMBER = I.PART_NUMBERCan anyone point me to where I have gone wrong?
Thanks
Adam
I'm getting the duplicate column name on my query as well; however the validate feature in Toad, validated the query. I can select and even try to tune the query. therefore, I don't understand the error.
CREATE MATERIALIZED VIEW SYSADM.BAHAR_MV
STORAGE (
BUFFER_POOL DEFAULT
NOCACHE
NOLOGGING
COMPRESS
NOPARALLEL
BUILD IMMEDIATE
USING INDEX
STORAGE (
BUFFER_POOL DEFAULT
REFRESH COMPLETE ON DEMAND
WITH ROWID
USING DEFAULT LOCAL ROLLBACK SEGMENT
AS
/* Formatted on 2009/02/12 13:55 (Formatter Plus v4.8.7) */
SELECT a.business_unit, a.deptid, a.jobcode, a.emplid, f.oth_hrs, f.oth_earns,
h.gl_expense, f.erncd, d.descr, b.descr, c.descr, g.NAME, c.setid,
c.effdt, b.setid, b.deptid, b.effdt, e.check_dt, a.pay_end_dt,
i.ah89_ldr_summary, i.ah89_ldr_summ_grp
FROM ps_pay_earnings_bk a,
ps_bus_unit_tbl_hr d,
ps_pay_calendar e,
ps_pay_oth_earns f,
ps_pay_check g,
ps_earnings_tbl h,
ps_jobcode_tbl c,
ps_job j,
ps_emplmt_srch_qry j1,
ps_dept_tbl b,
ps_ah89_ldr_mappng i
WHERE j.jobcode = a.jobcode
AND j.business_unit = d.business_unit
AND j.setid_dept = d.business_unit
AND j.jobcode = c.jobcode
AND j.emplid = a.emplid
AND j.emplid = j1.emplid
AND j.empl_rcd = j1.empl_rcd
AND j.effdt =
(SELECT MAX (j_ed.effdt)
FROM ps_job j_ed
WHERE j.emplid = j_ed.emplid
AND j.empl_rcd = j_ed.empl_rcd
AND j_ed.effdt <= a.pay_end_dt)
AND j.effseq =
(SELECT MAX (j_es.effseq)
FROM ps_job j_es
WHERE j.emplid = j_es.emplid
AND j.empl_rcd = j_es.empl_rcd
AND j.effdt = j_es.effdt)
AND j.setid_jobcode = c.setid
AND j1.oprid = 'RECPRCSS'
AND a.company = f.company
AND a.paygroup = f.paygroup
AND a.pay_end_dt = f.pay_end_dt
AND a.off_cycle = f.off_cycle
AND a.page_num = f.page_num
AND a.line_num = f.line_num
AND a.addl_nbr = f.addl_nbr
AND a.company = g.company
AND a.paygroup = g.paygroup
AND a.pay_end_dt = g.pay_end_dt
AND a.off_cycle = g.off_cycle
AND a.page_num = g.page_num
AND a.line_num = g.line_num
AND a.sepchk = g.sepchk
AND a.business_unit = b.setid
AND a.company = e.company
AND a.paygroup = e.paygroup
AND a.pay_end_dt = e.pay_end_dt
AND h.erncd = f.erncd
AND h.erncd = i.erncd
AND b.deptid = a.deptid
AND h.effdt = (SELECT MAX (h_ed.effdt)
FROM ps_earnings_tbl h_ed
WHERE h.erncd = h_ed.erncd AND h_ed.effdt <= a.pay_end_dt)
AND c.effdt =
(SELECT MAX (c_ed.effdt)
FROM ps_jobcode_tbl c_ed
WHERE c.setid = c_ed.setid
AND c.jobcode = c_ed.jobcode
AND c_ed.effdt <= SYSDATE)
AND b.effdt =
(SELECT MAX (b_ed.effdt)
FROM ps_dept_tbl b_ed
WHERE b.setid = b_ed.setid
AND b.deptid = b_ed.deptid
AND b_ed.effdt <= SYSDATE)
AND EXISTS (SELECT i.rowsecclass
FROM ps_scrty_tbl_dept i
WHERE i.rowsecclass = 'DPALL' AND i.setid = a.business_unit);
Similar Messages
-
Create materialized view, ORA-00942
I would like to create a materialized view on user scott@orcl for user colinsuper. User scott@orcl have
"CREATE ANY MATERIALIZED VIEW" permissions. Why does I get an ORA-00942 error?
Remote-Database: remote_orcl.world
Remote-Database-User: lindasuper
Remote-Database-Table: cars
scott@orcl>create synonym cars for lindasuper.cars@remote_orcl.world
2 /
Synonym created.
scott@orcl>select car_no cno, car_bez cbez from cars
2 where rownum <= 1;
cno cbez
3 32-mxl
scott@orcl
scott@orcl
scott@orcl>CREATE MATERIALIZED VIEW colinsuper.CARS_MV
2 TABLESPACE my_tablespace
3 BUILD IMMEDIATE
4 USING INDEX TABLESPACE my_idx
5 REFRESH
6 START WITH sysdate
7 NEXT ROUND(SYSDATE)+5/24
8 WITH PRIMARY KEY
9 ENABLE QUERY REWRITE
10 AS
11 SELECT car_no cno
12 car_bez cbez
13 FROM cars
14 /
CREATE MATERIALIZED VIEW colinsuper.CARS_MV
FEHLER in Zeile 1:
ORA-00942: Tabelle or View does not exist
scott@orcl>
scott@orcl>
scott@orcl>When I am creating the materialized view without the user colinsuper, materialized view
is creating without problems.
scott@orcl>CREATE MATERIALIZED VIEW CARS_MV
2 TABLESPACE my_tablespace
3 BUILD IMMEDIATE
4 USING INDEX TABLESPACE my_idx
5 REFRESH
6 START WITH sysdate
7 NEXT ROUND(SYSDATE)+5/24
8 WITH PRIMARY KEY
9 ENABLE QUERY REWRITE
10 AS
11 SELECT car_no cno
12 car_bez cbez
13 FROM cars
14 /
Materialized View wurde erstellt.
scott@orcl>
scott@orcl>I think there is somthing wrong with the permissions of colinsuper!?Is this colinsuper a user in the remote database.
ORA-00942: table or view does not exist
Cause:
The table or view entered does not exist, a synonym that is not allowed here was used, or a view was referenced where a table is required. Existing user tables and views can be listed by querying the data dictionary. Certain privileges may be required to access the table. If an application returned this message, the table the application tried to access does not exist in the database, or the application does not have access to it.
Action:
Check each of the following:
the spelling of the table or view name.
that a view is not specified where a table is required.
that an existing table or view name exists.
Contact the database administrator if the table needs to be created or if user or application privileges are required to access the table.
Also, if attempting to access a table or view in another schema, make certain the correct schema is referenced and that access to the object is granted. -
Create Materialized View ORA-01723: zero-length columns are not allowed
I am trying to create a materialized view which derives a column from a function and I get: ORA-01723: zero-length columns are not allowed.
I am using 10gR2 with the following definition (simple version):
CREATE MATERIALIZED VIEW AS
SELECT
function_name(column_name) COLUMN_ALIAS
FROM table_name;
I have even tried to cast it like below:
CREATE MATERIALIZED VIEW AS
SELECT
CAST(function_name(column_name) AS VARCHAR2(200)) COLUMN_ALIAS
FROM table_name;
My function does have an exception to return a value even if no values are found.
I have looked all over for the solution. Does anyone have a way around this issue? I really need my function to derive the column as it has business rules which I cannot join into my materialized view definition. My only hope around this is to insert the values into a table and then create a materialized view from that table, I don't want to do that if someone has a solution around this.
Any help would be greatly appreciated.
Thank you,
Kyle
Edited by: Kyle Miller on Apr 19, 2011 8:28 AMHave you tried creating a table with the correct structure and then creating the materialized view based on the prebuilt table as described here...
http://www.oaktable.net/content/ultra-fast-mv-alteration-using-prebuilt-table-option
Cheers
Ben -
Create materialized view with ora-12054 error
Oracle 10g R2 on AIX 5.3L
I create a script (with help of EM) for a materilaized view
CREATE MATERIALIZED VIEW "BAANDB"."R2_MV"
TABLESPACE "USERS" NOLOGGING STORAGE ( INITIAL 128K) USING INDEX TABLESPACE "BAANIDX" STORAGE ( INITIAL 256K)
REFRESH FORCE ON COMMIT
ENABLE QUERY REWRITE AS
SELECT CM.ROWID c_rid, PC.ROWID p_rid, CM."T$CWOC", "T$EMNO", CM."T$NAMA", CM."T$EDTE", PC."T$PERI", PC."T$QUAN", PC."T$YEAR", PC."T$RGDT" From BAANDB.TTPPPC235201 PC RIGHT OUTER JOIN BAANDB.TTCCOM001201 CM Using (T$EMNO)
but I got error
ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view
acooding to the oerr
// *Cause: The materialized view did not satisfy conditions for refresh at
// commit time.
// *Action: Specify only valid options.
what dose it mean? both my master tables are not IOT and are locale ones. It seems that only changing to ON DEMAND works. If I use the "REFRESH FORCE START ..NEXT", it also failed.
I have created the materalized view logs with rowid on each master table. I think my script met every prequirement of ON COMMIT.
table owner has "on commit refresh" privilegeAfter googling on line, someone mentioned that for "ON COMMIT" on join tables, we have to use th old OUTER JOINT syntax (+) on WHERE. The new "outer joint" in FROM clause won't work.
I tested it, it seemed to be true. -
ORA-12052 when create materialized view
I following the sample in Oracle document to create materialized viewCREATE MATERIALIZED VIEW LOG ON sales
WITH ROWID, SEQUENCE(amount_sold, time_id, prod_id) INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW LOG ON times
WITH ROWID, SEQUENCE (time_id, calendar_year) INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW LOG ON products
WITH ROWID, SEQUENCE (prod_id,prod_name) INCLUDING NEW VALUES;
CREATE MATERIALIZED VIEW sales_mv
BUILD IMMEDIATE REFRESH FAST ON COMMIT
AS SELECT t.calendar_year, p.prod_id, p.prod_name,
SUM(s.amount_sold) AS sum_sales
FROM times t, products p, sales s
WHERE t.time_id = s.time_id AND p.prod_id = s.prod_id
GROUP BY t.calendar_year, p.prod_id, p.prod_name; This works. BUt I actually does not want do aggregation. Thus I changed the MV creation statement toCREATE MATERIALIZED VIEW sales_mv
BUILD IMMEDIATE REFRESH FAST ON COMMIT
AS SELECT t.calendar_year, p.prod_id, p.prod_name,s.amount_sold
FROM times t, products p, sales s
WHERE t.time_id = s.time_id AND p.prod_id = s.prod_id;I got errorSQL Error: ORA-12052: cannot fast refresh materialized view GLU.SALES_MV
*Cause: Either ROWIDs of certain tables were missing in the definition or
the inner table of an outer join did not have UNIQUE constraints on
join columns.
*Action: Specify the FORCE or COMPLETE option. If this error is got
during creation, the materialized view definition may have be
changed. Refer to the documentation on materialized views.Please help or point me to the relevant document.
Thanksdamorgan, Thank you for you reply.
the inner table of an outer join did not have UNIQUE constraints on join columns.
I am not sure how much clearer and explanation can be written.If you look at the query, you will find that there is no outer join in the query.
sales table does not have unique constraints on prod_id and time_id. If this is the cause of the problem, I cannot change the data but is there a work around. That is way I ask for specific doc. In 11g documents, I only find some info on CREATE MV. That is mainly on syntax but not on requirement. -
Create materialized view across dblink gets ORA-980?
Hi!
Oracle 9.2.0.5. Creating a materialized view on on a synonym that points to a table across a dblink. I am getting a ORA-980 error that synonym translation is no longer valid. However selecting against the same synonym returns the rows or the count, etc. What am I missing here?
This is the code that is being run:
create materialized view gxp_sc_item as select * from sc_item_db2;
Hints, tips, ideas, etc. gratefully accepted!
Dave VenusHi!
Thanks for the reply!
Yes that is a solution, however why does the synonym work for everything else? I can't find anything that says this should not work.
Yes running 9.2.0.8 would be my first choice. The application vendor does not certify anything higher than 9.2.0.5.
Thanks!
Dave Venus -
Error: ORA-00905:Missing keyword while creating Materialized view
Hi Gurus,
I am trying to create a materialized view as :
1 CREATE MATERIALIZED VIEW AMREG.ClientData
2 TABLESPACE AMREG_DATA
3 COMPRESS
4 PARALLEL
5 NOLOGGING
6 BUILD IMMEDIATE
7 REFRESH COMPLETE
8 ON DEMAND
9 DISABLE QUERY REWRITE
10 REFRESH START WITH TRUNC( SYSDATE + 1 ) + 3/24 NEXT TRUNC( SYSDATE + 1 ) + 3/24
11 AS
12 SELECT
13 CHILD.CLIENT_SGK "Child SGK",
14 CHILD.CLIENT_NAME "Child Name",
15 CHILD.ARC_ACCT_CD "Child ARC Acct Code",
16 ULTIMATE.CLIENT_SGK "Ultimate Parent SGK",
17 ULTIMATE.CLIENT_NAME "Ultimate Parent Name",
18 ULTIMATE.ARC_ACCT_CD "Ultimate ARC Acct Code",
19 HIER.LVL_FROM_ANCESTOR ,
20 FROM [email protected] CHILD,
21 [email protected] HIER,
22 [email protected] ULTIMATE
23 WHERE HIER.DESCENDANT_CLIENT_SGK = CHILD.CLIENT_SGK
24* AND ULTIMATE.CLIENT_SGK = HIER.ANCESTOR_CLIENT_SGK;
SQL> /
REFRESH START WITH TRUNC( SYSDATE + 1 ) + 3/24 NEXT TRUNC( SYSDATE + 1 ) + 3/24
ERROR at line 10:
ORA-00905: missing keyword
DBLink name is : DNYCPH60.WORLD
Please guide me on this and help to resolve the issue.I provided the answer over at the duplicate post ...
ORA-00905: missing keyword error while creating a materialised view
Please, please, please ... please do not duplicate posts. Pick one. If you don't get an answer in a reasonable time - close it (edit the title) and THEN open in a different forum. -
Create Materialized view Error ORA-22818
Hi,
I am creating a materialized view based on a complex query with inline queries, below is a simplified version of the query:
CREATE MATERIALIZED VIEW CM_FA_PEND_mvu
TABLESPACE CISTS_TH
BUILD IMMEDIATE
REFRESH COMPLETE
ENABLE QUERY REWRITE
AS
SELECT/*+ index (a,XT094S3) index (b,XT232S1) index (c, XM143P0) index (d, XM185S1)*/
a .fa_id,
a.fa_type_cd,
a.fa_status_flg,
a.disp_grp_cd,
(SELECT dl.descr
FROM ci_disp_grp_l dl
WHERE dl.disp_grp_cd = a.disp_grp_cd AND dl.language_cd = 'ENG')
disp_grp_cd_descr
FROM ci_fa a,
ci_sp_mtr_hist b,
ci_mtr_config c,
ci_reg d,
ci_fapr_faty e
WHERE a.fa_type_cd = e.fa_type_cd
AND a.sp_id = b.sp_id(+)
AND b.mtr_config_id = c.mtr_config_id(+)
AND c.mtr_id = d.mtr_id(+)
AND a.fa_status_flg = 'P'
AND e.fa_type_prof_cd = 'METERED'
AND ( (b.removal_dttm IS NULL))
I am getting error "ORA-22818: subquery expressions not allowed here". the problem is in columns "disp_grp_cd_descr" (when I remove this column from the query, the MView is created successfully)
Is using inline queries as columns a limitation on creating materialized view?
Is there a workaround ?
Thanks
AKNo version and no exception ... the full text is necessary the number alone insufficient ... to help you much other than recommend you read this:
http://download.oracle.com/docs/cd/E11882_01/server.112/e10810/basicmv.htm#DWHSG8195
where it says:
"The SELECT clause in the materialized view creation statement defines the data that the materialized view is to contain. Only a few restrictions limit what can be specified. Any number of tables can be joined together. Besides tables, other elements such as views, inline views (subqueries in the FROM clause of a SELECT statement), subqueries, and materialized views can all be joined or referenced in the SELECT clause. You cannot, however, define a materialized view with a subquery in the SELECT list of the defining query. You can, however, include subqueries elsewhere in the defining query, such as in the WHERE clause."
Something you could have found in a second or two in the docs at http://tahiti.oracle.com by searching for "Materialized Views Restrictions"
But without your version and the actual error message this may not apply. -
Create materialized view get ora-00998 error cause by subquery
hi all,
my create statement as follow,
create materialized view MV_DM_DIM_DEALER01
Build deferred
Refresh complete
ON DEMAND
Enable query rewrite
as
select a.dealer_no,a.sk_period from DM_DIM_DEALER a
where A.SK_PERIOD=201210 and a.dealer_no in (select dealer_No from dm00_fav_dealer)
ORA-00998: must name this expression with a column alias
so what's the problem?
thx all>
my create statement as follow,
create materialized view MV_DM_DIM_DEALER01
Build deferred
Refresh complete
ON DEMAND
Enable query rewrite
as
select a.dealer_no,a.sk_period from DM_DIM_DEALER a
where A.SK_PERIOD=201210 and a.dealer_no in (select dealer_No from dm00_fav_dealer)
ORA-00998: must name this expression with a column alias
so what's the problem?
>
Well since the error is 'ORA-00998: must name this expression with a column alias' you might try naming your expressions with aliases
select a.dealer_no dealer_no,a.sk_period sk_period from DM_DIM_DEALER a -
ORA-04052 creating Materialized View
ORA-04052 creating Materialized View
Hi All !!
I'm trying to create a Materialized view and his query definition uses an active public database link. When I ran the script for creating the view I get the following message:
ERROR in line 1:
ORA-04052: error occurred when looking up remote object
USER.TABLE@ORCL2
ORA-00604: error occurred at recursive SQL level 1
ORA-03106: fatal two-task communication protocol error
ORA-02063: preceding line from ORCL2
But when I execute his definition query all is ok, the query works fine.
I mean, I'm using the following sentence to create the view:
CREATE MATERIALIZED VIEW my_view TABLESPACE tbsname BUILD IMMEDIATE
REFRESH FORCE
WITH ROWID
ENABLE QUERY REWRITE
AS
SELECT ...
FROM SCHEMA_NAME.TABLE_NAME@ORCL2;
The above sentence give me ORA-04052. Nevertheless the SELECT... FROM SCHEMA_NAME.TABLE_NAME@ORCL2; works fine...
I checked for the GLOBAL_NAMES parameter and it is set to FALSE. Please help me, How can I fix this problem ?
I'm using Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production running over Win XP for create the view.
The Database Link points to Oracle Database 10g Release 10.1.0.4.0 - 64bit Production running over Solaris
Thanks in advance !!I've checked the NLS_LANG settings in both servers, and are set to AMERICAN. NLS TERRITORY are set to America also.
-
ORA-25175 when trying to create materialized view, organization index SOLV
Hi,
I'm trying to create a materialized view to compensate for non-normalized table.
I have table anormal, and mv is to be on distinct agency, company in that table.
Here goes:
SQL> select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for IBM/AIX RISC System/6000: Version 10.2.0.3.0 - Productio
NLSRTL Version 10.2.0.3.0 - Production
SQL> create table anormal (company varchar2(8) not null
2 ,dept varchar2(8) not null
3 ,agency varchar2(8) not null
4 ,constraint anormal_pk primary key (company,dept));
Table created.
SQL> insert into anormal values('c1', 1, 'Ajax');
1 row created.
SQL> insert into anormal values('c1', 2, 'Ajax');
1 row created.
SQL> insert into anormal values('c1', 3, 'Acme');
1 row created.
SQL> insert into anormal values('c2', 1, 'Acme');
1 row created.
SQL> insert into anormal values('c2', 2, 'Acme');
1 row created.
SQL> commit;
Commit complete.
SQL> select * from anormal;
COMPANY DEPT AGENCY
c1 1 Ajax
c1 2 Ajax
c1 3 Acme
c2 1 Acme
c2 2 Acme
SQL> create materialized view agency_comp_mv
2 organization index --primary key (agency, company)
3 build deferred
4 refresh on demand
5 as
6 select distinct agency, company from anormal
7 /
select distinct agency, company from anormal
ERROR at line 6:
ORA-25175: no PRIMARY KEY constraint found
SQL>The error tells me that there is no primary key, but is there any way to add such?
- or is my problem rather that I cannot use DISTINCT with organization index?
Regards
Peter
bump
Message was edited by:
Peter Gjelstrup
<SOLVED>
Message was edited by:
Peter GjelstrupThanks William,
I tried with ON PREBUILT TABLE, just to see what happens.
Building on my OP:
SQL> create table iot(agency varchar2(8) not null, company varchar2(8) not null
2 ,constraint iot_pk primary key (agency,company))
3 organization index;
Table created.
SQL> insert into iot select distinct agency, company from anormal;
4 rows created.
SQL> commit;
Commit complete.
SQL> create materialized view iot on prebuilt table
2 as
3 select distinct agency, company from anormal;
Materialized view created.
SQL> select * from iot;
AGENCY COMPANY
Acme c1
Acme c2
Ajax c1
SQL> insert into anormal values('c3', 2, 'Foo');
insert into anormal values('c3', 2, 'Foo')
1 row created
SQL> select * from anormal;
COMPANY DEPT AGENCY
c1 1 Ajax
c1 2 Ajax
c1 3 Acme
c2 1 Acme
c2 2 Acme
c3 2 Foo
6 rows selected.
SQL> select * from iot;
AGENCY COMPANY
Acme c1
Acme c2
Ajax c1
3 rows selectedNow, try to refresh and MV
SQL> alter materialized view iot refresh complete;
Materialized view altered.
SQL> select object_type, to_char(last_ddl_time, 'hh:mi:ss'), status
2 from user_objects where object_name = 'IOT';
OBJECT_TYPE DDL_TIME STATUS
TABLE 10:40:42 VALID
MATERIALIZED VIEW 10:41:13 VALID
SQL> select * from iot;
AGENCY COMPANY
Acme c1
Acme c2
Ajax c1Agency "Foo" is not in MV,
Looks like that IOT select'ed from is indeed the MV:
SQL> drop table iot;
drop table iot
ERROR at line 1:
ORA-12083: must use DROP MATERIALIZED VIEW to drop "STIK"."IOT"
SQL>So, seems that Maxim is right, it just can't be done. And it seems my options are:
Create HEAP organized MV or
Create and maintain IOT
Regards
Peter -
Error while creating materialized view which using database link
Helo!
I'm getting error "ORA-00942: table or view does not exist" when I want to create materialized view.
Details:
1. On destination database I create a database link:
CREATE DATABASE LINK SDATABASE
CONNECT TO MYUSER
IDENTIFIED BY MYUSERPASS
USING 'ORCL';
=> Command "SELECT * FROM TABLE1@SDATABASE" returns data normally!
2. On source database I create MATERIALIZED VIEW LOG:
CREATE MATERIALIZED VIEW LOG
ON TABLE1
WITH PRIMARY KEY
INCLUDING NEW VALUES;
3. Now, when I want to create MATERIALIZED VIEW on destination database:
CREATE MATERIALIZED VIEW TABLE1
REFRESH FAST
START WITH SYSDATE
NEXT SYSDATE + 1/1440
WITH PRIMARY KEY
AS SELECT * FROM TABLE1@SDATABASE;
...I get error "ORA-00942: table or view does not exist"!
How is that possible if command "SELECT * FROM TABLE1@SDATABASE" returns data normally?
Thanks,
VorancAnd, I'm using Oracle 10g.
Voranc -
How to CREATE MATERIALIZED VIEW LOG (MV fast refresh) with some JOINS
Hi @ all,
i'm trying to create a MATERIALIZED VIEW LOG for a fast refresh of a MATERIALIZED VIEW.
It works fine with a simple Request in the MATERIALIZED VIEW:
CREATE MATERIALIZED VIEW MV_ZOTD43_P
TABLESPACE GDII
BUILD IMMEDIATE
REFRESH FORCE AS
SELECT * FROM ZOTD43_P;
COMMIT;
CREATE MATERIALIZED VIEW LOG ON ZOTD43_P
TABLESPACE "GDII"
WITH PRIMARY KEY, ROWID, SEQUENCE INCLUDING NEW VALUES;
call DBMS_MVIEW.REFRESH('MV_ZOTD43_P', 'f');
But when I use a complex SQL-Request with some JOINS (one of the Table with spatial Data) in the MATERIALIZED VIEW, I get an error:
CREATE MATERIALIZED VIEW MV_TEST
TABLESPACE GDII
BUILD IMMEDIATE
REFRESH FORCE AS
SELECT lptd04_p.sst_nr AS sst_nr,
lptd03_p.aaaa AS aaaa,
lptd04_geom.geom as geom
FROM lptd04_p lptd04_p
JOIN lptd01_p lptd01_p ON lptd01_p.cre_nr = lptd04_p.sst_nr
JOIN lptd04_geom ON lptd04_geom.sst_nr = lptd04_p.sst_nr
JOIN lptd03_p lptd03_p ON lptd03_p.lief_nr = lptd04_p.lief_nr;
COMMIT;
CREATE MATERIALIZED VIEW LOG ON LPTD04_P
TABLESPACE "GDII"
WITH PRIMARY KEY, ROWID, SEQUENCE INCLUDING NEW VALUES;
call DBMS_MVIEW.REFRESH('MV_TEST', 'f');
Error report:
SQL Error: ORA-12004: REFRESH FAST kann für Materialized View "GDI"."MV_GDI_SST_STAMM" nicht benutzt werden
ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 2255
ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 2461
ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 2430
ORA-06512: in Zeile 1
12004. 00000 - "REFRESH FAST cannot be used for materialized view \"%s\".\"%s\""
*Cause: The materialized view log does not exist or cannot be used. PCT
refresh is also not enabled on the materialized view
*Action: Use just REFRESH, which will reinstantiate the entire table.
If a materialized view log exists and the form of the materialized
view allows the use of a materialized view log or PCT refresh is
possible after a given set of changes, REFRESH FAST will
be available starting the next time the materialized view is
refreshed.
Am I doing something wrong or is it not possible CREATE MATERIALIZED VIEW LOG when the MATERIALIZED VIEW got some JOINS?
Regards,
GreqThanks for the link Alessandro ,
the error seems something to do with the Column-Type SDO_GEOMETRY, so
i create a new thread in the Spatial Discussion forum:
FAST REFRESHing of Oracle Materialized Views containing SDO_GEOMETRY column
Regards,
Greq -
Error While Creating Materialized View
Hello,
I am getting error ORA-22818: subquery expressions not allowed here while creating materialized view. I am using Oracle9i Enterprise Edition Release 9.2.0.1.0. Below pasted is my SQL Script.
Any help is highly appreciable.
Thanks
*********SQL************
select distinct(id),NAME,(select count(GRADE) from employees where
nationality like '%US%'and id=a.organization_id and grade=a.grade
group by ID,GRADE) US,(select count(GRADE) from employees where
nationality not like '%US%' and organization_id=a.organization_id and grade=a.grade
group by ORGANIZATION_ID,GRADE) NON_US,grade from employees a
where grade is not null
group by GRADE,ID,name
order by to_number(grade) descHi,
This is a documented restriction on MVs. You cannot have a scalar express (i.e a select statement) in the select list.
You can get round this by joining your select count(grade).. expression in as an inline view in your FROM clause. Or you can create a normal view without the scalar expression, create your MV as a select from this view, then re-define your view to contain the query you want.
Hope that helps,
Rod West -
Error occured while creating MATERIALIZED VIEW
I created as below:
CREATE MATERIALIZED VIEW LOG ON FIN.F_CV_HDR
WITH ROWID, SEQUENCE, PRIMARY KEY;
CREATE MATERIALIZED VIEW LOG ON FIN.F_CV_DTL
WITH ROWID, SEQUENCE;
REATE MATERIALIZED VIEW F_GL_SMRY_MVW
PARALLEL
BUILD IMMEDIATE
REFRESH FAST ON COMMIT AS
SELECT * FROM
SELECT
F_CV_HDR.ROWID "HDR_ID",
CAST(NULL AS ROWID) "DTL_ID",
cah_dsm_trm_tr_code gsv_dsm_trm_tr_code,
cah_dsm_dcmnt_type gsv_dsm_dcmnt_type,
cah_cv_nmbr gsv_dcmnt_nmbr,
cah_lcm_lctn_code dsv_lcm_lctn_code,
cah_dsm_dcmnt_srs gsv_dsm_dcmnt_srs,
cah_cv_date gsv_dcmnt_date,
'G' gsv_sub_code_type,
DECODE(cah_dsm_dcmnt_type,'CPV',0,'CRV',cah_net_amnt) gsv_amnt_dbtd,
DECODE(cah_dsm_dcmnt_type,'CPV','C','CRV','D') gsv_dr_cr_indctr,
cah_net_amnt gsv_amnt,
DECODE(cah_dsm_dcmnt_type,'CPV',cah_net_amnt,'CRV',0) gsv_amnt_crdtd,
cah_asm_sbldgr_code gsv_sub_code,
CAH_RMRKS GSV_RMRKS,
CAST(NULL AS VARCHAR2(3)) GSV_CRS_RFRNCE_TYPE,
CAST(NULL AS VARCHAR2(3)) GSV_CRS_RFRNCE_TR_CODE,
CAST(NULL AS NUMBER(10)) GSV_CRS_RFRNCE_NMBR,
CAST(NULL AS VARCHAR2(6)) GSV_FCM_CRNCY_CODE,
CAST(NULL AS NUMBER(6,3)) GSV_EXCHNGE_RATE,
CAST(NULL AS NUMBER(13,2)) GSV_FRGN_CRNCY_AMNT,
CAST(NULL AS DATE) GSV_DATE_FROM,
CAST(NULL AS DATE) GSV_DATE_TO,
CAST(NULL AS NUMBER(7)) GSV_RJH_NMBR,
CAST(NULL AS VARCHAR2(3)) GSV_PJC_SRS,
CAST(NULL AS NUMBER(7)) GSV_PJC_NMBR,
CAST(NULL AS NUMBER(3)) GSV_PJC_EQPTMNT_SRL,
CAST(NULL AS VARCHAR2(5))GSV_PJC_EXPNSE_HEAD_CODE,
CAST(NULL AS VARCHAR2(3)) gsv_dpm_dprtmnt_code,
cah_asm_amm_main_code gsv_amm_main_code,
CAH_LCM_LCTN_CODE_BOOK GSV_LCM_LCTN_CODE_BOOK,
CAST(NULL AS NUMBER) gsv_dr_cr_advce_srl,
0 gsv_dcmnt_srl_nmbr,
cah_trnsctn_with_indctr gsv_trnsctn_with_indctr,
cah_trnsctnr_code gsv_trnsctnr_code,
0 gsv_net_tds_amnt,
to_number(TO_CHAR(cah_cv_date ,'YYYY')) gsv_year,
to_number(TO_CHAR(cah_cv_date ,'MM')) gsv_mnth,
cah_cv_tmpry_nmbr gsv_tmpry_nmbr,
CAH_SRCE_INDCTR GSV_SRCE_INDCTR,
CAST(NULL AS VARCHAR2(50)) GSV_BILL_NMBR,
CAST(NULL AS DATE) gsv_bill_date,
cah_pay_rcve_name gsv_pay_rcve_name
FROM f_cv_hdr
WHERE CAH_FNCL_CLSRE_INDCTR = 'N'
AND cah_avlble_indctr = 'Y'
UNION ALL
SELECT
F_CV_HDR.ROWID "HDR_ID",
f_cv_dtl.ROWID "DTL_ID",
cah_dsm_trm_tr_code gsv_dsm_trm_tr_code,
cah_dsm_dcmnt_type gsv_dsm_dcmnt_type,
cah_cv_nmbr gsv_dcmnt_nmbr,
cah_lcm_lctn_code dsv_lcm_lctn_code,
cah_dsm_dcmnt_srs gsv_dsm_dcmnt_srs,
cah_cv_date gsv_dcmnt_date,
cad_sub_code_type gsv_sub_code_type,
DECODE(cad_dr_cr_indctr, 'C',0,'D',cad_amnt) gsv_amnt_dbtd,
cad_dr_cr_indctr gsv_dr_cr_indctr,
cad_amnt gsv_amnt,
DECODE(cad_dr_cr_indctr, 'D',0,'C',cad_amnt) gsv_amnt_crdtd,
cad_sub_code gsv_sub_code,
cad_rmrks gsv_rmrks,
cad_crs_rfrnce_type gsv_crs_rfrnce_type,
cad_crs_rfrnce_tr_code gsv_crs_rfrnce_tr_code,
CAD_CRS_RFRNCE_NMBR GSV_CRS_RFRNCE_NMBR,
CAST(NULL AS VARCHAR2(6)) GSV_FCM_CRNCY_CODE,
CAST(NULL AS NUMBER(6,3)) GSV_EXCHNGE_RATE,
CAST(NULL AS NUMBER(13,2)) gsv_frgn_crncy_amnt,
cad_date_from gsv_date_from,
cad_date_to gsv_date_to,
cad_rjh_nmbr gsv_rjh_nmbr,
cad_pjc_srs gsv_pjc_srs,
cad_pjc_nmbr gsv_pjc_nmbr,
cad_pjc_eqpmnt_srl gsv_pjc_eqptmnt_srl,
cad_pjc_expnse_head_code gsv_pjc_expnse_head_code,
cad_dpm_dprtmnt_code gsv_dpm_dprtmnt_code,
cad_amm_main_code gsv_amm_main_code,
cah_lcm_lctn_code_book gsv_lcm_lctn_code_book,
cad_dr_cr_advce_srl gsv_dr_cr_advce_srl,
cad_cv_srl_nmbr gsv_dcmnt_srl_nmbr,
cah_trnsctn_with_indctr gsv_trnsctn_with_indctr,
cah_trnsctnr_code gsv_trnsctnr_code,
0 gsv_net_tds_amnt,
to_number(TO_CHAR(cah_cv_date ,'YYYY')) gsv_year,
to_number(TO_CHAR(cah_cv_date ,'MM')) gsv_mnth,
cah_cv_tmpry_nmbr gsv_tmpry_nmbr,
cah_srce_indctr gsv_srce_indctr,
CAST(NULL AS VARCHAR2(50)) GSV_BILL_NMBR,
CAST(NULL AS DATE) GSV_BILL_DATE,
cah_pay_rcve_name gsv_pay_rcve_name
FROM f_cv_hdr,
F_CV_DTL
WHERE CAH_FNCL_CLSRE_INDCTR = 'N'
AND cah_avlble_indctr = 'Y'
AND cah_lcm_lctn_code = cad_cah_lcm_lctn_code
AND CAH_DSM_DCMNT_TYPE = CAD_CAH_DSM_DCMNT_TYPE
AND cah_cv_tmpry_nmbr = cad_cah_cv_tmpry_nmbr);
Giving below error:
==================================================
ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view
12054. 00000 - "cannot set the ON COMMIT refresh attribute for the materialized view"
*Cause: The materialized view did not satisfy conditions for refresh at
commit time.
*Action: Specify only valid options.
==================================================*Action: Specify only valid options.
Maybe you are looking for
-
How to create dependent list for attributes that are there in same table?
HI, I need to ADF Creation Form that will insert into a Training table. and need to make a dependent LOV. Like i have a table Training (training_id, training_type, training_name ) i need to make a dependent list of value for Training_Type and Trainin
-
BBP_BD 002 Buffer table not up to date
Hi, We are hitting similar error . We are implementing Extended Classic Scenario. When i create shopping cart - it saves perfectly - status approved. However if i log in as SRM Administrator and check on Application Monitors - the shopping cart is sh
-
Modify request in productive system
Hi expert, Users want to modify requests in productive system. These request are been created in development and transported in production. And, in fact, I would like to retransport request modified in production to development. No problemes for auth
-
How to work with the Migration tool in SAP BPC from MS to NW
Hi, I am working in a Migration project from SAP BPC MS to NW. we are having a migration tool purchaged from SAP. I don't know how to work with,Could you please help me in this. Is there any way to do it by Manually? Thanks and Regards Krishna
-
2821 + AIM module ... OK for 42 branch to Head Office?
Hello. Our client currently has a 2821 router at HO, with 13 sites connected via VPN. They are upgrading their ADSL line at HO to 100Mbps (up from 50Mbps), and adding an extra 29 sites to connect to HO! Will their existing 2821 cope with the addition