Subquery over a subquery is not allowed?
I am trying to create subquery over another sheet which is a subquery itself, but it seems it is not allowed.
I have the original sheet S1(A,B,C) with the items A,B,C. I create a new sheet S2(A,B,C,D) and I add an item D with the condition that the value of D is equal to the value of the item B of the original, so I create the following condition with a subquery, S2.D=S1.B. Until here everything goes fine.
Then I want to create a new sheet S3(A,B,C,D) with the condition S3.D=S2.D. The problem is that the sheet S2 does not appear in the dialog where I should select the subquery sheet. Only the S1 appears.
Is there anything I can do about it?
Thank you in advance for any help.
Th.D.
Try creating the report in one go...
Instead of creating a subquery, and then a subquery using that subquery, and finally a "master" query, create the "master" query first, and within the conditions, create your subquery as you go along.
I'm not sure whether this would work, as I don't currently have access to Discoverer!
Alternatively, subqueries are rarely the most efficient way of processing information, so consider writing a PL/SQL function to do some of the work for you.
Similar Messages
-
Ftp and http access over XDB repository is not allowed...
When I try to execute the following command on a reasonably fresh Oracle 11 installation:
insert into "XMLTEST" ( "name", "xmlfof" ) values ( 'small', DBMS_XDB.GETCONTENTXMLTYPE('/public/small.xml') );
-- The schema is correctly registered, the file "small.xml" is in the /public repository folder, the user has every conceivable role and priviledge
-- http access works fine from a remote location, tried to execute the command on the server and from remote system...
I get the following error message:
ORA-31020: Der Vorgang ist nicht zulässig, Ursache: For security reasons, ftp and http access over XDB repository is not allowed on server side ORA-06512: in "XDB.DBMS_XDB", Zeile 1915
Searching for an answer on the forum didn't produce any concreate explanation... Does anyone have any idea how to solve this problem?As it turns out, the XML file contained a reference to a DTD at an external web-site, which caused the problem - it was identical to that described here:
Re: ORA-31020 when using XML with external DTD or entities
After removing the reference, everything works perfectly... -
I have a virus that has taken over Safari and will not allow me to browse of even shut down the computer. The request is to send $1,000 to a "green dot" address to get the virus removed.
Help!
lawrencefromchathamCommand, option and escape keys held down together will open the "Force Quit" dialog window.
Quit Safari and then relaunch it while holding down the shift key. -
My Air Ipad keeps switching to voice-over, and it will not allow me to enter my password. It keeps saying that I've entered the wrong password. It's asking for a password of zero value. When I enter my personal password that I created, it say it the wrong password, then it say try again in 5 minutes and shuts itself down. Is anyone else having this issue and how can I fix it?
Hello SharonLo
Your best bet would be to restore your iPad if it is not accepting your passcode. Check out the article below to walk you putting your iPad into recovery mode and using iTunes to restore it.
iOS: Forgotten passcode or device disabled after entering wrong passcode
http://support.apple.com/kb/ht1212
Disconnect the USB cable from the device, but leave the other end of the cable connected to your computer's USB port.
Turn off the device: Press and hold the Sleep/Wake button for a few seconds until the red slider appears, then slide the slider. Wait for the device to shut down.
While pressing and holding the Home button, reconnect the USB cable to the device. The device should turn on.
Continue holding the Home button until you see the Connect to iTunes screen.
iTunes will alert you that it has detected a device in recovery mode. Click OK, and then restore the device.
Regards,
-Norm G. -
MIME Upload: Operation is not allowed (M_APP_P) take #2
Hello folks,
with respect to the following thread: Operation is not allowed (M_APP_P)
System Info:
NW AS 7.03 ABAP Stack 731 Level 9, ECC 606 (EHP 6) with SAP_HR 604 Level 73 and EA_HR 607 (HR-Renewal 1) Level 24
Background:
One of our external colleagues is currently developing some Themes for certain WDA Applications. He recently applied and deployed them with means of the report WDG_MAINTAIN_UR_MIMES. A few weeks later I had to apply several Unified Rendering Notes because the upgrade to 731 Basis Stack 9 wrecked quite some functionalities concerning keyboard-accessibility. Whilst doing that, I ran into the Problem, that the archive ur_mimes_nw7.zip had been locked by the said colleague (apparently the lock was set implicitly by using the Download Option of the Report WDG_MAINTAIN_UR_MIMES which was used to save away the unmodified archive before uploading the modified one) and this also provoked the error message mentioned in the thread over here: Operation is not allowed (M_APP_P). After removing the lock from the archive I used the workaround approach Jean Clappier described in the said thread and I was able to implement the respective UR-Notes.
Problem/Question:
Today our external colleague wanted to recommence the implementation of the themes and now receives the same error message "Operation is not allowed (M_APP_P)" when trying to upload an archive via WDG_MAINTAIN_UR_MIMES.
Now, we could be using the workaround in the linked thread again, but none of us knows for 100% sure if there isn't something "extra special" the Report does which we would miss. So, this is one part of the actual question of this thread:
Is there any difference between uploading/overwriting ur_mimes_nw7.zip hard via SE80 and uploading it via WDG_MAINTAIN_UR_MIMES?
The other part is the understanding what's actually happening here. I attached a screenshot for the part of the coding where the error message ultimately originates from. My problem is understanding the very cryptic functional reason why the upload supposedly "isn't allowed", because what I see is, there's an attempt to save the archived File via Form routine phio_store_as_update in FM SDOK_PHIO_STORE_AS_UPDATE, so apparently an update of something that's already supposed to be there? However at some later point of the coding (screenshot) the PHIO appears to be initial and that's probably why the error occurs. Could be true, could be entire nonsense; either way I don't get it. Screen:
What I tried so far / Analysis:
Debugging into the delicious spaghetti-code
Any help/input is highly appreciated!
Cheers, LukasHello community,
as a co-worker of Lukas Weigelt I also examine that problem and found it’s reason. In the Report “WDG_MAINTAIN_UR_MIMES“ the LOIO of the uploaded data will be used to determine the corresponding PHIO. Therefore the Function Module “SKWF_LOIO_ALL_PHIOS_GET” is used. In the deep of it’s code it selects the PHIO from the table “SMIMPHIO” through the LOIO. But instead of only one PHIO to the LOIO the table offers three records with three different PHIO’s. In the further runtime of the report “WDG_MAINTAIN_UR_MIMES“ only the first found entry will be considered – and that’s the wrong PHIO which causes the error. This PHIO even has (as you can see in the attachment) the state '0000' which may means 'invalid' and indicates the error. By altering the PHIO to the right one, which is the one with the state '0002', the report works well.
Now the question is whether I can delete the two assumed 'invalid' PHIO-records in the table “SMIMPHIO” or not. Until then I’m able to use the report “WDG_MAINTAIN_UR_MIMES“ correctly by altering the PHIO to the right one in the debugger.
Regards, Marvin -
Receiving an ORA-31020: The operation is not allowed...
I'm trying to use a stylesheet that has several included stylesheets.
It looks something like this...
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:include href="http://fhamiwsdt01/AMIWeb/namespaces/AmerisureClient.xsl"/>
<xsl:include href="http://fhamiwsdt01/AMIWeb/namespaces/AmerisurePolicy.xsl"/>
<xsl:include href="http://fhamiwsdt01/AMIWeb/namespaces/AmerisureRetailAgent.xsl"/>
<xsl:include href="http://fhamiwsdt01/AMIWeb/namespaces/TransactionUtilities.xsl"/>
My procedure is to grab an xml an bump it up against the stylesheet as follows.
CREATE OR REPLACE FUNCTION transformPolicyXml RETURN CLOB IS
-- Define the local variables
xmldata XMLType;
xsldata XMLType;
newxml XMLType;
xml clob;
xsl clob;
error varchar2(200);
BEGIN
-- Get the XML document using the getXML() function defined in the database.
-- Since XMLType.transform() method takes XML data as XMLType instance,
-- use the XMLType.createXML method to convert the XML content received
-- as CLOB into an XMLType instance.
xml := getxml('Policy.xml');
xmldata := XMLType.createXML(xml);
-- Get the XSL Stylesheet using the getXSL() function defined in the database.
-- Since XMLType.transform() method takes an XSL stylesheet as XMLType instance,
-- use the XMLType.createXML method to convert the XSL content received as CLOB
-- into an XMLType instance.
xsl := getxml('Amerisure EAI XSLT.xsl');
xsldata := XMLType.createXML(xsl);
-- Use the XMLtype.transform() function to get the transformed XML instance.
-- This function applies the stylesheet to the XML document and returns a transformed
-- XML instance.
newxml := xmldata.transform(xsldata);
-- Return the transformed XML instance as a CLOB value.
RETURN newxml.getClobVal();
EXCEPTION WHEN OTHERS THEN
error := sqlerrm;
raise_application_error (-20102, 'Exception occurred in transformPolicyXml :'||SQLERRM);
END transformPolicyXml;
The following statement is what causes an error:
newxml := xmldata.transform(xsldata);
the error i'm receiving is ORA-31020: The operation is not allowed, Reason: For security reasons, ftp and http access over XDB repository is not allowed on server side.
Is there anyway to get around this error?As the error says, the XML DB does not allow ftp or http access to remote objects.
You will need to make all your includes local to the DB server. -
Subquery is not allowed within FILTER arguments
In a report I need to show two columns of same type but with values obtained with different criterias.
The criterias are difined in 2 different reports
Report
Month, ColumnA , ColumnB, Number_of_Nights
ColumnA refers to the actual column Member_id= criteria are defined with REPORT1 (where joined date between X and Y and market code=Z)
ColumnB refers to the actual column Member_id=criteria are defined with REPORT2 (where joined date between A and B and market code=C)
I can not use on ColumnA the normal filter and than filter based on results from another request, because it would apply to columnB as well.
I need therefore to use the filter from the "Edit Formula" screen and than filter on a column and select REPORT1 for ColumnA and REPORT2 for ColumnB.
This approach doesn't seem to work because I return :
[nQSError: 10058] A general error has occurred. [nQSError: 22033] Subquery is not allowed within FILTER arguments. (HY000)
How do you manage such reports?
Thanks!!
Edited by: user6185307 on 14.05.2012 06:00
Edited by: user6185307 on 14.05.2012 06:01
Edited by: user6185307 on 14.05.2012 06:02Try creating the report in one go...
Instead of creating a subquery, and then a subquery using that subquery, and finally a "master" query, create the "master" query first, and within the conditions, create your subquery as you go along.
I'm not sure whether this would work, as I don't currently have access to Discoverer!
Alternatively, subqueries are rarely the most efficient way of processing information, so consider writing a PL/SQL function to do some of the work for you. -
Subquery not allowed - PL/SQL Function Body returning bolean
Is subquery is not allowed in PL/SQL Expresion.????
I am using the following query in one of my derived report column but I am getting the error.
BEGIN
if :COL1<>'abc' and :COL2 in (select deptno from dept1) then
return 1;
elsif :COL1<>'abc' and :COL2 in (select deptno from dept2) then
return 0;
elsif :COL1<>'abc' and :COL2 in (select deptno from dept3) then
return 1;
else
return 0;
end if;
END;
secondly CAN I use return value such as 'ABC' or 'XYZ' other than 0,1.
Error-
Invalid function body condition: ORA-06550: line 4, column 8: PLS-00405: subquery not allowed in this context ORA-06550: line 2, column 3: PL/SQL: Statement ignored
-----------------Hi Deepak,
There are at least methods.
1 - You could create a SQL function that returned 0 or 1 and use that in your statement
2 - You could use a CASE clause in the SQL statement
As I don't have your dept1/2/3 tables, I've tried the following on the sample EMP/DEPT tables:
SELECT EMPNO,
ENAME,
SAL,
COMM,
DEPTNO,
CASE WHEN DEPTNO IN (SELECT DEPTNO FROM DEPT) THEN
CASE WHEN ENAME LIKE '%A%' THEN NVL(SAL,0) + NVL(COMM,0) ELSE 456 END
ELSE
CASE WHEN DEPTNO NOT IN (SELECT DEPTNO FROM DEPT) THEN
CASE WHEN ENAME LIKE '%A%' THEN NVL(SAL,0) + NVL(COMM,0) ELSE 123 END
ELSE
789
END
END "TOTAL"
FROM EMPThis returns the values I expect:
EMPNO ENAME SAL COMM DEPTNO TOTAL
7936 ATD 3000 - 40 3000
7958 dino4 - - - 789
7839 KINGS 5000 - 40 456
7698 BLAKES 2850 - 30 2850
7782 CLARK 2450 - 10 2450
7566 JONES 2975 - 30 456
7788 SCOTT 3000 - 20 456
7902 FORD 3000 - 40 456
7369 SMITH 800 - 20 456
7499 ALLEN 1600 300 30 1900Obviously, you may have to experiment with the various CASE statements, but it will work using just a sql select statement.
Andy -
Help regarding Materialized view ( subquery expression not allowed here )
Hi all,
while creating materialized view i got following error
ORA- 22818
subquery expression not allowed here
following is my query
CREATE MATERIALIZED VIEW MV_NAV_REC
BUILD IMMEDIATE
REFRESH COMPLETE ON DEMAND
as
select folio_no FOLIONO,CHKDIGIT as Check_Digit,sch_code SCHEMECODE, sysdate as FOLIODATE ,
(select case when count(distinct SUBBROKERCODE) =1 then to_char(max(SUBBROKERCODE)) else 'Multiple Broker' end from transaction_st
where folio_no = tst.folio_no
group by folio_no) ARN_Number ,
(select sum(case when tran_type in ('PURCHASE','SWITCH IN') then UNITS else 0 - UNITS end ) from transaction_st
where folio_no = tst.folio_no AND SCH_CODE = tst.sch_code
group by folio_no,sch_code) NUM_UNITS_NEW ,
--SUM (case when tran_type NOT in ('REDEMPTION','SWITCH OUT') THEN UNITS ELSE 0 - UNITS END ) AS Num_Units,
(select sum(case when tran_type in ('PURCHASE','SWITCH IN') then AMOUNT else 0 - AMOUNT end ) from transaction_st
where folio_no = tst.folio_no AND SCH_CODE = tst.sch_code
group by folio_no,SCH_CODE) as NUM_AMOUNT_NEW ,
--SUM (case when tran_type NOT in ('REDEMPTION','SWITCH OUT') THEN AMOUNT ELSE 0 -AMOUNT END ) AS Scheme_Amount,
sum( CASE WHEN upper(tran_type) NOT in ('REDEMPTION','SWITCH OUT') THEN
units * (select nav_rs from nav_rec where nav_rec.sch_code = tst.sch_code and nav_rec."Date" = /*trunc(sysdate)*/to_date('23/03/2009','dd/mm/yyyy'))
ELSE (0 - units) * (select nav_rs from nav_rec where nav_rec.sch_code = tst.sch_code and nav_rec."Date" = /*trunc(sysdate)*/to_date('23/03/2009','dd/mm/yyyy')) END ) Scheme_Valuation ,
null as SCHEMEPHRASEID ,
null as "Prefered Mode of SOA",
( select sum( case when upper(tran_type) NOT in ('REDEMPTION','SWITCH OUT') THEN AMOUNT ELSE 0 - AMOUNT END ) from transaction_st t where t.folio_no = tst.folio_no group by folio_no ) as Folio_Amount,
select sum(CASE when upper(tran_type) NOT in ('REDEMPTION','SWITCH OUT') THEN
units * ( select nav_rs from nav_rec where nav_rec.sch_code = ts.sch_code and nav_rec."Date" = /*trunc(sysdate)*/to_date('23/03/2009','dd/mm/yyyy'))
ELSE
(0 - units) * ( select nav_rs from nav_rec where nav_rec.sch_code = ts.sch_code and nav_rec."Date" = /*trunc(sysdate)*/to_date('23/03/2009','dd/mm/yyyy')) END
) from transaction_st ts where ts.folio_no =tst.folio_no group by ts.folio_no
) as Folio_Valuation
from transaction_st tst
group by folio_no ,sch_code,CHKDIGIT
order by folio_no , SCH_CODE
please help meHi,
You cannot use scalar subqueries in a materialized view.
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:4110947624538#22981269011674
edit
From 10g doc:
ORA-22818: subquery expressions not allowed here
Cause: An attempt was made to use a subquery expression where these are not supported.
Action: Rewrite the statement without the subquery expression.
(http://download.oracle.com/docs/cd/B19306_01/server.102/b14219/e19400.htm#sthref6020)
Edited by: hoek on Jun 10, 2009 7:56 AM -
ORA-22818: subquery expressions not allowed here
I am currently optimizing my report. Before, this report has only a single query for all. But when I have revised it having subquery it is performing much more faster. The problem is, I cannot perform a calculation on my query since subquery expressions are not allowed in 'group by'. Heres my sample report:
SELECT ab.batch_name,
ai.invoice_amount,
ai.invoice_date,
ai.invoice_num,
ai.invoice_id,
(SELECT pv.vendor_name
FROM apps.po_vendors pv
WHERE pv.vendor_id = ai.vendor_id)vendor_name,
aid.distribution_line_number,
SUM(aid.amount * (atc.tax_rate/100))amount,
(SELECT gcc.segment2
FROM apps.gl_code_combinations gcc
WHERE gcc.code_combination_id = aid.dist_code_combination_id)segment2,
(SELECT gcc.segment5
FROM apps.gl_code_combinations gcc
WHERE gcc.code_combination_id = aid.dist_code_combination_id)segment5
FROM apps.ap_batches_all ab,
apps.ap_invoices_all ai,
apps.ap_invoice_distributions_all aid,
apps.ap_awt_groups aag,
apps.ap_tax_codes_all atc
WHERE ab.batch_id = ai.batch_id
AND ai.invoice_id = aid.invoice_id
AND aag.group_id = aid.awt_group_id
GROUP BY ab.batch_name,
ai.invoice_amount,
ai.invoice_date,
ai.invoice_num,
ai.invoice_id,
(SELECT pv.vendor_name
FROM apps.po_vendors pv
WHERE pv.vendor_id = ai.vendor_id),
aid.distribution_line_number,
(SELECT gcc.segment2
FROM apps.gl_code_combinations gcc
WHERE gcc.code_combination_id = aid.dist_code_combination_id),
(SELECT gcc.segment5
FROM apps.gl_code_combinations gcc
WHERE gcc.code_combination_id = aid.dist_code_combination_id)
Can anyone advise on what to do? I really need the computation part but at the same time I would like to optimize my report using subqueries.You dont need to group by the actual inline SQL/sub-query but only the columns you used from the main query ( ie, aid.dist_code_combination_id, ai.vendor_id )
You also have to make sure that the in-line SQL you are using will return not more than 1 row.
Also, why not just use a normal join (or outer join if necessary)? -
Ora-02251: subquery not allowed here
Hi folks,
I have this situation.
SQL> ed
Wrote file afiedt.buf
1* create table x (id varchar2(10))
SQL> /
Table created.
SQL> ED
Wrote file afiedt.buf
1* create table y(name varchar2(10))
SQL> /
Table created.
SQL> insert into x values ('texas');
1 row created.
SQL> commit;
Commit complete.
SQL> alter table y add constraint rahul_check check(name in (select id from x));
alter table y add constraint rahul_check check(name in (select id from x))
ERROR at line 1:
ORA-02251: subquery not allowed hereI heard this can ONLY be implemented using a trigger, but, is there a way to do this using a 'check constraint'?
Thank you,
Rahul.Sorry, my original post was sort-of wrong.
What if I want to create something like this.
SQL> alter table y add constraint rahul_check check(name in (select id from x where <some_condition>)); -
ORA-22902 CURSOR expression not allowed Error Cause: CURSOR on a subquery..
Hi,
I found same issue in a metalink thread which is addressed in Oracle 12.1 which doesn't help me now. I need to rewrite the below query. Does anyone have any suggestions how to go about it?
thanks,
April
working in Oracle 11.2.0.3.1, windows server, doing an upgrade from 10g to 11g. Piece of code is failing with following error via TOAD
Oracle Database Error Code ORA-22902 Description :
CURSOR expression not allowed
Error Cause:
CURSOR on a subquery is allowed only in the top-level SELECT list of a query.
The below code is returning a tree of data for projects, units within the buildings.
Code as follows:
SELECT LEVEL
, p.project_id
|| NVL (p.file_ref, ' ')
|| '] ['
|| NVL (p.project_ref, ' ')
|| '] '
|| p.project_name
|| ' ( '
|| (SELECT COUNT (*)
FROM PROJECT p1
WHERE p1.parent_project_id = p.project_id)
|| ' sub-projects, '
|| (SELECT COUNT (*)
FROM PROJECT_ELEMENT pe2
WHERE pe2.project_id = p.project_id)
|| ' elements)' AS project_description
CURSOR
(SELECT pe.element_id
|| pe.element_ref
|| '] '
|| pe.element_name
|| ' ('
|| pe.unit_count
|| ')' AS element_description
CURSOR
(SELECT hu.hu_id
|| hu.hu_ref
|| '] '
|| CASE
WHEN hu.bedroom_count IS NOT NULL
THEN ', Bedrooms: ' || hu.bedroom_count
ELSE NULL
END
|| CASE
WHEN hu.bedspace_count IS NOT NULL
THEN ', Bedspaces: ' || hu.bedspace_count
ELSE NULL
END AS hu_descripton
FROM HOUSING_UNIT hu
WHERE hu.element_id = pe.element_id
ORDER BY hu.hu_ref
) AS housing_units
FROM PROJECT_ELEMENT pe
WHERE pe.project_id = p.project_id
ORDER BY pe.element_ref, pe.element_name
) elements
FROM PROJECT p
START WITH p.project_id = l_root_project_id
CONNECT BY PRIOR p.project_id = p.parent_project_id -- connect by used with LEVEL keyword
ORDER SIBLINGS BY p.file_ref DESC
, p.project_ref DESC
, p.project_name DESC;
Edited by: AprilM on Jul 17, 2012 10:28 AMInteresting. I am getting even worse results on 11.2.0.1.0:
SQL> select * from v$version
2 /
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL> select dname,cursor(select ename from emp e where e.deptno = d.deptno) from dept d
2 /
select dname,cursor(select ename from emp e where e.deptno = d.deptno) from dept d
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-00905: missing keyword
SQL> connect scott
Enter password: *****
Connected.
SQL> select * from v$version
2 /
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for 32-bit Windows: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
SQL> select dname,cursor(select ename from emp e where e.deptno = d.deptno) from dept d
2 /
DNAME CURSOR(SELECTENAMEFR
ACCOUNTING CURSOR STATEMENT : 2
CURSOR STATEMENT : 2
ENAME
CLARK
KING
MILLER
RESEARCH CURSOR STATEMENT : 2
CURSOR STATEMENT : 2
ENAME
SMITH
JONES
SCOTT
ADAMS
FORD
SALES CURSOR STATEMENT : 2
CURSOR STATEMENT : 2
ENAME
ALLEN
WARD
MARTIN
BLAKE
TURNER
JAMES
6 rows selected.
OPERATIONS CURSOR STATEMENT : 2
CURSOR STATEMENT : 2
no rows selected
SQL> And double CURSOR also works fine in 10g:
SQL> select cursor(select dname,cursor(select ename from emp e where e.deptno = d.deptno) from dept d) from dual
2 /
CURSOR(SELECTDNAME,C
CURSOR STATEMENT : 1
CURSOR STATEMENT : 1
DNAME CURSOR(SELECTENAMEFR
ACCOUNTING CURSOR STATEMENT : 2
CURSOR STATEMENT : 2
ENAME
CLARK
KING
MILLER
RESEARCH CURSOR STATEMENT : 2
CURSOR STATEMENT : 2
ENAME
SMITH
JONES
SCOTT
ADAMS
FORD
SALES CURSOR STATEMENT : 2
CURSOR STATEMENT : 2
ENAME
ALLEN
WARD
MARTIN
BLAKE
TURNER
JAMES
6 rows selected.
OPERATIONS CURSOR STATEMENT : 2
CURSOR STATEMENT : 2
no rows selectedSY.
Edited by: Solomon Yakobson on Jul 17, 2012 1:27 PM -
Materialized view ....subquery expression not allowed
Hi,
I have been assigned to create a materialized view using the following subquery.
When I executed it is giving error ora-22818:subquery expressions not allowed here. The same query is good for view but not MV.
Can anybody help me in writing MV for my query.
select rownum as ROWNUMBER,f.id Folder_ID, concatyear(f.id) year_name,
(select nvl(fr.requestor,fr.requested_by) from fts_folder_request fr where
fr.folder_id=f.id and fr.status=0 ) Pending_Requestor,
(select nvl(fr.requestor,fr.requested_by)
from fts_folder_request fr,fts_folder_checkout_history fch where
fr.folder_id=f.id and fch.folder_requested=fr.id and fch.return_date is null) CheckOut_To from fts_folder f;
Thanks in advance.Any help in creating MV for my query.It contains subquery expressions that have to be avoided in MV.
select rownum as ROWNUMBER,f.id Folder_ID, concatyear(f.id) year_name,
(select nvl(fr.requestor,fr.requested_by) from fts_folder_request fr where
fr.folder_id=f.id and fr.status=0 ) Pending_Requestor,
(select nvl(fr.requestor,fr.requested_by)
from fts_folder_request fr,fts_folder_checkout_history fch where
fr.folder_id=f.id and fch.folder_requested=fr.id and fch.return_date is null) CheckOut_To from fts_folder f;
Thanks.
Message was edited by:
user617694 -
Received ORA-22818 subquery expressions not allowed here when creating mate
Hello,
I was trying to create a materialized view to describe the referential integrity between the tables in my schema:
create materialized view user_references
tablespace tbspc
build immediate
using index
refresh complete on demand next sysdate + 1
as
select uic.table_name to_table, uic.column_name to_column,
ucc.table_name from_table, ucc.column_name from_column
from user_ind_columns uic, user_constraints uc, user_cons_columns ucc
where uic.index_name = uc.r_constraint_name
and uc.constraint_name = ucc.constraint_name
and uc.owner=upper('my_schema');
I was able to create this MV in Oracle 9.2. It failed with the following error when I ran it against Oracle 10.1:
from user_ind_columns uic, user_constraints uc, user_cons_columns ucc
ERROR at line 9:
ORA-22818: subquery expressions not allowed here
Is not allowing subqueries in MV a new restriction in Oracle 10? Is there a workaround?
ThanksHello
This may be a bug in your version as I can do it successfully on 10.2
tylerd@DEV2> create materialized view user_references
2 build immediate
3 using index
4 refresh complete on demand next sysdate + 1
5 as
6 select uic.table_name to_table, uic.column_name to_column,
7 ucc.table_name from_table, ucc.column_name from_column
8 from user_ind_columns uic, user_constraints uc, user_cons_columns ucc
9 where uic.index_name = uc.r_constraint_name
10 and uc.constraint_name = ucc.constraint_name
11 and uc.owner=upper('my_schema');
Materialized view created.
tylerd@DEV2> select * from v$version
2 /
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Prod
PL/SQL Release 10.2.0.2.0 - Production
CORE 10.2.0.2.0 Production
TNS for 32-bit Windows: Version 10.2.0.2.0 - Production
NLSRTL Version 10.2.0.2.0 - Production
5 rows selected.HTH
David -
Voice over does not allow me to open locked screen
voice over does not allow me to open locked screen iPhone 6
<Subject Edited by Host>Use two taps wherever you would use one tap. Navigate to Settings/General/Accessibility and turn it off.
Maybe you are looking for
-
Application Server Report Path
Dear Oracle Gurus I am new to this area of expertise. We have a peculiar problem. Let me try to explain this We are running Oracle Appication server in Windows based environment( windows server 2003 i presume) we have multiple projects running in thi
-
Hi All, I have one issue that, i am geeting this " *Error in mru internal routine: ORA-20001: Error in MRU: row= 0, ORA-01403: no data found, insert into "BM_TOOL"."BASE_DATA_STORAGE_TAB"* error while i try to add row for sql(updatable report) or tab
-
Adobe reader android browser plugin
Why does adobe reader not allow the mime type application/pdf in an object tag to work in a web page? Instead it wants to download the pdf instead of viewing it in the browser like your desktop application. All you have to do is write a library .so
-
Trouble exporting a ProRes Sequence
Hi. I'm running Premiere CC on a MacBookPro and I recently exported a ProRes_422 at 24fps sequence as an Mp4 for streaming purposes. The resulting file has a kind of hesitation, or choppiness every few seconds. Can you tell me why this happened? I'd
-
Why won't my iPhone 6 pair with my car? My iPhone 4 and 5 had no problems.
Why won't my iPhone 6 pair with my car? My iPhone 4 and 5 had no problems.