Updateable View ORA-2014
Okay you helped me with the insert on a view with this note although you never completely answered all my questions:
http://technet.oracle.com:89/ubb/Forum2/HTML/005469.html
Now I need help with an update on a view. I have an instead of update trigger on the database that works fine in SQL but when I try to change something in JDeveloper I get the following errors:
JBO-26080: Error while selecting entity for MyTable
ORA-02014: cannot select FOR UPDATE from view with DISTINCT, GROUP BY, etc.
Any help would be appreciated.
Thanks,
Linda
JDBC won't be able to help you with this.
The issue is exactly what the error message says, so the thing you have to do is avoid the BC4J framework's attempt to lock a row for an entity based on this view.
The easy way to do this, is to override the lock() method on your entity class, with a method that does nothing:
void lock() { /* do nothing */ }
I'm assuming you've got INSTEAD OF triggers on this view to control what should happen when it's attempted to be updated as well.
Note that without being able to lock the row, you could experience "lost update" problems if two users simultaneously issue updates to the same row, but this is not something BC4J can prevent for you unless it can lock the row, as it tries to do by its default behavior.
Similar Messages
-
We have an updateable view that joins two tables in the databse. In the java client, we have an updateable result set that is used in a table model to display/edit the data. The only thing is when the data is edited, a "ORA-01446: cannot select ROWID from view with DISTINCT, GROUP BY, etc." is thrown. Is there any way around this, such as a way to tell the result set not to rely on ROWID?
Elango,
Thanks for the reply. In my case though the join is done inside the updateable view in the database. The query being run from JDBC does not contain a join, it only selects from the view. If I did the same thing using the generic JDBC-ODBC driver it would work, but since the Oracle JDBC driver relies so heavily on ROWID it does not work. Is there any way around this other than switching drivers? -
Primary key on view - ORA-20505
I'm getting this error when I try to update a form that is based on a view:
ORA-20505: Error in DML: p_rowid=69, p_alt_rowid=VENDOR_ITEM_ID, p_rowid2=, p_alt_rowid2=. ORA-01779: cannot modify a column which maps to a non key-preserved table
Error Unable to process row of table SH_PURCHASING_VW.
OK
Can you tell me how to add a pk to this view? I'd like to use VENDOR_ITEM_ID or a completely new column.
CREATE OR REPLACE FORCE VIEW "SH_PURCHASING_VW" ("ITEMNO", "VENDNO", "ITEM_DESC", "VEND_NAME", "PRIORITY", "VEND_ITEMNO", "VEND_ITEM_NOTES", "VENDOR_ITEM_ID", "VENDOR_ID", "VEND_NOTES", "ITEM_NOTES_ID", "ITEMNO_N", "ITEM_NOTES") AS
select "SH_VENDOR_ITEM"."ITEMNO" as "ITEMNO",
"SH_VENDOR_ITEM"."VENDNO" as "VENDNO",
"SH_VENDOR_ITEM"."ITEM_DESC" as "ITEM_DESC",
"SH_VENDOR_ITEM"."VEND_NAME" as "VEND_NAME",
"SH_VENDOR_ITEM"."PRIORITY" as "PRIORITY",
"SH_VENDOR_ITEM"."VEND_ITEMNO" as "VEND_ITEMNO",
"SH_VENDOR_ITEM"."VEND_ITEM_NOTES" as "VEND_ITEM_NOTES",
"SH_VENDOR_ITEM"."VENDOR_ITEM_ID" as "VENDOR_ITEM_ID",
"SH_VENDOR"."VENDOR_ID" as "VENDOR_ID",
"SH_VENDOR"."VEND_NOTES" as "VEND_NOTES",
"SH_ITEM_NOTES"."ITEM_NOTES_ID" as "ITEM_NOTES_ID",
"SH_ITEM_NOTES"."ITEMNO_N" as "ITEMNO_N",
"SH_ITEM_NOTES"."ITEM_NOTES" as "ITEM_NOTES"
from "SH_ITEM_NOTES" "SH_ITEM_NOTES",
"SH_VENDOR" "SH_VENDOR",
"SH_VENDOR_ITEM" "SH_VENDOR_ITEM"
where "SH_VENDOR_ITEM"."VENDNO"="SH_VENDOR"."VENDNO"
and "SH_VENDOR_ITEM"."ITEMNO"="SH_ITEM_NOTES"."ITEMNO_N"
ORDER BY VENDOR_ITEM_ID
Thanks in advance!Here are the updateable columns
SPICE_HUNTER1 SH_PURCHASING_VW ITEMNO NO NO NO
SPICE_HUNTER1 SH_PURCHASING_VW VENDNO NO NO NO
SPICE_HUNTER1 SH_PURCHASING_VW ITEM_DESC NO NO NO
SPICE_HUNTER1 SH_PURCHASING_VW VEND_NAME NO NO NO
SPICE_HUNTER1 SH_PURCHASING_VW PRIORITY NO NO NO
SPICE_HUNTER1 SH_PURCHASING_VW VEND_ITEMNO NO NO NO
SPICE_HUNTER1 SH_PURCHASING_VW VEND_ITEM_NOTES NO NO NO
SPICE_HUNTER1 SH_PURCHASING_VW VENDOR_ITEM_ID NO NO NO
SPICE_HUNTER1 SH_PURCHASING_VW VENDOR_ID NO NO NO
SPICE_HUNTER1 SH_PURCHASING_VW VEND_NOTES NO NO NO
VENDOR_ID and ITEM_ID are the pks for those tables. I'm guessing I need to add a VENDOR_ID and an ITEM_ID to the VENDOR_ITEM table, then write a couple of update statements to get those fields popluated with their respective data. I'm reading up on 'key-preserved' tables and it's making sense. You will probably laugh, but I AM the "DBA." I'm actually the report developer for our company and we're trying out APEX to see if we can use it to redo a bunch of old poorly-designed Access databases. I'm flying by the skin of my teeth, the seat of my pants, and a bunch of deep sighs. I went through the basic APEx training about a year ago, am designing tables as I go only through my knowledge of query/report writing and keep coming up against things in APEX that keep me saying, "Huhhhhhhh?"
Our purchasing department has an old poorly designed Access DB from which they can search vendors or items then see the results on one page. They need to be able to view the three areas of notes based on each search, i.e. they search by item then get this:
Item # and Description
Item Specific Notes Text Area
Vendor # and Name
Vendor Item Notes Text Area
Vendor Specific Notes Text Area
They search by Vendor they get this:
Vendor # and Name
Vendor Specific Notes Text Area
Item # and Description
Vendor Item NOtes Text Area
Item Speicfic Notes Text Area
Then, they need to be able to update those fields with any new information and that needs to update to their respective tables. I'm sure it's easy, and I'm sure it has to do with my LIMITED prowess of setting up my tables and learning that I can't have one form update more than one table (I learned that somewhere on this journey, hence the tries with the view) so I keep getting these ideas of how to do it, then running into snags.
So thanks for your help!
Alexandra -
Publication with updateable view
I create publication item for updateable view (using triggers) in my database
but when i trying to add it to publication (addPublicationItem) it failes with error
CONS-10033: Parent table DBO_SOGINSFORORA.FACEJURIDICAL not published for DBO_SOGINSFORORA.V_B2B_JURIDICALFACES viewI really need to add a publication items of the tables in the publication on which the view based on?
may have another way?So, i create database traces using thi two lines:
ALTER SESSION SET tracefile_identifier = 'MobileServer'
ALTER SESSION SET events '10046 trace name context forever, level 1'And i figured out what createPublicationItem trying to execute this statement:
CREATE OR REPLACE TRIGGER "TEST"."V_B2B_ADDRESS_TYPECTR"
AFTER INSERT OR UPDATE OR DELETE ON "TEST"."V_B2B_ADDRESS_TYPE"
FOR EACH ROW
DECLARE
v_SID NUMBER;
v_TMP CHAR(1);
v_CLID VARCHAR2(60);
BEGIN
v_SID := MOBILEADMIN.C$UPDATE_PACKAGE.SessionSeq;
v_CLID := MOBILEADMIN.CONS_EXT.GET_CURR_CLIENT;
BEGIN
SELECT DIRTY
INTO v_TMP
FROM "MOBILEADMIN".C$ALL_SID_LOGGED_TABLES
WHERE OWNER = 'TEST'
AND STORE = 'V_B2B_ADDRESS_TYPE'
AND SID = v_SID
FOR UPDATE;
IF NVL(v_TMP, 'N') <> 'Y' THEN
UPDATE "MOBILEADMIN".C$ALL_SID_LOGGED_TABLES
SET DIRTY = 'Y'
WHERE OWNER = 'TEST'
AND STORE = 'V_B2B_ADDRESS_TYPE'
AND SID = v_SID;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
INSERT INTO "MOBILEADMIN".C$ALL_SID_LOGGED_TABLES
(OWNER, STORE, DIRTY, SID)
VALUES
('TEST', 'V_B2B_ADDRESS_TYPE', 'Y', v_SID);
END;
IF INSERTING THEN
UPDATE "TEST"."CVR$V_B2B_ADDRESS_TYPE"
SET VERSION$$ = VERSION$$ + 1, DMLTYPE$$ = 'I', CLID$$OWN = v_CLID
WHERE "ADRESSTYPEID" = :new."ADRESSTYPEID"
AND DMLTYPE$$ = 'D';
END IF;
IF UPDATING THEN
IF NOT (:new."ADRESSTYPEID" = :old."ADRESSTYPEID") THEN
UPDATE "TEST"."CVR$V_B2B_ADDRESS_TYPE"
SET DMLTYPE$$ = 'D', CLID$$OWN = v_CLID
WHERE "ADRESSTYPEID" = :old."ADRESSTYPEID";
END IF;
UPDATE "TEST"."CVR$V_B2B_ADDRESS_TYPE"
SET VERSION$$ = VERSION$$ + 1, DMLTYPE$$ = 'I', CLID$$OWN = v_CLID
WHERE "ADRESSTYPEID" = :new."ADRESSTYPEID";
END IF;
IF SQL%NOTFOUND AND NOT DELETING THEN
INSERT INTO "TEST"."CVR$V_B2B_ADDRESS_TYPE"
("ADRESSTYPEID", VERSION$$, DMLTYPE$$, CLID$$OWN)
VALUES
(:new."ADRESSTYPEID", 1, 'I', v_CLID);
END IF;
IF DELETING THEN
UPDATE "TEST"."CVR$V_B2B_ADDRESS_TYPE"
SET VERSION$$ = VERSION$$ + 1, DMLTYPE$$ = 'D', CLID$$OWN = v_CLID
WHERE "ADRESSTYPEID" = :old."ADRESSTYPEID";
END IF;
END;As you can see it call CREATE TRIGGER AFTER INSERT
I thought that only INSTEAD OF TRIGGER can be created for view.
apparently this is a reason for error
CONS-10049: Consolidator Exception: ORA-25001: cannot create this trigger type on views -
Questions about updateable views
Greetings,
Some problems which I experienced with Delphi + Crlab ODAC + Oracle DB 10g Express and complex (joined tables) updateable views.
1. Required field (NOT NULL) in a joined table remains required in the view. My data access components read the meta information and throw error, when nothing (NULL) is put into that field. If something different than NULL is put though, the DB throws error because this is attempt to update multiple tables. That functionality may be disabled
in the data access components, resulting not that clean and easy to maintain exception
handling code.
2. CONSTRAINTS problem. It seems that any constraints on VIEW cannot be applied.
In the original table. I had UNIQUE field, and I placed UNIQUE DISABLED NOVALIDATE
in the view as constraint to that field in the view. It didn't prevent me to put several
rows with the same value in that field, which appeared in the original table.
It would be perfect if I could somehow manipulate the view meta information so my application can work with it as it was the original table (well, the original table with several read-only columns more). Is that possible in Oracle DB?Hi.
For this part
"..the DB throws error because this is attempt to update multiple tables"
You may want to write an Instead-of-trigger
Regards
Peter -
I want to create a not updateable view. I want to obtain a not editable JTable to show this view, as when
we difine a table model with redefined function isCellEditable() returning false.
Thanks
Albert Portugal.I found another method to do that. Steps:
1. create a view object (over the table view you will apply read only restrict) with read only checkbox checked.
2. Then click on bc4jmodule. Take out view object from exported views.
3. Click over the parent view object FKLink and change relation with the modifiable view for the new read only view. Add FK from destination attributes.
4. Click bc4jmodule properties and add new view object to export.
Finally when you display this data block it could not be modifiable.
The solution explained before is when you need modify this view. So if you are completly sure that some table will not be modified by application the easiest solution is checking read only flag in view object. (table).
Albert Portugal -
Hi,
I have two tables
CUSTOMERS
===========
Name Null Type
======================
CUST_UID NOT NULL NUMBER(4)
CUST_NAME VARCHAR2(50)
ITEM_PRICES
===========
Name Null Type
======================
IP_UID NOT NULL NUMBER(4)
IP_ITEM_DESC VARCHAR2(50
IP_COST_PRICE NUMBER(6,2)
IP_SELL_PRICE NUMBER(6,2)
I have a view IPS_VW which is the cartician product of CUSTOMERS and ITEM_PRICES, and an instead of trigger for UPDATE on this view which either inserts or updates data in the following third table
ITEM_PRICES_SPECIAL
===========
Name Null Type
======================
IPS_UID NOT NULL NUMBER(4)
CUST_UID NUMBER(4)
IP_UID NUMBER(4)
IPS_SELL_PRICE NUMBER(6,2)
The following is my view
SELECT 'A'||ROWNUM AS "IPSVW_UID",
0 AS "IPSVW_IPS_UID",
"CUSTOMERS"."CUST_UID" AS "IPSVW_CUST_UID",
"ITEM_PRICES"."IP_UID" AS "IPSVW_IP_UID",
"ITEM_PRICES"."IP_SELL_PRICE" AS "IPSVW_IPS_SELL_PRICE"
FROM "CUSTOMERS" "CUSTOMERS",
"ITEM_PRICES" "ITEM_PRICES"
WHERE NOT EXISTS
(SELECT 1
FROM "ITEM_PRICES_SPECIAL" "ITEM_PRICES_SPECIAL"
WHERE "ITEM_PRICES_SPECIAL"."IP_UID" ="ITEM_PRICES"."IP_UID"
AND "ITEM_PRICES_SPECIAL"."CUST_UID" ="CUSTOMERS"."CUST_UID"
UNION
SELECT 'B' ||ROWNUM AS "IPSVW_UID",
"ITEM_PRICES_SPECIAL"."IPS_UID" AS "IPSVW_IPS_UID",
"ITEM_PRICES_SPECIAL"."CUST_UID" AS "IPSVW_CUST_UID",
"ITEM_PRICES_SPECIAL"."IP_UID" AS "IPSVW_IP_UID",
"ITEM_PRICES_SPECIAL"."IPS_SELL_PRICE" AS "IPSVW_IPS_SELL_PRICE"
FROM "ITEM_PRICES_SPECIAL" "ITEM_PRICES_SPECIAL";
And this is the instead of trigger
CREATE OR REPLACE TRIGGER "TRG_IPSVW_UPDATE" INSTEAD OF
UPDATE ON IPS_VW REFERENCING NEW AS N FOR EACH ROW
BEGIN
IF :N.IPSVW_IPS_UID = 0 THEN
INSERT INTO ITEM_PRICES_SPECIAL
( CUST_UID, IP_UID,IPS_SELL_PRICE )
VALUES
( :N.IPSVW_CUST_UID,:N.IPSVW_IP_UID, :N.IPSVW_IPS_SELL_PRICE );
ELSE
UPDATE ITEM_PRICES_SPECIAL
SET IPS_SELL_PRICE = :N.IPSVW_IPS_SELL_PRICE
WHERE IPS_UID = :N.IPSVW_IPS_UID;
END IF;
END;
Everything works fine in SQLPLUS, if i update a rate in this view, a record is either inserted or updated in the third table.
But when i try to create a tabular form based on this view, i get the error
ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP BY, etc.
Could someone help me please?
Thanks,
AllenI think The tabular form needs to be able to identify some primary key and using a rownum concatenation cannot provide that.
Cheers
Kofi -
Trying to query data from a view - ORA-01882 and ORA-02063 Errors
Hey there,
I tried to query data from a view that was provided by a colleague. This view works fine and gives correct data using PL/SQL Developer or SQLPLUS, but in SQL Developer, I get the following error:
ORA-01882: Time zone region not found
ORA-02063: preceding line from SYSTOOLS
01882.00000 - "timezone region %s not found"
* Cause: Specified reason name was not found
* Action: Please contact Oracle Customer Support
Vendor Code 1882
Where comes this error message from?! SYSTOOLS is the database link.
Can't see an obvious reason for this error.
OS is Windows 2000 SP4, SQL Developer is v1.1.1.25 BUILD MAIN-25.14
Regards,
ThomasFrom Oracle Messages 'Cause and Action'
http://www.oracle.com/technology/products/designer/supporting_doc/des9i_90210/cmnhlp72/messages/ora_messages.htm
ORA-01882, 00000, "timezone region %s not found"
Cause: The specified region name was not found.
Action: Please contact Oracle Customer Support.
Maybe invalid region in NLS_LANG?
"select * from v$nls_parameters"
Starting this script in all developer program and compared result... -
Error while selecting from a view ORA-01031: Insufficient privileges
As DBA I have granted select privileges on a view to a user, but whenever I login as that user and try to select from the view I get the message 'ORA-01031'. When I run the query in the view as the user I do not have problem and can see the results. This view joins tables from more than one schema and does a distinct on the resultset. I am new to Oracle and would appreciate any help I can get.
ThanksBack on this problem when I created another user with select permission on the same view and a default role that has reference on all the objects on the other schemas, I end up with the same error message. Although this time the schema owner of the view has select privileges on all the tables from other schemas referenced in the view.
Thanks -
Materialized View, ORA-12008: error in materialized view refresh path
I want to refresh a materialized view, but I get an ORA-12008 error.
Does anybody have an idea? I do not find any errors in my refresh statement.
CREATE MATERIALIZED VIEW scott.dummy_mv
TABLESPACE test
BUILD IMMEDIATE
USING INDEX TABLESPACE idx_test
REFRESH
START WITH sysdate
NEXT ROUND(SYSDATE)+5/24
WITH PRIMARY KEY
ENABLE QUERY REWRITE
AS
SELECT KM.ID ID
,KM.USERNAME USERNAME
,KM.ABTID ABTID
FROM my_table KM
scott@orcl>desc dummy_mv
Name Null? Typ
ID NOT NULL NUMBER(4)
USERNAME NOT NULL VARCHAR2(30)
ABTID NOT NULL NUMBER(4)
scott@orcl>
BEGIN
SYS.DBMS_JOB.REMOVE(6579);
COMMIT;
END;
DECLARE
X NUMBER;
BEGIN
SYS.DBMS_JOB.SUBMIT
( job => X
,what => 'dbms_refresh.refresh(''"scott"."dummy_mv"'');'
,next_date => to_date('07.01.2009 05:00:00','dd/mm/yyyy hh24:mi:ss')
,interval => 'ROUND(SYSDATE)+5/24 '
,no_parse => FALSE
SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(x));
COMMIT;
END;
scott@orcl>exec dbms_refresh.refresh('dummy_mv');
BEGIN dbms_refresh.refresh('dummy_mv'); END;
FEHLER in Zeile 1:
ORA-12008: error in materialized view refresh path
ORA-00947: not enough values
ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 820
ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 877
ORA-06512: in "SYS.DBMS_IREFRESH", Zeile 683
ORA-06512: in "SYS.DBMS_REFRESH", Zeile 195
ORA-06512: in Zeile 1
scott@orcl>crupper wrote:
I get the same error:
scott@orcl>exec dbms_mview.refresh('dummy_mv','c');
BEGIN dbms_mview.refresh('dummy_mv','c'); END;
FEHLER in Zeile 1:
ORA-12008: error in materialized view refresh path
ORA-00947: not enough values
ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 820
ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 877
ORA-06512: in "SYS.DBMS_SNAPSHOT", Zeile 858
ORA-06512: in Zeile 1
I would first check the "query" information of the DBA_SNAPSHOTS/DBA_MVIEWS dictionary views if it reveals anything obvious.
But it looks more like an internal error while processing the refresh. You can get more information about the error by tracing the session. A "alter session set sql_trace = true;" before running the refresh should be sufficient. Disconnect afterwards and check the generated trace file for errors either using "tkprof" and checking the output or by manually searching for "err=" in the trace file.
Which 4-digit version of Oracle are you using?
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/ -
I am trying to create a view to hide a specific column if the row is a certain type. My view works really well for selecting but, because of the decode function in the select statement, I cannot update that "virtual" column.
As I am trying to fool a package I have limited options open to me. I really need one view that will allow updates to this column if the row isn't of the restricted type.
My view....
CREATE OR REPLACE FORCE VIEW SECURE.F0101
(ABAN8, ABALKY, ABTAX)
AS
select ABAN8 ,
ABALKY ,
decode (abat1, 'E ', ' ', ABTAX) ABTAX,
from testdta.f0101
If you have any suggestions, I would appreciate it.Create 'instead of' triggers on the view, as in this example:
SQL> create or replace view v_emp as
2 select empno, decode(ename,'SMITH','SMYTH', ename) ename from emp;
View created.
SQL> update v_emp
2 set ename='JACKSON'
3 where empno=7499;
set ename='JACKSON'
ERROR at line 2:
ORA-01733: virtual column not allowed here
SQL> create or replace trigger v_emp_update
2 instead of update on v_emp
3 begin
4 update emp
5 set ename = :new.ename
6 where empno = :new.empno;
7 end;
8 /
Trigger created.
SQL> update v_emp
2 set ename='JACKSON'
3 where empno=7499;
1 row updated.
SQL> commit;
Commit complete.
SQL> select * from v_emp
2 where empno=7499;
EMPNO ENAME
7499 JACKSON -
MATERIALIZED VIEW ORA-12006 and ORA-08103
We have an old 9.2.0.6 database which uses materialized views to access information from other systems via database links. One of these views though will no longer refresh, the others are OK including ones using the same database link and source system.
When we try to refresh get:
CREATE MATERIALIZED VIEW <user>.<materialized view>
REFRESH FORCE
AS SELECT *
FROM <source user>.<source table>@<database link>
AS SELECT *
ERROR at line 3:
ORA-12006: a materialized view with the same user.name already exists
drop MATERIALIZED VIEW <user>.<materialized view>
ERROR at line 1:
ORA-08103: object no longer exists
Obviously we can't rename the view and because of various restrictions I can't upgrade the database, we are in the process of migrating it to 11g.
Does anyone have a magic bullet to resolve this as I have been looking around and haven't found an answer as yet.Sorry you think the results are confusing but they are the results, obviously I have to protect exact names etc...
Materialized View system:
Shows other views for other source systems but not the ones for this source system.
It shows these ones as an object_type of TABLE in dba_objects even though they were created as materilized views.
Source system select:
OBJECT_NAME OBJECT_TYPE OWNER
<table name> TABLE <table owner>
<table name> SYNONYM PUBLIC
If I use a new name yes it does resolve the issue but I don't want to use a different name if possible as either the application guys have to change some code or I will have to build in another level of synonyms to translate the new name. At the end of the day if this is the only solution! -
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
AdamI'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); -
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
Maybe you are looking for
-
LG monitor won't let me shut down completely
I just got an LG monitor (L1932). When connected to my mac running 10.4.7, it won't shut down all the way. The mac appears to completely shut down, but then it immediately boots back up, almost as if I had chosen "Restart" instead of "Shut Down." It
-
My macbook pro recently crashed and was without a backup. Currently, I have a new hard drive and when I try to sync my Ipad, iTunes will keep trying to erase the playlists that I have on my Ipad. Is there a way to retrieve the songs, pictures and pla
-
Hi, This question is related to ADF table filters. Let us take an example of a View Object that is being dropped in a jspx page as a "ADF Table" with filters. Whenever user applies a filter on a column, will the data for view object be queried from d
-
Path file control indicating the installation file directory
Hello, I'm making a package on labview 6.1. Once this package is installed on a pc the software will use some txt files. On my code I specified the directory of these txt file but if the user want to change the install directory given by default, the
-
What kind of writing instruments are there? I am very interested in taking notes in Evernote and the rubber tipped instrument I have now is too blunt. Any suggestions?