How to do outer join in data model view?
Hi,
I have 2 queries are needed to be joined in Oracle Report 6i Data Model View. What I want to do is below:
where table1.receipt_no(+)=table2.receipt_no
How do I use the 'Data Link' to do this in Data Model view?
Thanks.
Jun
Hi
You need to use data links. Refer data link section in BUilding Reports manual at http://otn.oracle.com/products/reports/htdocs/getstart/docs/B10310_01/orbr_concepts1.htm#1013156.
Thanks
Rohit
Similar Messages
-
Issues with using Outer join in Data Template
Hi all,
this is my data in two tables .
Table Ronny1
colA colB
1 u
2 v
3 x
Table Ronny2
colC colD
1 q
2 r
This is my data template
<dataTemplate name="MGF" dataSourceRef="Source1">
<dataQuery>
<sqlStatement name="Q1" dataSourceRef="Source1">
<![CDATA[select C, D from Ronny2]]>
</sqlStatement>
<sqlStatement name="Q2" dataSourceRef="Source2">
<![CDATA[select A , B from lokesh1 where A = :C]]>
</sqlStatement>
</dataQuery>
<dataStructure>
<group name="G1" source="Q1">
<group name="G2" source="Q2">
<element name="A" value="A"/>
<element name="B" value="B"/>
</group>
</group>
</dataStructure>
</dataTemplate>
Now this would give me result as
A B
1 u
2 v
however my requirement is this
A B
1 u
2 v
3 x
that is, i want to display all the rows of table Ronny1 and matching rows from table Ronny2. I tried modifiying my second sql as
<![CDATA[select A , B from lokesh1 where A = :C (+)]]> ( using a outer join)
but this does give me correct data and comes back with the cartesion product.
Can anyone please answer this for me that how can we use the outer join in data templaes.
Thanks
Ronnyhey vetsrini,
sorry for the confusion here,
actually i want to display all the rows from table Ronny1 and i am also pulling in the matching rows from table Ronny2 and my data structure looks as ( pulling in column D from table Ronny2)
<dataStructure>
<group name="G1" source="Q1">
<group name="G2" source="Q2">
<element name="A" value="A"/>
<element name="B" value="B"/>
<element name="D" value="D"/>
</group>
</group>
</dataStructure>
and this is what i want the output to be
A B D
1 u q
2 v r
3 x
Hence the row where A <> C the data in the D column will be null, same as in the case of outer join.
any suggestions
Thx
Ronny -
How to find out the Hire date of an employee?
Hi All
What is effective date, Latest start date and other date fields which are are used when we create a new employee?
What is the difference between hire date and joining date?
How to find out the Hire date and joining date of an employee?
Regards
RahmanThe effective dates are related to date tracking. The effective start date shows when this version of the record became effective.
The Hire Date, or Latest Satrt Date shows the date on which the employee was last hired. If he was hired before from 01/01/01 to 31/12/01, then left but was hired again from 01/01/07, the Latest Hired Date would be 01/01/07 and the First Hired Date would be 01/01/01.
When using Oracle HR, datetracking allows you to either correct data (because it was wrong or incomplete), or update it (because a time effective change took place e.g. got married).
The[b] effective dates show when a record was updated. So, if an update was made on 07/02/07, and the update datetrack option was used, the current record would have its effective end date set to 06/02/07 (the day before the update) and a new version would be created with the updates and an effective start date of 07/02/07.
Hope this helps. -
How to use outer join condition in my below query.
Hi All,
How to use outer join condition in my below query.
In the table APPS_JP.GEDIS_OFFER_HEADER goh I have more records
in the table APPS_JP.GEDIS_ORDER_BUILDS gob I have less number of records.
I want all the records from APPS_JP.GEDIS_OFFER_HEADER goh
including other conditions.
I have tried goh.OFFER_NO=gob.OFFER_NO(+) but same result.
[code]SELECT GOH.ORIG_SYSTEM,
gsp.USER_NAME,
goh.ORDER_NO,
goh.OMEGA_ORDER_NUMBER,
goh.ORDER_TYPE,
gc.CUSTOMER_ID,
gc.OMEGA_CUSTOMER_NUMBER,
CASE WHEN gc.PRIVATE = 'N' THEN gc.CUSTOMER_NAME ELSE '' END
AS COMPANY_NAME,
goh.ORDER_STATUS,
goh.TOTAL_SELLING_PRICE,
goh.TOTAL_MARGIN,
ga1.ADDRESS1
|| ','
|| ga1.ADDRESS2
|| ','
|| ga1.ADDRESS3
|| ','
|| ga1.POSTAL_CODE
|| ','
|| ga1.CITY
AS SHIPPING_ADDRESS,
ga2.ADDRESS1
|| ','
|| ga2.ADDRESS2
|| ','
|| ga2.ADDRESS3
|| ','
|| ga2.POSTAL_CODE
|| ','
|| ga2.CITY
AS BILLING_ADDRESS,
ga.ADDRESS_ID,
gol.DESCRIPTION,
APPS_JP.TZ.to_local_date (goh.OFFER_DATE, goh.OFFER_DATE_UTC)
AS OFFER_DATE,
gc.LEVEL_8,
goh.NO_OF_BUILDS,
gob.SFDC_ID,
goh.PURCHASE_ORDER_NO AS PO,
gc1.CUSTOMER_NAME AS END_USAGE,
gol.LOB,
goh.TOTAL_MARGIN_PCT,
goh.TOTAL_DISCOUNT,
goh.TOTAL_DISCOUNT_PCT
FROM APPS_JP.GEDIS_OFFER_HEADER goh,
APPS_JP.GEDIS_ORDER_BUILDS gob,
APPS_JP.GEDIS_ORDER_LINES gol,
APPS_JP.GEDIS_OFFER_RELATED_CUSTOMER gorc,
APPS_JP.GEDIS_OFFER_RELATED_CUSTOMER ship,
APPS_JP.GEDIS_OFFER_RELATED_CUSTOMER bill,
APPS_JP.GEDIS_CUSTOMER gc,
APPS_JP.GEDIS_CUSTOMER gc1,
APPS_JP.GEDIS_CONTACT gct,
APPS_JP.GEDIS_ADDRESS ga,
APPS_JP.GEDIS_ADDRESS_NORM ga1,
APPS_JP.GEDIS_ADDRESS_NORM ga2,
(SELECT DISTINCT SALESPERSON_ID, USER_NAME
FROM APPS_JP.GEDIS_SALESPERSON
WHERE SALESPERSON_ID IN
(SELECT TO_NUMBER (COLUMN_VALUE) AS SALESPERSON_ID
FROM TABLE (APPS_GLOBAL.SplitString ('337309'))))
gsp
WHERE goh.ORDER_NO <> 0
AND goh.OFFER_NO <> 0
AND goh.OFFER_NO=gol.OFFER_NO
AND gol.BUILD_NO = 1
AND gol.LINE_NO = 1
AND goh.OFFER_NO=gob.OFFER_NO
AND gob.BUILD_NO = 1
AND goh.OFFER_NO = gorc.OFFER_NO
AND gct.CONTACT_ID = gorc.CONTACT_ID
AND ga.CUSTOMER_ID = gc.CUSTOMER_ID
AND ga.PRIMARY = 'Y'
AND goh.LEAD_SALESPERSON=gsp.SALESPERSON_ID
AND goh.OFFER_NO = ship.OFFER_NO
AND ship.RELATION_TYPE = 'SHIP'
AND ga1.ADDRESS_ID = ship.ADDRESS_ID
AND ga1.CUSTOMER_ID = gc1.CUSTOMER_ID
AND goh.OFFER_NO = bill.OFFER_NO
AND bill.RELATION_TYPE = 'BILL'
AND ga2.ADDRESS_ID = bill.ADDRESS_ID
AND goh.OFFER_DATE BETWEEN APPS_JP.TZ.LOCAL_TO_DB_DATE (
SYSDATE - 30
AND APPS_JP.TZ.LOCAL_TO_DB_DATE (SYSDATE)
AND gorc.RELATION_TYPE = 'BASE'
AND gorc.CUSTOMER_ID = gc.CUSTOMER_ID
AND goh.SALES_CHANNEL = gc.SALES_CHANNEL
AND gc.SALES_CHANNEL = 'SMB'
AND goh.LEAD_SALESPERSON IN (goh.CREATED_BY, goh.LEAD_SALESPERSON)
ORDER BY goh.OFFER_NO;[/code]
Please help me how to use this outer join condition.
Thanks in advance.Hi,
If you want all the rows from goh, then you don't want any conditions like goh.OFFER_NO <> 0.
Make all the joins to goh outer joins, and make all conditions that apply to any tables joined to goh (or to tables joined to them) part of the join condition, like this:
FROM APPS_JP.GEDIS_OFFER_HEADER goh
LEFT OUTER JOIN APPS_JP.GEDIS_ORDER_BUILDS gob ON gob.OFFER_NO = goh.OFFER_NO
AND gob.BUILD_NO = 1
LEFT OUTER JOIN APPS_JP.GEDIS_ORDER_LINES gol ON gol.OFFER_NO = goh.OFFER_NO
AND gol.BUILD_NO = 1
AND gol.LINE_NO = 1
LEFT OUTER JOIN APPS_JP.GEDIS_OFFER_RELATED_CUSTOMER
gorc ...
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
Simplify the problem as much as possible. For example, do you really need all those tables to show what the problem is? Of course, you need them in tyour real query, but if you understand a solution that only involves 4 or 5 tables, you'll know how to apply it to any number of tables.
Explain, using specific examples, how you get those results from that data.Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
See the forum FAQ https://forums.oracle.com/message/9362002#9362002 -
How to find out the "manufacture date"?
Hello!
Can you tell me how to find out the manufacture date of my Satellite A110-334 with the serial "SY6224123K"?
I need this information for my insurance!
I found only this link for HDD`s: http://www.storage.toshiba.eu/index_manual.php?pid=220&sid=536&la=en
But there is no "S" on the first digit!??
So it is maybe "Y6" which can be November 2006! Is this right?
Thank you!
===========
This is the information on the link above:
How to encode a Toshiba Hard Disk Drive Serial Number?
The Toshiba serial number (S/N) includes details of the date of manufacture. The first digit of the serial number indicates the Month of manufacture and the 2nd digit indicates the Year.
Example:
M Y x x x x x x x
M = Month
Y = Year
The month digit goes from 1, for January, through to 9, for September, and then X, Y and Z, for October, November and December.
Examples:
2 8 1 7 0 0 0 1 A
2 = February
8 = 1998
3 0 5 4 4 3 0 6 T
3 = March
0 = 2000
X 9 D 7 8 3 3 1 T
X = October
9 = 1999
The remaining digits contain information about factory and production line, and some digits are reserved for a continuously running serial number.Hello
Try with http://gedb.toshiba.com/
Let me know if you find info you need. -
How to find out the last date & time on which a program has been run
Hi Experts,
Can anybody tell how to find out the last date on which a purticular program has been run.
Valuable answers will be rewarded.
Thanks & Regards,
Satish.Hi!
Try STAD transaction. Unfortunately it contains a huge amount of data, so it is available only for a few days backwards... Maybe some weeks, but you can't make yearly reports from its data... So it's not useful to see, which program is in use or not...
I planned once to download it weekly, but it was not so important...
Regards
Tamá -
How to make linkage query In Data Model for search
I want to make an linkage query as a condition for my report in BI Publisher. how to make the linkage in Date Model ?
This is the forum for SQL Developer, not for general SQL or PL/SQL questions.
Please repost this in the SQL and PL/SQL forum. -
How to use outer join on 3 tables
how to use outer join on 3 tables
say tables are mkpf,lips and vbrp
mkpf-xblnr = lips-vbeln
lips-vbeln = vbrp-vgbelrefer following querry
select a~bukrs
a~anln1
a~ord42
a~ord43
b~afabe
b~ndabj
b~kaafa
b~aafag
c~kostl
d~afasl
d~ndjar
d~ndper
into corresponding fields of table gt_master
from ( ( anla as a inner join anlc as b
on abukrs = bbukrs
and aanln1 = banln1
and aanln2 = banln2 )
inner join anlz as c
on abukrs = cbukrs
and aanln1 = canln1
and aanln2 = canln2 )
inner join anlb as d
on abukrs = dbukrs
and aanln1 = danln1
and aanln2 = danln2
where a~bukrs in s_comp. -
How to make outer join in Sub Query?
Hi!
I'm facing one problem. Can anyone tell me - how to make outer join in sub query?
I'm pasting one sample code -
select e.empno, e.ename,e.job,e.sal,d.deptno,d.dname
from d_emp e, d_dept d
where e.deptno(+) = (
case
when d_dept.deptno = 10
then
select deptno
from d_dept
where dname = 'SALES'
else
d_dept.deptno
end
SQL>
ERROR at line 15:
ORA-01799: a column may not be outer-joined to a subqueryHow to resolve this issue?
Regards.And any luck with this?
SQL> with emp as
2 (select 100 empno, 'Abcd' ename, 1000 sal, 10 deptno from dual
3 union all
4 select 101 empno, 'RRR' ename, 2000 sal, 20 deptno from dual
5 union all
6 select 102 empno, 'KKK' ename, 3000 sal, 30 deptno from dual
7 union all
8 select 103 empno, 'PPP' ename, 4000 sal, 10 deptno from dual
9 )
10 ,dept as
11 (select 10 deptno, 'FINANCE' dname from dual
12 union all
13 select 20 deptno, 'SALES' dname from dual
14 union all
15 select 30 deptno, 'IT' dname from dual
16 union all
17 select 40 deptno, 'HR' dname from dual
18 )
19 select e.empno, e.ename, e.sal, d.deptno, d.dname
20 from emp e,
21 (select decode(a.deptno, 10, b.deptno, a.deptno) deptno, decode(a.deptno, 10, b.dname, a.dname) dname
22 from dept a, (select deptno, dname
23 from dept
24 where dname = 'SALES'
25 ) b
26 ) d
27 where e.deptno(+) = d.deptno
28 /
EMPNO ENAM SAL DEPTNO DNAME
101 RRR 2000 20 SALES
101 RRR 2000 20 SALES
102 KKK 3000 30 IT
40 HR
SQL> Cheers
Sarma. -
How to maintain version in ERwin Data Modeler
Hi all
Please tell me
how to maintain version in ERwin Data Modeler
regardsIn SharePoint, navigate to the form library, and then click Library Tools > Library > Settings > Library Settings.
On the Form Library Settings page under General Settings, click
Versioning settings.
On the Versioning Settings page under the Document Version History section, select either the
Create major versions option or the Create major and minor (draft) versions option, and click
OK.
http://www.bizsupportonline.net/blog/2012/10/version-control-infopath-forms-templates-sharepoint-libraries/
Or
plan this wsp nfoPath_VersionHistory.wsp
http://infopathversioning.codeplex.com/ -
How to find out last update date for business partner's marketing attribute
How to find out last update date for business partner's marketing attribute??
Im freshie for SAP Application and im assigned to find out last update date for marketing attribute changed
which table is involved??
Yours kindness will be appreciated
thanksYou can take a look at table AUSP as well as CRMD_AUSP_HIST.
The "changed by" and "changed at" are logged on attribute level, not on attribute value level. When you change one specific value, the system does a "re-insert" of all existing values of this attribute.
Take a look at the SAP notes 938426 and 966670 these may assit you in resolving the issue.
Regards,
William Laverde -
SQL Developer Data Modeler Viewer - domain datatypes
I'm using the SQL Developer Data Modeler Viewer (that comes free with SQL Developer) to view a model that was created in Oracle SQL Developer Data Modeler (the chargeable product). The colums have all been defined using domain datatypes. I have an XML file defining the domains but I cannot see where in the viewer you can import a domian file into or where in the model's directory structure the file can be placed to be read by the viewer. Without this the columns are all showing as datatype 'Unknown'.
Any help much appreciated, thanks.two set of domains can be maintained in Data Modeler:
- per installation - they are in file defaultdomains.xml in "datamodeler\domains" directory
- per design - they are in "domains" directory under your design directory -
"Per installation" domains are used in your case - "per design" domains are "attached" to design - when you send the design to someone else, they are in design structure.
Your solution - to get defaultdomains.xml file from installation where design is created and to put it in your "datamodeler\domains" directory.
Philip -
30EZ2 - Strange message from Data Modeler Viewer.
I am getting a strange message from Data Modeler Viewer when I try to shutdown SQLDeveloper.
I have not used data model viewer, but on shutting down sqldevloper I get
Oracle SQL Developer Data Modeler Viewer is waiting for tasks that should finish, such as writing files.As reported in 30EA2: Data Modeler Viewer annoyance when exiting
The team has yet to respond.
Regards,
K. -
30EA2: Data Modeler Viewer annoyance when exiting
Hi,
Almost always when exiting sqldev, I'm prompted with a dialog stating the 'Data Modeler Viewer is waiting for tasks that should finish, such as writing files', being able to Wait or Exit now. In the Log, I get an entry 'Delete Design: "Untitled_1"'.
Please make sure to clean up correctly before prompting such a dialog.
Thanks,
K.Hi,
I can confirm this is happening on me too.
I am confused, since I didn't invoke Data Modeler Viewer, yet the prompt appears just before prompting to Save the modified Worksheet.
This probably a minor bug, but hopefully to be addressed, since it is quite confusing.
Regards,
Buntoro -
Left outer join using date range returns too many rows
I am trying to pull data for a website.
Names table:
company_name varchar2(30)
julian_day varchar2(3)
logins number(3)
login_errors number(3)
Given a julian date range (e.g. 250-252), I am displaying the information from the Names table.
The problem is that I also need to display changes (increases/decreases) in the data. I do that by coloring the text based on a 10% increase/decrease. Data for the 3 days 250-252 would be compared to data for the previous 3 days 247-249.
Not all companies will report data on all days, so some gaps in the data may exist. Therefore, I cannot do just a simple join.
I am trying to write a query that will give me this information if the user chooses days 250-252.
Company_name
sum(logins) for days 250-252
sum(login_errors) for days 250-252
sum(logins) for days 247-249
sum(login_errors) for days 247-249
The query I'm using is:
select cur.company_name, sum(cur.logins),
sum(cur.login_errors), sum(old.logins), sum(old.login_errors)
FROM names cur LEFT OUTER JOIN names old
ON cur.company_name = old.company_name
WHERE cur.adate>='250' and cur.adate<='252'
and old.adate>='247' and old.adate<='249'
GROUP by cur.company_name
Given this data:
Company_name adate logins login_errors
ABC 247 10 10
ABC 248 20 20
ABC 249 30 30
ABC 250 15 15
ABC 251 25 25
ABC 252 35 35
My problem is that it returns:
adate cur.logins cur.login_err old.logins old.login_err
250 15 15 60 60
251 25 25 60 60
252 35 35 60 60
How can I get it to only give me the one "old" day's data? I went with the LEFT OUTER JOIN because it's possible that there is no data for an "old" day.
Thanks in advance.....Your problem stems from the join itself, and would be the same even without the OUTER JOIN. With your data, there are 3 records in cur and 3 records in old. The join matches each record in cur to each record in old resulting in 9 records in total. Without the SUM, this is clear:
SQL> SELECT cur.company_name, cur.logins, cur.login_errors,
2 old.logins, old.login_errors, cur.adate cad, old.adate oad
3 FROM names cur LEFT OUTER JOIN names old
4 ON cur.company_name = old.company_name
5 WHERE cur.adate>=250 and cur.adate<=252 and
6 old.adate>=247 and old.adate<=249;
COMPANY_NA LOGINS LOGIN_ERRORS LOGINS LOGIN_ERRORS CAD OAD
ABC 35 35 10 10 252 247
ABC 25 25 10 10 251 247
ABC 15 15 10 10 250 247
ABC 35 35 20 20 252 248
ABC 25 25 20 20 251 248
ABC 15 15 20 20 250 248
ABC 35 35 30 30 252 249
ABC 25 25 30 30 251 249
ABC 15 15 30 30 250 249
9 rows selected.You can do this with only one reference to the table.
SELECT company_name,
SUM(CASE WHEN adate BETWEEN 250 and 252 THEN logins ELSE 0 END) curlog,
SUM(CASE WHEN adate BETWEEN 250 and 252 THEN login_errors ELSE 0 END) curerr,
SUM(CASE WHEN adate BETWEEN 247 and 249 THEN logins ELSE 0 END) oldlog,
SUM(CASE WHEN adate BETWEEN 247 and 249 THEN login_errors ELSE 0 END) olderr
FROM names
WHERE adate BETWEEN 247 and 252
GROUP BY company_nameHTH
John
Maybe you are looking for
-
Variables are not displaying in a order in a query
Hi friends, I have 4 vaiables in my query.. i want to dispaly those variables in a particular order.. for example.. i want to display 1. Country , 2. State , 3. City , 4. Street.. like this order.. but my Query was displaying in a disorder..
-
Urgent : InfoCube/Dimension
Step 1 : In development box, the Cube was empty and did the few changes as below From Dimension1 (already have 4 characteristics) Deleted 3 characteristics from InfoCube via remodeling toolboox - Check the scheduled conversion and it was successful
-
Anybody have any luck publishing with FTPS? I am able to publish via ftp to a filezilla server but am unable with FTPS. I get a "not logged in" error on filezilla. I am using the exact same workflow. I change from ftp to ftps and it does not work. An
-
Dreamweaver CS6 - Guidelines in code view
Hello, Is there any extension/plugin that allows to make similar view like in Notepad++? Example: http://screenshu.com/static/uploads/temporary/ed/aq/w0/xtgy6g.jpg I mean those vertical guidelines + selecting closing tag that selects also opening tag
-
Measuring AC voltage in Labview 8.5
I have all my channels set up fine in MAX and the hardware is working correctly. I'm trying to measure the power as a function of voltage and resistance but my voltage is ac and I'm not sure how to get a single value through the vis. When I try usi