outer join on query with the GOLD clause
Hi all, I have a problem outerjoining a clause or a request withHere's my data
WITH table1 AS
(
SELECT 'test' txt1, 'pak' txt2, 'ced' txt3, 'su' txt4 FROM dual UNION ALL
SELECT null txt1, 'pak' txt2, 'ced2' txt3, 'su2' txt4 FROM dual UNION ALL
SELECT null txt1, NULL txt2, 'ced3' txt3, 'su3' txt4 FROM dual UNION ALL
SELECT null txt1, NULL txt2, null txt3, 'su3' txt4 FROM dual UNION ALL
SELECT 'text5' txt1, NULL txt2, null txt3, 'su3' txt4 FROM dual UNION ALL
SELECT null txt1, NULL txt2, null txt3, null txt4 FROM dual
)
,table2 AS
(
SELECT 111 pid, 'test' txt1, 'pak4' txt2, 'ced' txt3, 'su' txt4 FROM dual UNION ALL
SELECT 222 pid, 'test1' txt1, 'pak' txt2, 'ced2' txt3, 'su2' txt4 FROM dual UNION ALL
SELECT 333 pid, 'test2' txt1, 'pak3' txt2, 'ced3' txt3, 'su4' txt4 FROM dual UNION ALL
SELECT 444 pid, 'test2' txt1, 'pak3' txt2, 'ced4' txt3, 'su3' txt4 FROM dual
)
SELECT b.pid, a.*
from table1 a, table2 b
WHERE (a.txt1 = b.txt1 OR
a.txt1 IS NULL AND a.txt2=b.txt2 OR
Nvl(a.txt2, a.txt1) IS NULL AND a.txt3 = b.txt3 OR
Nvl(a.txt2, a.txt1) IS NULL AND a.txt3 IS NULL AND a.txt4 = b.txt4
)
as you can see I am attaching the table 1 and table 2. I join with txt1, if txt1 is null, then join by txt2, if null, then reach by txt3 and so on.the above produces this output code
PID TXT1 TXT2 TXT3 TXT4
=== ==== === ==== ====
111 test pak ced su
222 pak ced2 su2
333 ced3 su3
444 su3
This output is partially correct. only 4 lines were in display and two has been left out SELECT 'text5' txt1, NULL txt2, null txt3, 'su3' txt4 FROM dual UNION ALL
SELECT null txt1, NULL txt2, null txt3, null txt4 FROM dual
I tried to use the outer join, but oracle will complain that I can't use outerjoin with the GOLD clause.can someone modify my query to display the output below?
PID TXT1 TXT2 TXT3 TXT4
=== ==== === ==== ====
111 test pak ced su
222 pak ced2 su2
333 ced3 su3
444 su3
NULL NULL NULL NULL NULL
test5
Not sure you can do it with the style of the Oracle of outer joins, but open ANSI style joins is simple, in fact exactly as you had it.
SQL> set null null;
SQL> WITH table1 AS (
2 SELECT 'test' txt1, 'pak' txt2, 'ced' txt3, 'su' txt4 FROM dual UNION ALL
3 SELECT null txt1, 'pak' txt2, 'ced2' txt3, 'su2' txt4 FROM dual UNION ALL
4 SELECT null txt1, NULL txt2, 'ced3' txt3, 'su3' txt4 FROM dual UNION ALL
5 SELECT null txt1, NULL txt2, null txt3, 'su3' txt4 FROM dual UNION ALL
6 SELECT 'text5' txt1, NULL txt2, null txt3, 'su3' txt4 FROM dual UNION ALL
7 SELECT null txt1, NULL txt2, null txt3, null txt4 FROM dual),
8 table2 AS (
9 SELECT 111 pid, 'test' txt1, 'pak4' txt2, 'ced' txt3, 'su' txt4 FROM dual UNION ALL
10 SELECT 222 pid, 'test1' txt1, 'pak' txt2, 'ced2' txt3, 'su2' txt4 FROM dual UNION ALL
11 SELECT 333 pid, 'test2' txt1, 'pak3' txt2, 'ced3' txt3, 'su4' txt4 FROM dual UNION ALL
12 SELECT 444 pid, 'test2' txt1, 'pak3' txt2, 'ced4' txt3, 'su3' txt4 FROM dual)
13 SELECT b.pid, a.*
14 from table1 a
15 LEFT JOIN table2 b
16 ON (a.txt1 = b.txt1 OR
17 a.txt1 IS NULL AND a.txt2=b.txt2 OR
18 Nvl(a.txt2, a.txt1) IS NULL AND a.txt3 = b.txt3 OR
19 Nvl(a.txt2, a.txt1) IS NULL AND a.txt3 IS NULL AND a.txt4 = b.txt4);
PID TXT1 TXT2 TXT3 TXT4
---------- ------ ------ ------ ------
111 test pak ced su
222 null pak ced2 su2
333 null null ced3 su3
444 null null null su3
null text5 null null su3
null null null null null
John
Tags: Database
Similar Questions
-
Outer joins and null in the 'where' clause condition
Hi people,
Please help me on this.
Here's my query.
with x
(select 'a' as a dual union all col1)
Select 'b' as col1 of union double all the
Select 'c' as double col1
),
y as
(
Select 'b' as col2 from dual Union all the
Select 'c' as col2 from dual Union all the
Select would be "as col2 from dual Union all the"
Select 'e' as col2 from dual
)
Select * x y right outer join
on x.col1 = y.col2 and y.col2 is null
Get all the lines of 'COL1' as null. Why like this?
Just add the condition to the WHERE clause for example
WITH x AS (SELECT 'a' AS col1 FROM dual UNION ALL SELECT 'b' AS col1 FROM dual UNION ALL SELECT 'c' AS col1 FROM dual ), y AS ( SELECT 'b' AS col2 FROM dual UNION ALL SELECT 'c' AS col2 FROM dual UNION ALL SELECT 'd' AS col2 FROM dual UNION ALL SELECT 'e' AS col2 FROM dual ) SELECT * FROM x LEFT OUTER JOIN y ON x.col1=y.col2 ----want to add "and y.col2 is null " condition to get value "a" where y.col2 is null
-
Hi all
I have this select statement to help to filter different from zero records.
Select GroupName, Nom_liste,
Sum ((a_cost/1000) * degradation * quantity * total_count * index) such as total_cost,.
FROM MyTable
having sum ((a_cost/1000) * degradation * quantity * total_count * index) <>0
Group GroupName, Nom_liste
Having done so the query to run more slowly.
How can I filter records with zero total_cost (they can be negative or greater than zero).
Thank you!
Hello
user9542267 wrote:
Hi all
I have this select statement to help to filter different from zero records.
Select GroupName, Nom_liste,
Sum ((a_cost/1000) * degradation * quantity * total_count * index) such as total_cost,.
FROM MyTable
having sum ((a_cost/1000) * degradation * quantity * total_count * index) <> 0
Group GroupName, Nom_liste
Having done so the query to run more slowly.
How can I filter records with zero total_cost (they can be negative or greater than zero).
Thank you!
The query you posted should not take more time with or without the HAVING clause. The right of the comma before 'from' causes a compilation error very quickly anyway.
If you get no result other than an error message, then this is not the code you are running. Show the code you actually run, or a simplified version that has the same problem.
For all performance issues, see the FAQ forum:
https://community.Oracle.com/message/9362003#9362003
If the problem was really in the HAVING clause, then you can try something like this:
WITH got_total_cost AS
(
SELECT GroupName, Nom_liste
, SUM ((a_cost/1000) * degradation * quantity * total_count * index) SUCH as total_cost
FROM MyTable
GROUP BY GroupName, Nom_liste
)
SELECT *.
OF got_total_cost
WHERE as total_cost <> 0
;but it would be very surprising he made all the difference. I suspect that the problem is not really in the HAVING clause.
-
Select the query with the level line list where the clause
Hi all
I am creating a tabular presentation based on a SQL query that has a list of selection based on a query with a where clause clause that refers to a column in the original SQL query.
The situation is, I have a table that stores the client_id, source_id, and build_id, lets call it client_source. I have a second table, build_source, containing source_id and build_id, one to many relations between the two (1 source_id could have build_id 1-7).
Using a tabular presentation, I want to select the correspondent build_id to use in client_source, but the selection list should contain only the build_id for this particular source_id of lines.
Here is an example of the SQL source of tabular presentation;
Select
s.ROWID,
s.CLIENT_ID,
s.SOURCE_ID,
APEX_ITEM. SELECT_LIST_FROM_QUERY (1, s.BUILD_ID,)
"Select display b.build_id, b.build_id return.
b build_source where b.source_id = s.SOURCE_ID ') lst
of s client_source
what I want to achieve, it's as source_id "BOLD" match fields. When the query is built this way, I get an error of "invalid identifier" Oracle on s.SOURCE_ID during execution.
Is there some special tags to be used to refer to the external column? I must be missing something because this looks like a pretty mundane problem.
I am running on 4.1.0.00.32, on an Oracle 10 g release 10.2.0.4.0 Server Express request.
I look forward to useful responses!
See you soon,.
Jason
Published by: 1005131 on May 9, 2013 19:02Your selection by query list receives a static SQL. That SQL can't "see" the value of your s.source_id.
But it would work like this:
where b.source_id = ' | s.SOURCE_ID)You would be the value for the SQL concatenation. It is not ideal, but it will work.
Jorge
-
BAD RESULTS WITH OUTER JOINS AND TABLES WITH A CHECK CONSTRAINT
HII All,
Could any such a me when we encounter this bug? Please help me with a simple example so that I can search for them in my PB.
Bug:-8447623
Bug / / Desc: BAD RESULTS WITH OUTER JOINS AND TABLES WITH a CHECK CONSTRAINT
I ran the outer joins with check queries constraint 11G 11.1.0.7.0 and 10 g 2, but the result is the same. Need to know the scenario where I will face this bug of your experts and people who have already experienced this bug.
Version: -.
SQL> select * from v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production PL/SQL Release 11.1.0.7.0 - Production CORE 11.1.0.7.0 Production TNS for Solaris: Version 11.1.0.7.0 - Production NLSRTL Version 11.1.0.7.0 - Production
Why do you not use the description of the bug test case in Metalink (we obviously can't post it here because it would violate the copyright of Metalink)? Your test case is not a candidate for the elimination of the join, so he did not have the bug.
Have you really read the description of the bug in Metalink rather than just looking at the title of the bug? The bug itself is quite clear that a query plan that involves the elimination of the join is a necessary condition. The title of bug nothing will never tell the whole story.
If you try to work through a few tens of thousands of bugs in 11.1.0.7, of which many are not published, trying to determine whether your application would be affected by the bug? Wouldn't be order of magnitude easier to upgrade the application to 11.1.0.7 in a test environment and test the application to see what, if anything, breaks? Understand that the vast majority of the problems that people experience during an upgrade are not the result of bugs - they are the result of changes in behaviour documented as changes in query plans. And among those who encounter bugs, a relatively large fraction of the new variety. Even if you have completed the Herculean task of verifying each bug on your code base, which would not significantly easier upgrade. In addition, at the time wherever you actually performed this analysis, Oracle reportedly released 3 or 4 new versions.
And at this stage would be unwise to consider an upgrade to 11.2?
Justin
-
'Open the drawer out press ok' message with the tray open output and pressed OK.
'Open the drawer out press ok' message with the tray open output and pressed OK. Seems that the device does not believe that the drawer is open. This has happened directly after deletion of a paper jam.
Sometimes a small part being out of alignment can make a sensor turn off inside the printer, so make sure you put everything back together right first. Although you to act this way, looks at the printer closely for any broken pieces. If you do not see what has obviously broken, try to do a hard reset. Instructions that are below. If the hard reset does not clear the error, the output bin sensor may be broken. If this is the case, you will need to get a new printer, as the sensor is not repairable.
To do a hard reset:
1. make sure that the printer is turned on.
2. pull on the power cord from the printer.
3. pull out the power cord from the wall.
4. wait for 30 seconds.
5. plug in the printer and turn it on. -
SQL query with the troubleshooting Subselects
I have a query with the 3 Subselects. Each of the Subselects works very well on its own. I run the query in Oracle SQL Developer and get ORA 933 "sql command not completed successfully" at 47 48 line pass. I am unable to say what is causing the error. The pointers you know sincerely!
Here is the code:SELECT adjud.country, adjud.site, adjud.prodtype, sum(adjud.acount) + sum(denied.dcount) as TotalClosed, case when adjud.adtype = 'Paid' then adjud.acount End as NumPaid, case when adjud.adtype = 'Paid' then adjud.totalpaid End as AmtPaid, count(adjud.contest) + count(denied.contest) + count(pend.contest) as CntContestable, sum(pend.pcount) as PendingCount, Case when pend.overunder = 'Over' Then count(pend.pcount) End as Over90Count, sum(pend.facevalue) as PendingAmount From ( select count(clm.clm_nbr) as acount, sum(clm.rsrv_amt) as facevalue, sum(clm.tot_pd_amt) as totalpaid, clm.prdt_type_nm as prodtype, clm.cntsbl_indc as contest, case when clm.exam_co_cd in ('107','134') then 'Hong Kong' else case when clm.exam_co_cd = '234' then 'Singapore' else 'US' End End as country, clm.exam_admin_site_cd as site, Case when clm.rmk_cd in ('R00', 'R01', 'R02') then 'Denied' Else 'Paid' End as adtype from afp_cds.claim_vw clm where clm.adjud_dt is not null and clm.adjud_dt > :startDate and clm.adjud_dt < :EndDate group by clm.prdt_type_nm, clm.cntsbl_indc, case when clm.exam_co_cd in ('107','134') then 'Hong Kong' else case when clm.exam_co_cd = '234' then 'Singapore' else 'US' End End, clm.exam_admin_site_cd, Case when clm.rmk_cd in ('R00', 'R01', 'R02') then 'Denied' Else 'Paid' End ) as adjud, ( select count(clm.clm_nbr) as dcount, sum(clm.rsrv_amt) as facevalue, clm.prdt_type_nm as prodtype, case when clm.exam_co_cd in ('107','134') then 'Hong Kong' else case when clm.exam_co_cd = '234' then 'Singapore' else 'US' End End as country, clm.exam_admin_site_cd as site, clm.cntsbl_indc as contest from afp_cds.claim_vw clm where clm.deny_dt is not null and clm.deny_dt > :startDate and clm.deny_dt < :EndDate group by clm.prdt_type_nm, case when clm.exam_co_cd in ('107','134') then 'Hong Kong' else case when clm.exam_co_cd = '234' then 'Singapore' else 'US' End End, clm.exam_admin_site_cd, clm.cntsbl_indc ) as denied, ( select count(clm.clm_nbr) as pcount, sum(clm.rsrv_amt) as facevalue, clm.prdt_type_nm as prodtype, case when clm.exam_co_cd in ('107','134') then 'Hong Kong' else case when clm.exam_co_cd = '234' then 'Singapore' else 'US' End End as country, clm.exam_admin_site_cd as site, clm.cntsbl_indc as contest, case when sysdate - clm.regtrtn_dt > 90 then 'Over' else 'Under' End as overunder from afp_cds.claim_vw clm where clm.adjud_dt is null and clm.deny_dt is null group by clm.prdt_type_nm, case when clm.exam_co_cd in ('107','134') then 'Hong Kong' else case when clm.exam_co_cd = '234' then 'Singapore' else 'US' End End, clm.exam_admin_site_cd, clm.cntsbl_indc, case when sysdate - regtrtn_dt > 90 then 'Over' else 'Under' End ) as pend where adjud.prodtype = denied.prodtype and adjud.country = denied.country and adjud.site = denied.site and adjud.contest = denied.contest and adjud.prodtype = pend.prodtype and adjud.country = pend.country and adjud.site = pend.site and adjud.contest = pend.contest group by adjud.country, adjud.site, adjud.prodtype, case when adjud.adtype = 'Paid' then adjud.acount End, case when adjud.adtype = 'Paid' then adjud.totalpaid End, Case when pend.overunder = 'Over' Then count(pend.pcount) End
Do not use "Sub" with the table alias.
Change this stmt type:
) as adjud,
TO
) adjud,
-
How can I create a query with the data control to the web service?
I need to create a query with the order of web service data, WSDL, it is query operation, there is a message of parameter with possible query criteria and a return message contains the results. I googled but can't find anything on the query with the web service. I can't find a criterion "named" to the data control of web service as normal data control. Blog of Shay, I saw the topics on the update with the data of web service command. How can I create a query with the data control to the web service? Thank you.Hello
This might help
* 054. Search form using control data WS ADF and complex of entry types *.
http://www.Oracle.com/technetwork/developer-tools/ADF/learnmore/index-101235.html
-
outer join does not give the expected results (missing documents)
Hello
I have problem with outer join in OBIEE 10 g.
I'm testing it on the model of simplified database
STAT table with some statistics of TYPEs
stat_date, id_type, num
..
..
26/03/2003, 20: 1
26/03/2003, 21: 1
26/03/2003, 23: 1
26/03/2003, 24, 1
26/03/2003, 25, 1
..
27/03/2003, 22, 1 <-different date here
..
..
Table TYPES
ID_type
..
..
20
21
22
23
24
25
..
..
Physical model
STAT >-TYPES
AM.
F1 (only Digital STAT table column (agg. County))
D1 (STAT_DATE of the STAT table column only)
D2 (source TYPES)
D1 - inner join - < F1
D2 - left outer join - < F1
I would like to create simple report filtered by date with number of each type.
I want to get this result
ID_type County
.. ..
.. ..
20 1
21 1
22 null
23 1
24 1
25 1
.. ..
.. ..
But I get this
ID_type County
.. ..
.. ..
20 1
21 1
23 1
24 1
25 1
.. ..
.. ..
ID_type 22 is missing
!!!
I NORMALLY GET RESULT ONLY IF I DELETE RECORD ' 27/03/2003 22' OF MY FACT TABLE.
!!!
I have the filter on the date column D1
STAT_DATE = 26/03/2003 or STAT_DATE is null
BI Server running this SQL query
Select distinct D1.c1 as c1,
D1. C2 C2
Of
(select count (T17840. NUM) in c1.
T17867.ID_TYPE C2
Of
Left outer join of TYPES T17867
STAT T17840 on T17840.ID_TYPE = T17867.ID_TYPE
where (T17840. STAT_DATE in (TO_DATE ('2003-03-26', 'YYYY-MM-DD')) or T17840. STAT_DATE is null)
T17867.ID_TYPE group
) D1
Can you give me some advice?
Thank youHi cardel,
I think that you can achieve your goal if you build a dimension of the array STAT form, you can create a table Alias in the physical layer and then to join the table of facts (external to the left). In this way, I think that you can solve your problem.
Let me know.
Kind regards
Gianluca -
Outer join is not retrieve the correct values
Hi, I have a problem to recover some data from this query with outer join:
SELECT count (incident_id), range_2 of
(by selecting range_2 in apps.aaa_table),
(Select inc.incident_id,
XXN2B_RESOLUTION_RANGE (2, ROUND (((TO_DATE (inc. INCIDENT_ATTRIBUTE_7, «hh24:mi:ss jj/mm/yyyy»)-inc. INC_RESPONDED_BY_DATE) * 24), 2)) VARIES
Inc. stuff
Inc. INVENTORY_ITEM_ID,
prom_dt. Iptv_Sumptom - S? µpt? µA
OF cs_incidents_all_b inc.,.
cs_incidents_all_tl tl,
cs_sr_type_mapping m,
fnd_responsibility RESP,
ntt xxntt.xxntt_incidents_support,
xxntt.xxntt_incidents ntt_inc,
XXe.xxe_tt_promitheas_dt prom_dt,
20th. Xxe_Cs_Int_Sla als
WHERE inc.incident_id = tl.incident_id
AND tl. LANGUAGE = 'EL '.
AND inc.incident_type_id = m.incident_type_id
AND resp.responsibility_key IN (select SV. S fnd_flex_value_sets FLEX_VALUE, FND_FLEX_VALUES SV
where s.FLEX_VALUE_SET_NAME = 'XXNTT_RESPONSIBILITIES. '
AND S.FLEX_VALUE_SET_ID = SV. FLEX_VALUE_SET_ID)
AND m.responsibility_id = resp.responsibility_id
AND resp.end_date is null
AND inc.incident_number = ntt.incident_number (+)
AND inc.incident_number = ntt_inc.incident_number (+)
AND inc.incident_id = prom_dt.incident_id (+)
AND inc.incident_number = sla. Incident_Number (+)
- and don't like '%0:00% ' TOTAL_INACT_SLA_DURATION
(Inc. INC_RESPONDED_BY_DATE is not null AND INCIDENT_ATTRIBUTE_7 is not null)
) b.
(select * from xxntt_custom_hierarchy)
Union
Select eidos null null omada, null product_categiory, stuff, null, null, inv_item_descripiption, null, tautopoihsh, inv_item_id double null null symptom
) c
where a.range_2 = b.ranges (+)
and c.INV_ITEM_ID (+) = b.INVENTORY_ITEM_ID
and c.CATEGORY_ID (+) = b.CATEGORY_ID
and c.SYMPTOM (+) = b.IPTV_SUMPTOM
and c.OMADA = 'A '.
Range_2 group
This request is composed by 3 dataset: a, b and c
the data group is a fixed list of values (LOV): range_2 = "0-2h','2-4h','4-6h','6-8h','8-10h','10-12h','12-14h','14-16h','16-18h','18-20h".
the dataset b retrieve a list of the incident_id and their related ranges (calculated with the XXN2B_RESOLUTION_RANGE function)
the c dataset is just a filter on the b of dataset to retrieve only the incident_id who belong to the group "A".
I want to reach is this: always see the full list of values 'range_2', even if I do not have incident_id with a particular range.
That's why I put the condition: a.range_2 = b.ranges (+)
.. .but it does not work... I don't see the incident_id which have the scope inside the LOV... instead I want to see also if there is incident_id without a range to the LOV.
Range_2 grouping, I see:
! http://www.freeimagehosting.NET/uploads/d900035c11.jpg!
Instead of
! http://www.freeimagehosting.NET/uploads/99a75dfca4.jpg!
Can someone help me understand where is the error?
Thanks in advance
AlexHi Alex,
I think you need to externally join the final predicate, thus:
.. and c.OMADA(+) = 'A' ..
Concerning
Peter -
T/t with the WHERE clause using a list breaks
Hello, all,.
I have a project where I need to use a list as part of the WHERE clause for a t/t, and it is breaking. I don't know what I'm doing wrong.
For some pseudo-code, do I have a complete query of a database called 'people '. A list of values for the t/t with the first query; the second query is my t/t:
<cfquery name="getDIR" datasource="#request.THISDSN#"> SELECT thisName dir FROM orgs WHERE thisID in (<cfqueryparam value="#form.org#" cfsqltype="cf_sql_varchar" list="yes" />) </cfquery> <cfquery name="people" database="people"> SELECT colA, colB, colC, colD FROM people WHERE 1=1 AND ( div IN (<cfqueryparam value="#valueList(getDIR.dir)#" cfsqltype="varchar" list="yes" />) OR dir IN (<cfqueryparam value="#valueList(getDIR.dir)#" cfsqltype="varchar" list="yes" />) ) </cfquery>
I get the error message is "t/t syntax error: encountered" div IN \'thisValue\' ".» Incorrect conditional expression, waiting for one of [as | null | between | in | comparison] condition. »
Can support _not_ QoQ lists of WHERE clauses?
V/r,
^_^
SMH - so much... I just found.
I forgot to give the lists in the second query bracket.
(The pseudocode was manually typed, since my dev system is isolated from the internet, and I added the in my pseudo code when they were not in my original code.)
* headdesk * headdesk * headdesk * headdesk *.
V/r,
^_^
-
WITH the contentious Clause PLSQL
declare
var dbms_sql.varchar2_table;
Start
WITH elements LIKE (select "a, b, c" double str)
SELECT substr (x, instr (x, ', ',-1) + 1) AS single_element in bulk collect in var
FROM (SELECT elements.str
nt.column_value AS element_no
, SUBSTR (elements.str, 1, INSTR (elements.str |)) ((', ',', 1, column_value)-1) x
Elements
, TABLE (SELECT collect (ROWNUM) OF double CONNECTION BY INSTR (elements.str |)) ((', ',', 1, ROWNUM) > 0) nt
) ;
end;
----------
Error report:
ORA-06550: line 10, column 20:
PL/SQL: ORA-22905: cannot access the rows of a table not nested element
ORA-06550: line 4, column 5:
PL/SQL: SQL statement ignored
06550 00000 - "line %s, column % s:\n%s".
* Cause: Usually a PL/SQL compilation error.
* Action:
----------
Please advice!This has nothing to do with the clause WITH PL/SQL. You MUST explicitly cast to charge VIRES to the nested table type:
SQL> declare 2 var dbms_sql.varchar2_table; 3 begin 4 WITH elements AS ( select 'a,b,c' str from dual ) 5 SELECT substr( x, instr( x, ',', -1 ) + 1) AS single_element bulk collect into var 6 FROM ( SELECT elements.str 7 , nt.column_value AS element_no 8 , SUBSTR( elements.str, 1, INSTR( elements.str || ',', ',', 1, column_value ) - 1 ) x 9 FROM elements 10 , TABLE( SELECT collect(ROWNUM) FROM dual CONNECT BY INSTR( elements.str || ',', ',', 1, ROWNUM ) > 0 ) nt 11 ) ; 12 end; 13 / , TABLE( SELECT collect(ROWNUM) FROM dual CONNECT BY INSTR( elements.str || ',', ',', 1, ROWNUM ) > 0 ) nt * ERROR at line 10: ORA-06550: line 10, column 3: PL/SQL: ORA-22905: cannot access rows from a non-nested table item ORA-06550: line 4, column 1: PL/SQL: SQL Statement ignored SQL> declare 2 var dbms_sql.varchar2_table; 3 begin 4 WITH elements AS ( 5 select 'a,b,c' str from dual 6 ) 7 SELECT substr(x,instr(x,',',-1) + 1) AS single_element 8 bulk collect 9 into var 10 FROM ( 11 SELECT elements.str, 12 nt.column_value AS element_no, 13 SUBSTR(elements.str,1,INSTR(elements.str || ',', ',',1,column_value) - 1) x 14 FROM elements, 15 TABLE(SELECT cast(collect(ROWNUM) as sys.OdciNumberList) FROM dual CONNECT BY INSTR(elements.str || ',',',',1,ROWNUM) > 0) nt 16 ) ; 17 end; 18 / PL/SQL procedure successfully completed. SQL>
SY.
-
Outer Join don't know the smallest and largest join until the run time column
Hello, I have three tables and I don't know which one is the smallest game of the outer join column. So, how can I join them and the following output.
If I know in advance, which is the largest and which one is the smallest game so I can use something like below, but what if I don't know which is the smallest together or we're great together?
Test case and the request for a fixed set, smaller and more large set case:
Select x1.nm, cnt1, cnt2, cvt3.cnt cnt3
Of
(
Select cvt1.nm, cvt1.cnt cnt1, cnt2 in cvt1 cvt2.cnt, cvt2
where cvt1.nm = cvt2.nm (+)
) x 1, cvt3
where x1.nm = cvt3.nm (+)
NM CNT1, CNT2 CNT3
-- ---------- ---------- ----------
A 1 101
B 2 102
C 3
4 1001 D
5 1002 E
create table cvt1 (nm varchar2 (1), cnt1 number)
/
create table cvt2 (nm varchar2 (1), number of cnt2)
/
create table cvt3 (nm varchar2 (1), cnt3 number)
/
insert into cvt1 select 'A', 1 double
/
insert into cvt1 select 'B', 2 of the double
/
insert into cvt1 select 'C', 3 double
/
INSERT into cvt1 select would be ', 4 of the double
/
insert into cvt1 select 'E', 5 double
Insert into select cvt2 'A', 101 double
/
Insert into cvt2 select 'B', 102 of the double
/
Insert into select 'C', 103 double cvt2
/
INSERT into cvt3 select would be ', double 1001
/
insert into cvt3 select 'E', 1002 double
/
Published by: xwo0owx on March 31, 2011 12:48
-
How to transpose the query with the following result
Dear all,
Can someone tell me a method to convert my query result
Details are provided in
http://obiee11ge.blogspot.com/2010/07/how-to-transpose-query-with-following.html
Concerning
MustafaHello
Try this
Create a request combined with,criterion no. 1: model, revenue (Actual), Cogs (Actual), Opex (Actual), PL (Actual)
in the dummy column fx enter the "Real" value
criterion 2: model, revenue (Yago), Cogs (YAgo), Opex (Yago), PL (Yago)
in the dummy column fx enter the value as "Yago".
criterion 3: model, revenue (Budget), Cogs (Budget), Opex (Budget), PL (Budget)
in the dummy column fx enter the value as 'Budget '.
Now go to the columns of result and set names coumn (revenue, COGS, Opex, PL) for the result set.
For the Dumny, remove column header.In a sheet view, you will get the result.
Thank you
Vino -
Union of CFC query with the query of database
I try to call a Web service to return a query, and then run a parallel query in another database and the Union both with a query from the query. The Web service server and the local server are CF7, two MySQL running, both tables to access parallel structures. Web service returns what appears to be a normal interview CFDUMP, but then when I have UNION it with the second query, I get "incorrect select list ' or"Columns '1' equal number have different types (SMALLINT, JAVA_OBJECT)"errors. So apparently there's something different about the query from the webservice that is causing problems?Thanks, that fixed it. I didn't realize that CF had its own function Q of Q CAST. Here is documentation on this subject, where he escaped to others.
Adobe: It would be nice if the dip page for a main keyword as a CFQUERY would connect to all linked pages, like the one above. When searching for information using a special tag, it would be much more likely to find the related page.
Maybe you are looking for
-
FIRST: ENVY 7247cl dv7 BIOS supports ACHI? The BIOS is "INSYDE' version F.2D I am replacing the SATA FDI with a 1 TB disk Samsung SSD 840EVO and must set the BIOS IDE SATA AHCI.If it does not support can 'I' swap on the BIOS? SECONDLY: How/where can
-
Add an existing project to the workspace different?
I currently have a working space with several projects. Ex. MyProjects.cws-> Project1.prj, Project2.prj, ect. I was recently given a project that someone else wrote that I add to my workspace. Ex. OtherProjects.cws-> Project3.prj. How can I includ
-
New Question / / video rotation for reading
New Question / / I solved 2 problems, I have a remaining. I am in the photo gallery of widows and I play a video sent from my I phone. The image quality is excellent, the sound is great. My problem is that the video must be turned right to good veiwi
-
Example: HP2645: printing envelopes hp2645
I can't print on the envelope height 10,3 cm x 22.9 cm to my HP2645 printer. The printer gave a missmatch warning paper. Thank you
-
BlackBerry smartphone Email no longer works after the transfer to the new phone
I turned on the weekend in a phone of the company on my own phone. At the dealership, they used the BB SW Office to cross all the information of the previous phone into the new. Everything went through fine, except my Blackberry e-mail address. I