Ora-01445 cannot select rowid from or sample a join view ?
Hi All
I get this error , while creating VO
"ora-01445 cannot select rowid from or sample a join view without a key-preserved table"
I created an EO, my table doesnt have primary key and it EO by deafualt created ROWID as primary key
When i create VO, using the following query by joining fnd_flex_values , then i see this ORA error
SELECT xxg2sourceacctneweo.elimination_sob_id, xxg2sourceacctneweo.ROWID
FROM xxg2_elim_source_accts xxg2sourceacctneweo, fnd_flex_values fvs WHERE fvs.flex_value = xxg2sourceacctneweo.source_acct_value
but I was able to get the results in TOAD, with out any issue.
as a part of testing , if i change the query to join to fnd_user , it works fine
SELECT XXG2SourceAcctNewEO.ELIMINATION_SOB_ID,
XXG2SourceAcctNewEO.ROWID FROM xxg2_elim_source_accts XXG2SourceAcctNewEO,fnd_user fc where fc.user_id=XXG2SourceAcctNewEO.created_by
Any suggestions?
Thanks
Ravi
Edited by: rashmrs on Oct 6, 2009 9:47 PM
Ravi,
Please mark some attributes as PRimary Key in your VO. Then the system would not automatically generate the ROWID. You can remove this View attribute using the VO wizard.
Regards
Sumit
Similar Messages
-
ORA-01445: cannot select ROWID from, or sample, a join view without a key-p
Hi All,
I am facing issue with one sql query. It is giving me error:
ORA-01445: cannot select ROWID from, or sample, a join view without a key-preserved table
I am not getting any clue to solve this. On internet, i didn't find proper reason for this error and troubleshooting way and solution for this error. Everywhere i saw one sentence, "Key preserved means the row from the base table will appear AT MOST ONCE in the output view on that table" but it didn't solve my problem.
I have 1099 columns in one select query. so avoiding the actual column list in select clause. Instead I am trying to select ROWIDs from all tables in join. My understanding is ROWID is a unique identifier in table not in database. But though I remove ROWIDs, I get same error. So please don't bother about these ROWIDs.
SELECT
TO_DATE(FACT.BUS_DATE_FKID,'YYYYMMDD')
,FACT.ROWID AS ABC1
,FACT_ADJ.ROWID AS ABC2
,DIM_SEC.ROWID AS ABC3
,DIM_SEC_ADJ.ROWID AS ABC4
,DIS_CAT.ROWID AS ABC5
,CTRY.ROWID AS ABC6
,BCP.ROWID AS ABC7
,STAGE.ROWID AS ABC8
FROM FACT_POSITION FACT
LEFT JOIN FACT_POSITION_ADJ FACT_ADJ ON FACT.POSITION_PKID = FACT_ADJ.POSITION_FKID
LEFT JOIN DIM_SOURCE_SYSTEM SOURCE ON FACT.SOURCE_SYSTEM_FKID = SOURCE.SOURCE_SYSTEM_PKID
LEFT JOIN DIM_SECURITY DIM_SEC ON FACT.SUBSYS_SECURITY_FKID = DIM_SEC.SECURITY_PKID
LEFT JOIN DIM_SECURITY_ADJ DIM_SEC_ADJ ON FACT.SUBSYS_SECURITY_FKID = DIM_SEC_ADJ.SECURITY_PKID
LEFT JOIN DIM_DISCLOSURE_CATEGORY DIS_CAT ON FACT.DISCLOSURE_CATEGORY_FKID = DIS_CAT.DISCLOSURE_CATEGORY_PKID
LEFT JOIN COUNTRY_REFERENCE CTRY ON CTRY.DESCRIPTION = DIM_SEC.ISSUER_COUNTRY
LEFT JOIN BUSINESS_CLOSE_PERIOD BCP
ON BCP.BUSINESS_CLOSE_DATE = ADD_MONTHS(TRUNC(TO_DATE(FACT.BUS_DATE_FKID,'YYYYMMDD'),'MM'), 1) -1
AND BCP.IS_LOCKED='Y' AND BCP.IS_ACTIVE='Y'
LEFT JOIN GUI_STAGING STAGE ON
FACT.POSITION_PKID=STAGE.POSITION_PKID
AND STAGE.IS_ACTIVE='Y'
AND STAGE.STATUS_ID IN(12,8,1,2,3,4,5)
WHERE FACT.POSITION_PKID=64524374;
While trying to sort this error, I found interesting things that made me more confused.
if I remove TO_DATE function from select clause, same join query works.
If I remove any table from join and keep TO_DATE function in select clause, query works.
That tells, there is no problem in query.
Then please anyone help me to sort out the error. FYI. I have googled a lot for this error. but didn't get solution/clue. That is why I am posting this problem to forum.
Thanks in advance. waiting for reply ASAP.
Pravin Pujari
[email protected]I think i got the solution. The syntax i was using (ANSI syntax) doesn't work in the oracle database version i am using.
When i updated my query with older oracle syntax, it worked.
SELECT
TO_DATE(FACT.BUS_DATE_FKID,'YYYYMMDD')
,FACT.ROWID AS ABC1
,FACT_ADJ.ROWID AS ABC2
,SOURCE.ROWID AS ABC3
,DIM_SEC.ROWID AS ABC4
,DIM_SEC_ADJ.ROWID AS ABC5
,DIS_CAT.ROWID AS ABC6
,CTRY.ROWID AS ABC7
,BCP.ROWID AS ABC8
,STAGE.ROWID AS ABC8
FROM [email protected] FACT
,[email protected] FACT_ADJ
,[email protected] SOURCE
,[email protected] DIM_SEC
, [email protected] DIM_SEC_ADJ
, [email protected] DIS_CAT
, GUI.COUNTRY_REFERENCE CTRY
, GUI.BUSINESS_CLOSE_PERIOD BCP
, GUI.GUI_STAGING STAGE
WHERE FACT.POSITION_PKID=64517140
AND FACT_ADJ.POSITION_FKID(+) = FACT.POSITION_PKID
AND SOURCE.SOURCE_SYSTEM_PKID=FACT.SOURCE_SYSTEM_FKID
AND DIM_SEC.SECURITY_PKID=FACT.SUBSYS_SECURITY_FKID
AND DIM_SEC_ADJ.SECURITY_PKID(+)=DIM_SEC.SECURITY_PKID
AND FACT.DISCLOSURE_CATEGORY_FKID = DIS_CAT.DISCLOSURE_CATEGORY_PKID
AND CTRY.DESCRIPTION = DIM_SEC.ISSUER_COUNTRY
AND BCP.BUSINESS_CLOSE_DATE = ADD_MONTHS(TRUNC(TO_DATE(FACT.BUS_DATE_FKID,'YYYYMMDD'),'MM'), 1) -1
AND BCP.IS_ACTIVE='Y'
AND FACT.POSITION_PKID=STAGE.POSITION_PKID
AND STAGE.IS_ACTIVE='Y'
AND STAGE.STATUS_ID IN(12,8,1,2,3,4,5); -
" ORA-01445: cannot select ROWID from, or sample, a join view without a key
GREETINGS !
CREATED TABULAR FORM WITH QUERY
WHILE EXECUTE ON SQL COMMANDS ITS EXECUTES AND SHOWS RECORDS, PASTE SAME QUERY ON TABULAR FORM SOURCE . WHEN RUN PAGE IT GIVES ERROR
" ORA-01445: cannot select ROWID from, or sample, a join view without a key-preserved table".
Edited by: Omzz on Oct 3, 2012 10:34 PMWhen setting the tabular form, only use the table that you are trying to update/modify.
After that is working, modify the SQL source with the other tables.
By just pasting an SQL query into the region source, it doesnt know what tables you are trying to update
PS - Please turn off "Caps Lock" :-) -
V4.0 - Tabular form ORA-01445: cannot select ROWID from, or sample,
Hi
I'm creating a tabular form in version 4.0.
The select is based on three tables all of which have primary keys, and the keys are selected, but every time I run the page I get the following error:-
failed to parse SQL query:
ORA-01445: cannot select ROWID from, or sample, a join view without a key-preserved table
The query runs just fine in TOAD
Any ideas?
Thanks
Mike
select
PRL.PERF_RATING_LINE_ID,
PRL.PERF_RATING_LINE_ID PERF_RATING_LINE_ID_DISPLAY,
PRL.BUSINESS_UNIT,
PRL.EMPLID,
''''||PRL.REVIEW_YEAR REVIEW_YEAR,
PRL.REVIEW_PERIOD,
PRL.PERFORMANCE_SCORE,
PRL.MODERATED_SCORE,
PRL.HRM,
PRL.COMMENTS,
PBR.BU_DESC,
''''||PBR.DEPTID DEPTID,
PBR.DEPT_DESC,
PBR.EMPLOYEE_NAME,
PBR.GRADE,
PRL.SCORE_APPROVED_BY,
PBR.TEMP_PERM,
PBR.GENDER,
PBR.JOB_START_DATE,
decode(DECODE(SUBSTR(PBR.FLAG,1,5),'Job s',substr(PBR.FLAG,instr(PBR.FLAG,'~',1)+2,3)),
'HIR','Hired','XFR','Transfer','REH','Rehire')||
decode(SUBSTR(PBR.FLAG,1,30),'Job starts during period ~ XFR',' - '||substr(PBR.FLAG,instr(PBR.FLAG,'~',1,2)+2)) JOB_START_DETAILS,
PBR.APPOINTMENT_DATE,
SUBSTR(PBR.JOB_END_DETAILS,INSTR(PBR.JOB_END_DETAILS,'~',1,2)+2) JOB_END_DATE,
SUBSTR(PBR.JOB_END_DETAILS,INSTR(PBR.JOB_END_DETAILS,'~',1,1)+2,INSTR(PBR.JOB_END_DETAILS,'~',1,2)-INSTR(PBR.JOB_END_DETAILS,'~',1,1)-2) REASON,
PBR.JOB_GROUP,
PBR.JOB_GROUP_DESC,
PBR.JOBCODE,
PBR.JOBCODE_DESC JOB_DESC,
PBR.JOB_FAMILY,
PBR.JOB_FAMILY_DESC,
PBR.PBR_ID,
MD.MGR_DEPT_ID
from PERFORMANCE_BASE_REFRESH_V PBR,
PERFORMANCE_RATING_LINE PRL,
Y00_OPR_MGR_DEPT MD
WHERE (PRL.BUSINESS_UNIT = PBR.BUSINESS_UNIT
AND PRL.EMPLID = PBR.EMPLID
AND PRL.REVIEW_YEAR = PBR.REVIEW_YEAR
AND PRL.REVIEW_PERIOD = PBR.REVIEW_PERIOD)
AND MD.OPRID = :APP_USER
AND INSTR(':'||MD.DEPTS_MANAGED||':',':'||PBR.DEPTID||':') > 0
AND MD.MGR_DEPT_ID > 0
AND PBR.ADMIN_CENTRE IN
(select c.deptid AC
from [email protected] A,
[email protected] C
where A.ROWSECCLASS = C.ROWSECCLASS
AND C.DEPTID != 'ZZZZ'
and a.oprid = :APP_USER)
AND (:P2210_BUSINESS_UNIT IS NULL
OR PBR.BUSINESS_UNIT = :P2210_BUSINESS_UNIT)
AND (:P2210_EMPLOYEE_NAME IS NULL
OR INSTR(UPPER(PBR.EMPLOYEE_NAME),UPPER(:P2210_EMPLOYEE_NAME)) > 0)
AND (:P2210_DEPARTMENT IS NULL
OR PBR.DEPTID = :P2210_DEPARTMENT)
AND (:P2210_PERFORMANCE_RATING IS NULL
OR PBR.PERFORMANCE_SCORE = :P2210_PERFORMANCE_RATING)
AND (:P2210_MODERATED_RATING IS NULL
OR PBR.MODERATED_SCORE = :P2210_MODERATED_RATING)
AND (:P2210_GRADE IS NULL
OR PBR.GRADE = :P2210_GRADE)
AND (:P2210_PERM_TEMP IS NULL
OR PBR.TEMP_PERM = :P2210_PERM_TEMP)
AND SUBSTR(NVL(PBR.JOB_END_DETAILS,'XXX'),1,3) NOT IN ('TER','TOC')
AND PRL.SCORE_APPROVED_BY IS NULLHi Marc,
Thanks again for the quick reply and all the support the dev team is providing to us.
Couple of question finally on this issue:
- fixing the "copy page"/"copy validation" bug, our workaround - by making a page copy - we've found to use the standard validation on tabular form based on complex views will go away, right?
- I made a sql trace when running the originally created tabular form page and I found the statement generated by the apex engine which gives the ORA-01446. Just wondering, would it be possible that apex is using the PK defined during the wizard instead of the rowid?
- If not, would it be a possible enhancement request in the future to let the developer name the ROWID column optionally, and then apex will use that column as rowid instead of the ROWID? This can give flexibility for us as developers, in this case complex views (with instead of triggers) can be standard way supported. What I mean exactly is to create the above view in the testcase as follows (most of these cases there is always a base table in the view, and the rest of the tables are used as lookups, so I can pick up the desired ROWID in the view with an alias):
CREATE OR REPLACE VIEW CUSTOMER_ORDERS_V AS
SELECT cus.customer_id,
cus.cust_last_name,
cust_first_name,
cus.cust_city,
COUNT (ord.order_id) order_count,
CUS.ROWID ROW_ID
FROM demo_customers cus, demo_orders ord
WHERE ord.customer_id(+) = cus.customer_id
GROUP BY cus.customer_id,
cus.cust_last_name,
cust_first_name,
cus.cust_city,
CUS.ROWID;and then at design time, I could pick up the ROW_ID column as rowid, so all the rest of the functionality could work as working now on simple views and tables.
What do you think on that?
best regards,
Peter -
Cannot select ROWID from, or sample, a join view without a key-preserve
I'm getting an error "cannot select ROWID from, or sample, a join view without a key-preserved table" when performing an INSERT. There is no error when performing an UPDATE.
I created a "Form with Reports" page, where the Reports is based on a view multi table join. The primary key I chose during the form creation process is "From Trigger". The primary key "ACCESS_ID" has been defined in the base table. On the view, I have created an INSTEAD OF TRIGGER, for both Insert and Update. The update seems to work. I am using the automatic row processing for the update and insert.
Additional information: My insert works standalone i.e. i write
insert into jxjplntr_access_v (col1, ...)
values (va1, val2...)
and it works when i run it on SQL window.
access_id has a constraint defined as not null and also PK.
I have an insert "instead of" trigger defined on the jxjplntr_access_v view.
However, when i "CREATE" a record after filling in the values, I get the above error. BTW, here is the view definition:
CREATE OR REPLACE VIEW jxjplntr_access_v (
access_id,
person_id,
person_name,
badge_number,
ntr_resp_type,
primary_flag,
start_date_active,
end_date_active,
created_by,
created_by_uname,
creation_date,
last_updated_by,
last_updated_by_uname,
last_update_date,
last_update_login )
AS
select
access_id,
ja.person_id,
initcap(p.last_name||', '||p.first_name) person_name,
p.employee_number badge_number,
ntr_resp_type,
primary_flag,
ja.start_date_active,
ja.end_date_active,
ja.created_by,
f1.user_name created_by_uname,
ja.creation_date,
ja.last_updated_by,
f2.user_name last_updated_by_uname,
ja.last_update_date,
ja.last_update_login
from jplntr.jplntr_access ja
,fnd_user f1
,fnd_user f2
,per_people_x p
where f1.user_id(+) = ja.created_by
and f2.user_id(+) = ja.last_updated_by
and p.person_id(+) = ja.person_id
Thanks in advance.
K
Edited by: kktong on Dec 12, 2011 5:39 PM
Edited by: kktong on Dec 13, 2011 10:06 AMI've just been looking at exactly the same problem. From my initial investigations, this seems to be a bug with Apex and creating a tabular form, as described in this thread here:
v4.0 - Tabular form ORA-01445: cannot select ROWID from, or sample,
Very frustrating!
I hope thats of use to you. If I find out anything else, I'll come back and let you know.
Simon
Edited by: Simon Holt on 26-Jul-2012 03:32 -
What causes "ORA-01445: cannot select ROWID from" error
While executing a SELECT query i got this error:
ORA-01445: cannot select ROWID from, or sample, a join view without a
key-preserved table
Below mentioned is the join condition part of the query. The line which the error has occured is italicized
from checkout_hdtl ch
inner join pmt_htl ph on ph.post_ln_a = ch.post_ln_code
inner join pin_dls pd on pd.post_ln_a = ph.post_ln_code
inner join carton_dtl cd on cd.carton_nbr = ch.carton_nbr
and cd.lseq_nbr = pd.lseq_nbr
inner join invoice_module im on cd.invevt_code = im.inv_code
inner join item_dock_master del on nm.invent_code = iwm.inv_code
left outer join inv_curr_comm_code mnb on ium.invent_code = im.inv_code
and icc.cntry = ph.shipto_cntry
left outer join vw_ver_master vw on vw.del_rec = ch.del_rec
left outer join cmd code_entry on code_pi.cntry =
cd.code_entry where ch.shpmt_nbr = '3'
What do i do?I would rather use Notepad than store my data in SQL server. It just so happens that our product is released for SQL Server as well. Hence i did the testing.
>Is there a limit to the number of joins that can be performed in Oracle?
Wrong question as it does not have anything to do with the number of views.. it has everything to do with the ability to correctly identify the unique row. Re-read the error message details posted by Blu - it explains the error.As you can see from my post, i created a table using the(CTAS) SELECT query from the View vw_ver_master's definition. So the view's result set is now stored in a table and now there are only tables involved in these JOINS.
The query will succeed if i comment out ANY one of these JOINS in this statement. This is so weird.
I -
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 -
Ora 01446 cannot select rowid from, or sample....
Hi All,
I get this error if I try to test my query. "ora 01446 cannot select ROWID from, or sample, a view with DISTINCT,GROUP BY,etc"..Can anyone tell me what does this error represent and how will i be able to resolve it.
FYI the jDeveloper version is 11.1.1.4.0Hi Timo,
I faced this error while creating a view object. Yes its working fine in SQL worksheet.
The query looks as below:
SELECT DISTINCT Wfcommentsentity.UPDATEDBY,A.UPDATEDBYDISPLAYNAME,Wfcommentsentity.COMMENTDATE,Wfcommentsentity.TASKID,Wfcommentsentity.ROWID FROM WFCOMMENTS Wfcommentsentity,
(SELECT DISTINCT UPDATEDBYDISPLAYNAME, UPDATEDBY,TASKID FROM WFTASKHISTORY WHERE TASKID = :Task_Id OR TASKGROUPID = :Task_Id)A
WHERE A.UPDATEDBY = Wfcommentsentity.UPDATEDBY
AND A.TASKID = Wfcommentsentity.TASKID order by Wfcommentsentity.ROWID -
ORA-01445 : cannot select rowid from a join view without a key preserved ta
Hi,
I am using Designer6i for generatin forms:
my blokc is based on a view...
when executing the module, I have the following error when trying to change a value of an item :
FRM 40501: unabe to reserve record for update or delete ,
the display error say :
ORA-01445 : cannot select rowid from a join view without a key preserved table!!!!!
Any help please ???you either create an INSTEAD OF trigger for that view or use on-lock trigger on that block to edit, e.g., SELECT ...INTO...FROM...WHERE...FOR UPDATE NOWAIT.
-
ORA-01445: cannot select ROWID from a join view without a key-preserved tab
Hi All,
I have 2 windows in a form. When i click on a button in first window, then 2nd window will be opened. (Note: both windows are based have master-details relationship with Table1 and Table2 respectively)
When i enter the information in 2nd window and click the SAVE Button it has to save those values to database. It used to work fine earlier. now, i am getting the following error.
FRM-40501: ORACLE error: unable to reserve record for update or delete.
ORA-01445: cannot select ROWID from a join view without a key-preserved table
Please help me, how can i resolve this error. Also, guide me what is a key-preserved table.
Thanks in advance,
AmarFirstly: - Please make sure that you have not opened the same record somewhere else in any other form and trying to update from there.
Secondly: - In your window 1 have you opened the same record which you are querying, editing and saving in window 2 ? If yes then this will givbe you error as you are trying to update a record which is already being updated somewhere else.
Please mark if it helps -
ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP
In my data model (load from a database) there is this data control and its accessor return.
When I drag the accessor return inside a jsf page I create a adf read only table (that has about 5000 rows), the I run the page and it works.
Since I want to display only 20 ( or 50 or 100 is the same) rows for each page I had changed the access mode from the default value "Scrollable" to "Range Paging" and then I ve selected range size 50.
Now if I run hte jsf page there are no data to display and if I press the small triangles to order the column or insert a word in the filter field I have the message ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP.
I dont know how to do to solve this problem.
StefanoAn other thing.
I solved this problem, maybe I dont understand the meaning of access mode and range size , since every value I choose of these 2 fields the visualization of the table doesnt change. -
Dears,
i have this problem after i create tabular from depend on view
ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP BY, etc.
this a query that i use
select
"INVOICE_DET",
"INVOICE_DET" INVOICE_DET_DISPLAY,
"INVOICE_ID",
"STORAGE_CODE",
"ITEM_QNTY",
"ITEM_PRICE",
"BONS_QNTY",
"DISC_VALUE",
"TOT_VAL",
"LOCATION_CODE",
"BATCH_DET",
"ITEM_CODE",
"ITEM_NAME",
"UOM_CODE",
"UOM_NAME",
"SIZE_CODE",
"SIZE_NAME",
"COLOR_CODE",
"COLOR_NAME",
"STOREG_BRCHAS_BATCHN",
"EXPR_DATE",
"PROD_DATE",
"ITEM_DET_ID"
from "#OWNER#"."BRCHAS_INVOICE_DET_VIEW"
this the view i created
CREATE OR REPLACE FORCE VIEW "RETAIL"."BRCHAS_INVOICE_DET_VIEW" ("INVOICE_DET", "INVOICE_ID", "STORAGE_CODE", "ITEM_QNTY", "ITEM_PRICE", "BONS_QNTY", "DISC_VALUE", "TOT_VAL", "LOCATION_CODE", "BATCH_DET", "ITEM_CODE", "ITEM_NAME", "UOM_CODE", "UOM_NAME", "SIZE_CODE", "SIZE_NAME", "COLOR_CODE", "COLOR_NAME", "STOREG_BRCHAS_BATCHN", "EXPR_DATE", "PROD_DATE", "ITEM_DET_ID") AS
SELECT invoice_det, invoice_id, storage_code, item_qnty, item_price,
bons_qnty, disc_value, tot_val, location_code, batch_det, item_code,
item_name, uom_code, uom_name, size_code, size_name, color_code,
color_name, storeg_brchas_batchn, expr_date, prod_date, item_det_id
FROM (SELECT d.invoice_det, d.invoice_id, d.storage_code, d.item_qnty,
d.item_price, d.bons_qnty, d.disc_value, d.tot_val,
d.location_code, d.batch_det, i.item_code,
get_item_name (i.item_code) item_name, i.uom_code,
get_uom_desc (i.uom_code) uom_name, i.size_code,
get_size_name (i.size_code) size_name, i.color_code,
get_color_name (i.color_code) color_name,
dd.storeg_brchas_batchn, b.expr_date, b.prod_date,
i.item_det_id
FROM brchas_invoice_det d,
brchas_batch dd,
brchas_batch_det b,
item_uom_size_color i
WHERE dd.storeg_brchas_batchinternn = b.storeg_brchas_batchinternn
AND d.batch_det = b.batch_det
AND b.item_det_id = i.item_det_id
AND d.batch_det IS NOT NULL
UNION ALL
SELECT d.invoice_det, d.invoice_id, d.storage_code, d.item_qnty,
d.item_price, d.bons_qnty, d.disc_value, d.tot_val,
d.location_code, d.batch_det, i.item_code,
get_item_name (i.item_code) item_name, i.uom_code,
get_uom_desc (i.uom_code) uom_name, i.size_code,
get_size_name (i.size_code) size_name, i.color_code,
get_color_name (i.color_code) color_name,
NULL storeg_brchas_batchn, NULL expr_date, NULL prod_date,
i.item_det_id
FROM brchas_invoice_det d, item_uom_size_color i
WHERE d.item_det_id = i.item_det_id
AND d.batch_det IS NULL) ;
CREATE OR REPLACE TRIGGER "RETAIL"."BRCHAS_INVOICE_DET_VIEW_TRG"
INSTEAD OF DELETE OR INSERT OR UPDATE
ON RETAIL.BRCHAS_INVOICE_DET_VIEW
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
DECLARE
V_PRICE NUMBER;
V_BONUS_QNTY NUMBER;
V_DISC_VAL NUMBER;
BEGIN
IF INSERTING THEN
INSERT INTO BRCHAS_INVOICE_DET
(INVOICE_DET,
INVOICE_ID ,
STORAGE_CODE,
ITEM_QNTY,
ITEM_PRICE,
BATCH_DET,
BONS_QNTY,
TOT_VAL,
LOCATION_CODE,
DISC_VALUE,
CREATED_USER,
CREATED_DATE,
ITEM_DET_ID
VALUES
("BRCHAS_INVOICE_DET_SEQ".nextval,
:NEW.INVOICE_ID ,
:NEW.STORAGE_CODE,
:NEW.ITEM_QNTY,
:NEW.ITEM_PRICE,
:NEW.BATCH_DET,
:NEW.BONS_QNTY,
(:NEW.ITEM_QNTY * NVL(:NEW.ITEM_PRICE,0)) - NVL(:NEW.DISC_VALUE,0),
:NEW.LOCATION_CODE,
:NEW.DISC_VALUE,
nvl(v('APP_USER'),user),
sysdate,
:NEW.ITEM_DET_ID);
ELSIF UPDATING THEN
UPDATE BRCHAS_INVOICE_DET
SET INVOICE_ID =:NEW.INVOICE_ID,
STORAGE_CODE =:NEW.STORAGE_CODE,
ITEM_QNTY =:NEW.ITEM_QNTY,
ITEM_PRICE = :NEW.ITEM_PRICE,
BATCH_DET =:NEW.BATCH_DET,
BONS_QNTY = :NEW.BONS_QNTY,
TOT_VAL =(:NEW.ITEM_QNTY * NVL(:NEW.ITEM_PRICE,0)) - NVL(:NEW.DISC_VALUE,0),
LOCATION_CODE =:NEW.LOCATION_CODE,
DISC_VALUE = :NEW.DISC_VALUE,
ITEM_DET_ID =:NEW.ITEM_DET_ID
WHERE INVOICE_DET =:NEW.INVOICE_DET;
ELSE
DELETE FROM BRCHAS_INVOICE_DET
WHERE INVOICE_DET =:OLD.INVOICE_DET;
END IF;
EXCEPTION
WHEN OTHERS THEN
-- Consider logging the error and then re-raise
RAISE;
END BRCHAS_INVOICE_DET_VIEW_TRG;
ALTER TRIGGER "RETAIL"."BRCHAS_INVOICE_DET_VIEW_TRG" ENABLE;
please i need help
Thanks
AhmedHi,
This might help
http://www.techonthenet.com/oracle/errors/ora01446.php
Regards,
Jari -
I got an error, googled it and couldn't find a good answer. Joe Fuda helped me to fix the problem. Here is the answer for future google results.
Error:
ORA-20001: get_dbms_sql_cursor error ORA-01445: cannot select ROWID from, or sample, a join view without a key-preserved table
Query that triggered the error:
SELECT
p.rowid
, p.product_id
, p.product_type
, p.product_name
, p.product_description
FROM
product p
, link_release_product rp
WHERE
rp.release_id = 1
AND
p.product_id = rp.product_id
This is casued by the keyword "rowid".
The same error occurs if 'p.rowid' is replaced with 'p."ROWID"'.
You can replicate this error in SQL Command by adding wrapping the query with 'select * from ( [the query] )'
Fix:
Add an alias to 'p.rowid' so the query is now like:
SELECT
p.rowid product_rowid
, p.product_id
, p.product_type
Reason:
Unclear, it might have something to do with how APEX does pagination.ok, found the answer... it has to do with the single row view issue addressed in this thread... ORA-01446 on Interactive query
(sorry if there's a better way to link to other threads in this forum). -
'ORA-01445: cannot select ROWID' Tabular Form v4
Hi Guys,
We have been having major problems since upgrading from v2 to v4.
One of the problem I have been having is with Tabular Forms.
I have quite a complex page with multiple regions which has always worked fine in version 2. One of those regions is a tabular form. When the page loads, I am getting the:
'ORA-01445: cannot select ROWID from, or sample, a join view without a key-preserved table' error.
The initial query was quite complex but I have broken it down:
This query works and allows me to update the base table (xxmel_apex_eco_alterations)
select
alt.ALTERATION_ID,
alt.ALTERATION_ID ALTERATION_ID_DISPLAY,
alt.ECO,
alt.ORGANIZATION_ID,
alt.ACD_TYPE,
alt.INVENTORY_ITEM_ID,
alt.BEFORE_CHANGE_QTY,
alt.AFTER_CHANGE_QTY,
alt.MODIFY_FLAG,
alt.REVISED_ASSEMBLY_ID,
alt.BILL_SEQUENCE_ID,
alt.COMPONENT_SEQUENCE_ID,
alt.LAST_UPDATE_DATE,
alt.LAST_UPDATE_BY,
alt.COMMENTS,
alt.BOM_IMPLEMENTATION_DATE,
alt.BOM_CHANGE_NOTICE,
alt.ASSEMBLY_NAME,
alt.COMPONENT_NAME,
alt.SELECTION_CRITERIA,
alt.ORACLE_CHANGE_NOTICE,
alt.COMP_CURRENT_COST,
alt.COMP_NEW_COST,
alt.COMP_CURRENT_SC,
alt.COMP_NEW_SC,
alt.COMP_DESCRIPTION,
alt.COMP_CURRENT_UOM,
alt.COMP_NEW_UOM,
alt.COMP_CURRENT_PUR_STATUS,
alt.COMP_NEW_PUR_STATUS
from XXMEL_APEX_ECO_ALTERATIONS alt
where eco = :P2_ECO
But as soon as I try to join it to another table (which I am not trying to update, just display as hown below), I am getting the error.
select
alt.ALTERATION_ID,
alt.ALTERATION_ID ALTERATION_ID_DISPLAY,
alt.ECO,
alt.ORGANIZATION_ID,
alt.ACD_TYPE,
alt.INVENTORY_ITEM_ID,
alt.BEFORE_CHANGE_QTY,
alt.AFTER_CHANGE_QTY,
alt.MODIFY_FLAG,
alt.REVISED_ASSEMBLY_ID,
alt.BILL_SEQUENCE_ID,
alt.COMPONENT_SEQUENCE_ID,
alt.LAST_UPDATE_DATE,
alt.LAST_UPDATE_BY,
alt.COMMENTS,
alt.BOM_IMPLEMENTATION_DATE,
alt.BOM_CHANGE_NOTICE,
alt.ASSEMBLY_NAME,
alt.COMPONENT_NAME,
alt.SELECTION_CRITERIA,
alt.ORACLE_CHANGE_NOTICE,
alt.COMP_CURRENT_COST,
alt.COMP_NEW_COST,
alt.COMP_CURRENT_SC,
alt.COMP_NEW_SC,
alt.COMP_DESCRIPTION,
alt.COMP_CURRENT_UOM,
alt.COMP_NEW_UOM,
alt.COMP_CURRENT_PUR_STATUS,
alt.COMP_NEW_PUR_STATUS
, msib.segment1
from XXMEL_APEX_ECO_ALTERATIONS alt
, mtl_system_items_b msib
where eco = :P2_ECO
and msib.organization_id = 26
and msib.inventory_item_id = alt.INVENTORY_ITEM_ID
I have read Re: v4.0 - Tabular form ORA-01445: cannot select ROWID from, or sample, where someone was having a similar issue to me but their solution (in copying the script to build a new page) is not really an option for us due to the complexity to of the page as a whole.
Is this a bug in APEX 4?
Any help would be great,
Thanks
ChrisThanks Jaydip,
That works great. Rather than joing hte Tabular From to multiple tables, I just created a function that returned the fields I required and included that in the select.
select
alt.ALTERATION_ID
,alt.ALTERATION_ID ALTERATION_ID_DISPLAY
,XXMEL_APEX_ECO_PKG.display_msib_records ('PART NAME',alt.inventory_item_id,26) "Part Number"
,XXMEL_APEX_ECO_PKG.display_msib_records ('PART DESC',alt.inventory_item_id,26) "Part Description"
,XXMEL_APEX_ECO_PKG.display_msib_records ('ITEM TYPE',alt.inventory_item_id,26) "Part Number Type"
,XXMEL_APEX_ECO_PKG.display_msib_records ('ITEM STATUS',alt.inventory_item_id,26) "Part Number Status"
,alt.BEFORE_CHANGE_QTY
,alt.AFTER_CHANGE_QTY
,alt.MODIFY_FLAG
,XXMEL_APEX_ECO_PKG.display_msib_records ('PART NAME',alt.REVISED_ASSEMBLY_ID,26) "Revised BOM"
,XXMEL_APEX_ECO_PKG.display_msib_records ('PART DESC',alt.REVISED_ASSEMBLY_ID,26) "Revised BOM Description"
,XXMEL_APEX_ECO_PKG.display_msib_records ('ITEM TYPE',alt.REVISED_ASSEMBLY_ID,26) "Revised BOM Type"
,XXMEL_APEX_ECO_PKG.display_msib_records ('ITEM STATUS',alt.REVISED_ASSEMBLY_ID,26) "Revised BOM Status"
,alt.LAST_UPDATE_DATE
,alt.LAST_UPDATE_BY
,alt.COMMENTS
,alt.BOM_CHANGE_NOTICE
,alt.SELECTION_CRITERIA
,alt.ORACLE_CHANGE_NOTICE
from XXMEL_APEX_ECO_ALTERATIONS alt
where eco = :P2_ECO
Thanks very much
Chris -
ORA-01445: cannot select ROWID - View OK on one database, not on another
Hi guys
I was wondering if someone might be able to shed some light on this.
I have taken an export of our apps development database, and imported it onto my own machine.
There are a number of views that will not compile on my database, but are compiled fine on the development box.
So I know the SQL is fine.
My version of the database is 11.2.0.1.0, and the one I exported it from is 11.1.0.7.0 so there is a slight difference there, so I guess that could be the issue.
So the message I get is :
ORA-01445: cannot select ROWID from, or sample, a join view without a key-preserved table
And an example piece of sql causing this follows. Can anyone suggest why these views would be fine on one machine, but not on an exported version of the same database on my machine ?
CREATE OR REPLACE VIEW OE_TRANSACTION_TYPES_V
(row_id, transaction_type_id, transaction_type_code, order_category_code, start_date_active, end_date_active, creation_date, created_by, last_update_date, last_updated_by, last_update_login, program_application_id, program_id, request_id, currency_code, conversion_type_code, cust_trx_type_id, cost_of_goods_sold_account, entry_credit_check_rule_id, shipping_credit_check_rule_id, price_list_id, enforce_line_prices_flag, min_margin_percent, warehouse_id, demand_class_code, shipment_priority_code, shipping_method_code, freight_terms_code, fob_point_code, ship_source_type_code, agreement_type_code, agreement_required_flag, po_required_flag, invoicing_rule_id, invoicing_credit_method_code, accounting_rule_id, accounting_credit_method_code, invoice_source_id, non_delivery_invoice_source_id, default_inbound_line_type_id, default_outbound_line_type_id, inspection_required_flag, depot_repair_code, auto_scheduling_flag, scheduling_level_code, default_fulfillment_set, default_line_set_code, context, attribute1, attribute2, attribute3, attribute4, attribute5, attribute6, attribute7, attribute8, attribute9, attribute10, attribute11, attribute12, attribute13, attribute14, attribute15, name, description, org_id, organization_name, tax_calculation_event_code, picking_credit_check_rule_id, packing_credit_check_rule_id, sales_document_type_code, sales_document_type, def_transaction_phase_code, quote_num_as_ord_num_flag, layout_template_id, contract_template_id)
AS
SELECT vl.ROWID ROW_ID, vl.TRANSACTION_TYPE_ID, vl.TRANSACTION_TYPE_CODE, vl.ORDER_CATEGORY_CODE, vl.START_DATE_ACTIVE, vl.END_DATE_ACTIVE, vl.CREATION_DATE, vl.CREATED_BY, vl.LAST_UPDATE_DATE, vl.LAST_UPDATED_BY, vl.LAST_UPDATE_LOGIN, vl.PROGRAM_APPLICATION_ID, vl.PROGRAM_ID, vl.REQUEST_ID, vl.CURRENCY_CODE, vl.CONVERSION_TYPE_CODE, vl.CUST_TRX_TYPE_ID, vl.COST_OF_GOODS_SOLD_ACCOUNT, vl.ENTRY_CREDIT_CHECK_RULE_ID, vl.SHIPPING_CREDIT_CHECK_RULE_ID, vl.PRICE_LIST_ID, vl.ENFORCE_LINE_PRICES_FLAG, vl.MIN_MARGIN_PERCENT, vl.WAREHOUSE_ID, vl.DEMAND_CLASS_CODE, vl.SHIPMENT_PRIORITY_CODE, vl.SHIPPING_METHOD_CODE, vl.FREIGHT_TERMS_CODE, vl.FOB_POINT_CODE, vl.SHIP_SOURCE_TYPE_CODE, vl.AGREEMENT_TYPE_CODE, vl.AGREEMENT_REQUIRED_FLAG, vl.PO_REQUIRED_FLAG, vl.INVOICING_RULE_ID, vl.INVOICING_CREDIT_METHOD_CODE, vl.ACCOUNTING_RULE_ID, vl.ACCOUNTING_CREDIT_METHOD_CODE, vl.INVOICE_SOURCE_ID, vl.NON_DELIVERY_INVOICE_SOURCE_ID, vl.DEFAULT_INBOUND_LINE_TYPE_ID, vl.DEFAULT_OUTBOUND_LINE_TYPE_ID, vl.INSPECTION_REQUIRED_FLAG, vl.DEPOT_REPAIR_CODE, vl.AUTO_SCHEDULING_FLAG, vl.SCHEDULING_LEVEL_CODE, vl.DEFAULT_FULFILLMENT_SET, vl.DEFAULT_LINE_SET_CODE, vl.CONTEXT, vl.ATTRIBUTE1, vl.ATTRIBUTE2, vl.ATTRIBUTE3, vl.ATTRIBUTE4, vl.ATTRIBUTE5, vl.ATTRIBUTE6, vl.ATTRIBUTE7, vl.ATTRIBUTE8, vl.ATTRIBUTE9, vl.ATTRIBUTE10, vl.ATTRIBUTE11, vl.ATTRIBUTE12, vl.ATTRIBUTE13, vl.ATTRIBUTE14, vl.ATTRIBUTE15, vl.NAME, vl.DESCRIPTION, vl.ORG_ID, hou.NAME, vl.TAX_CALCULATION_EVENT_CODE, vl.PICKING_CREDIT_CHECK_RULE_ID, vl.PACKING_CREDIT_CHECK_RULE_ID, vl.SALES_DOCUMENT_TYPE_CODE, oel.meaning SALES_DOCUMENT_TYPE, vl.def_transaction_phase_code, vl.quote_num_as_ord_num_flag, vl.layout_template_id, vl.contract_template_id
FROM OE_TRANSACTION_TYPES_VL vl, HR_ORGANIZATION_UNITS hou, oe_lookups oel
WHERE vl.org_id = hou.organization_id(+) and oel.lookup_code (+) = vl.sales_document_type_code and oel.lookup_type (+) = 'SALES_DOCUMENT_TYPE'
Thanks very muchmay want to check out
http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:548422757486
you probably need a unique constraint on one of your tables.
create table t1 as select 1 x from dual;
create table t2 as select 1 y from dual union /**/ all select 2 y from dual;
create or replace view T
as
select rowid row_id from
select t1.*, t2.* from t1, t2 where t1.x = t2.y
ORA-01445: cannot select ROWID from, or sample, a join view without a key-preserved tableif we add the constraint.
ALTER TABLE t2
add CONSTRAINT constraint_name UNIQUE (y);then
create or replace view T
as
select rowid row_id from
select t1.*, t2.* from t1, t2 where t1.x = t2.y
view created
Maybe you are looking for
-
Video songs do not have player suppport.!!
I do not find player support for video songs. Or kindly tell me how to go to next or previous video songs. Please reply ASAP Sumeet
-
Linksys WRT610 Firmware 2.00.00 B05 media server
Has anyone been able to get the twonky media server to work? i cannot seem to get it to work no matter what i do. ive tried to set it up through connecting to it on 192.168.1.1 i enabled the upnp server and set the folder and it just never shows up a
-
I have no volume at all on my la\ptop
no volume on my laptop This question was solved. View Solution.
-
Is it possible to change the font size in the sidebar? Thanks in advance
-
MDM DB Views - Can we create in SP08?
Hi All, MDM DB Views - Can we create in MDM 7.1 SP08? Please share the steps to be followed for this. Regards, ganga