Outer join trouble in Oracle 8i
Hello
I'm trying to join two tables - one with account information, and one with transaction information.
For each account I want to find the latest transaction date. -If any transactions of the specified types...
If all accounts had one or more transactions of the types I want, there would be no problem..
select a.account_id, max(t.transaction_date)
from accounts a, transactions b
where t.transaction_code in (0,1,2,3,4,5,7,8)
and a.account_id = t.account_id
group by a.account_id;
How do I do it since I also want to see the accounts
without any transactions?
Cannot use the outer join (+) - since my sql-query
contains the keyword 'in' ('or' gave the same result)..
ORA-01719.
Sissel
Have you tried in-line query
Select A.account_id, T.Max_Trans_Date
from Accounts A,
(select account_id, max(transaction_Date) Max_Trans_date
from Transactions
where Transaction_Code in (0,1,2,3,4,5,7,8)
group by Account_Id) T
where A.Account_Id = X.Account_Id(+)
Similar Messages
-
Left outer join Bug? Oracle 11 g.
Hi , I am facing a strange problem in oracle 11 g .
I have a select query like this
Query 1 :
Select A.name, B.name, C.name from A Left outer join B on A.id = B.id left outer join C on b.id = c.id and (Some complex condition) left outer join D on C.id = D.id;
A, B, C, D are tables.
(Assume that I have data which satisfies the above join conditions)
However I am not getting C.name in the result. Getting NULL in C.name.
Now if I add a where clause to the above query like the following Query 2 then I get C.name in the results
Consider that there is a field called field1 in table C and the value of field1 is ‘xyz’ for all the rows of table C .
Query 2 :
Select A.name, B.name, C.name from A Left outer join B on A.id = B.id left outer join C on b.id = c.id and (Some complex condition) left outer join D on C.id = D.id where c.field1 = ‘xyz’;
I find this strange , What role where clause is playing ? Why I get C.name only after adding where clause.
I also tried following setting with Query 1 however this also did not help me.
alter session set "_optimizer_join_elimination_enabled"=false;
Is oracle does some optimization if no where clause is specified ? Is this a bug?
Please help me out.
Thanks,
Sumit874384 wrote:
...Is this a bug? Maybe. Maybe not. Really difficult to say based on your description. However, if you suspect a bug, then raise a ticket to the support including much more information (e.g. version 11.x.x.x, define "some condition" and so on).
Nicolas. -
OJ syntax for multi-table left outer join with MS Oracle Driver
I have a multi-table left outer join that works fine in SQL Server ODBC Driver, Oracle ODBC driver 8.01.07.00, but not with Microsoft ODBC Driver for Oracle 2.573.7326.0
SELECT * from { oj A LEFT OUTER JOIN B ON A.col1 = B.col1 LEFT OUTER JOIN C ON A.col1 = C.col1 }
I noticed someone had a similar problem (the proposed solution doesn't work):
http://www.justpbinfo.com/listarchive/msg02874.html
Does anyone know how to get this working with the Microsoft ODBC Driver for Oracle? Or does it just not work?The Microsoft ODBC Driver for Oracle 2.573.7326.0 does perform the same 'fix up' with {oj} in Oracle 8i. The problem is that it doesn't work when joining more than two tables:
This works:
SELECT * from { oj A LEFT OUTER JOIN B ON A.col1 = B.col1}
This doesn't work:
SELECT * from { oj A LEFT OUTER JOIN B ON A.col1 = B.col1 LEFT OUTER JOIN C ON B.col1 = C.col1 }
(The second query will work with the Oracle Oracle ODBC driver, with a bit of tweaking. But I haven't found a way to get it to work with the Microsoft ODBC Driver for Oracle 2.573.7326.0. My suspicion is that it just doesn't work.)
Gavin -
Problem with outer joins and the class indicator/discriminator
Hello,
I am having a problem defining a query in toplink (10.1.3.3).
In the workbench, I have created a parent and 2 child descriptors. The parent is "AbstractValue", the children are "DefaultValue", classified by the discriminator 'DEF', and "OverrideValue", classified by 'OVR', both located in the same table.
Another descriptor (containing a one-on-one mapping to both a "DefaultValue", and a "OverrideValue") needs to be queried for its 'value'.
The way the query should act is: If an override value (row) exists, this one applies for that object. If an override doesn't exist, return the default value.
The query then comes down to (as I have it now):
builder.getAllowingNull("OverrideValue").getAllowingNull("value").ifNull(builder.get("DefaultValue").get("value")).equal(builder.getParameter(VALUE_PARAM));
The problem is that toplink adds the distinction for the different kind of "values" in the where clause WITHOUT checking for null values e.g. it performs an outer join, but then still checks for the discriminator value thus
....t1.ovr_id = t2.id(+) AND t2.discriminator = 'OVR' AND ...
instead of
... LEFT JOIN values t2 ON (t1.ovr_id = t2.id AND t2.discriminator = 'OVR') ...
This leads to the behaviour that the query returns ONLY the objects that have override and default values.
An overview of the queries (simplified)
Toplink, at the moment, returns only results if both override and default values exists:
SELECT t1.id
t1.def_id,
t1.ovr_id
FROM values t2,
parameter t1,
values t0
WHERE nvl(t2.value, t0.value) = 15 AND
t1.ovr_id = t2.id(+) AND t2.discriminator = 'OVR' AND
t1.def_id = t0.id AND t0.discriminator = 'DEF'
Situation Wanted:
SELECT t1.id
t1.def_id,
t1.ovr_id
FROM parameter t1
LEFT JOIN values t2 ON (t1.ovr_id = t2.id AND t2.discriminator = 'OVR')
JOIN values t0 ON (t1.def_id = t0.id AND t0.discriminator = 'DEF')
WHERE nvl(t2.value, t0.value) = 15
Anyone know if there is some statement I am missing to allow an actual outer join on descriptors containing class indicators/discriminators? A possible rewrite?
Thanks in advance,
RudyThis is a bug in TopLink's outer join support for Oracle. Currently the outer join is put in the where clause, instead of the from clause, as we do on other platforms. You might be able to fix it by changing your OraclePlatform to return false for shouldPrintOuterJoinInWhereClause().
Please log this bug on EclipseLink, or through Oracle technial support.
There is a workaround using,
descriptor.getInhertiancePolicy().setAlwaysUseOuterJoinForClassType(true);
James : http://www.eclipselink.org -
Greetings Gurus,
I'm getting an ORA-22905 when I try and do a full outer join in the following function. If I include the commented lines in the perstren_diff_recs2 function I get the error. Both halfs of the union query work by themselves. When I union them bam error. Also, when I use the full outer join syntax the Oracle session craps the bed with a end of file communication error. That is why I'm using the simulated full outer join.
My goal was to abstract the XML in my queries. The results from the pipelined function is a delta between what is in the XML document and a relational base table.
Derrick
CREATE OR REPLACE PACKAGE XML_UTILS is
TYPE perstren_typ is record (
uic varchar2(6),
tpers varchar2(2),
deply varchar2(6),
secur varchar2(1),
struc number(4),
auth number(4)
TYPE perstren_diff_typ is record (
uic varchar2(6),
transaction_type char(1),
tpers varchar2(2),
deply varchar2(6),
secur varchar2(1),
struc number(4),
auth number(4)
TYPE perstrenSet is table of perstren_typ;
TYPE perstrenDiffSet is table of perstren_diff_typ;
function perstren_recs (uic varchar2) return perstrenSet pipelined;
function perstren_diff_recs2 (uic varchar2) return perstrenDiffSet pipelined;
end;
CREATE OR REPLACE PACKAGE BODY XML_UTILS is
function perstren_diff_recs2 (uic varchar2) return perstrenDiffSet pipelined is
cursor perstren_recs_cur(in_uic varchar2) is
select p.uic, p.tpers, p.deply, P.secur, p.struc,p.auth,
doc.uic as xmluic,
doc.tpers as xmltpers,
doc.deply as xmldeply,
doc.secur as xmlsecur,
doc.struc as xmlstruc,
doc.auth as xmlauth
from perstren_bac p left outer join
table(xml_utils.perstren_recs(in_uic)) doc
on (p.uic = doc.uic and
p.tpers = doc.tpers and
p.deply = doc.deply)
where p.uic = in_uic;
-- union
-- select p.uic, p.tpers, p.deply, P.secur, p.struc,p.auth,
-- doc.uic as xmluic,
-- doc.tpers as xmltpers,
-- doc.deply as xmldeply,
-- doc.secur as xmlsecur,
-- doc.struc as xmlstruc,
-- doc.auth as xmlauth
-- from perstren_bac p right outer join
-- table(xml_utils.perstren_recs(in_uic)) doc
-- on (p.uic = doc.uic and
-- p.tpers = doc.tpers and
-- p.deply = doc.deply)
-- where doc.uic = in_uic;
out_rec perstren_diff_typ;
begin
for cur_rec in perstren_recs_cur(uic) loop
if cur_rec.xmldeply is not null and cur_rec.xmltpers is not null then
out_rec.uic := cur_rec.xmluic;
out_rec.tpers := cur_rec.xmltpers;
out_rec.deply := cur_rec.xmldeply;
out_rec.secur := cur_rec.xmlsecur;
out_rec.struc := cur_rec.xmlstruc;
out_rec.auth := cur_rec.xmlauth;
else
out_rec.uic := cur_rec.uic;
out_rec.tpers := cur_rec.tpers;
out_rec.deply := cur_rec.deply;
out_rec.secur := cur_rec.secur;
out_rec.struc := cur_rec.struc;
out_rec.auth := cur_rec.auth;
end if;
if cur_rec.uic is not null and cur_rec.xmldeply is not null and cur_rec.xmltpers is not null and (
nvl(cur_rec.secur,'XX') != nvl(cur_rec.xmlsecur,'XX') or
nvl(cur_rec.struc,9999) != nvl(cur_rec.xmlstruc,9999) or
nvl(cur_rec.auth,9999) != nvl(cur_rec.xmlauth,9999)) then
out_rec.transaction_type :='U';
elsif cur_rec.uic is null and cur_rec.xmldeply is not null then
out_rec.transaction_type :='I';
elsif cur_rec.uic is not null and cur_rec.xmldeply is null then
out_rec.transaction_type :='D';
else
out_rec.transaction_type :='O';
end if;
PIPE row (out_rec);
end loop;
exception
when others then
if perstren_recs_cur%isopen then
close perstren_recs_cur;
end if;
raise;
return;
end;
function perstren_recs (uic varchar2) return perstrenSet pipelined is
cursor perstren_recs_cur(in_uic varchar2) is
select uic,
extractvalue(Column_value,'/PERSTREN/TPERS') as TPERS,
extractvalue(Column_value,'/PERSTREN/DEPLY') as DEPLY,
extractvalue(Column_value,'/PERSTREN/SECUR') as SECUR,
extractvalue(Column_value,'/PERSTREN/STRUC') as STRUC,
extractvalue(Column_value,'/PERSTREN/AUTH') as AUTH
from test_ref ref,
table(XMLSequence(extract(ref.XML_DOC,'/RasDataSet/PerstrenList/PERSTREN'))) per
where ref.uic = in_uic;
out_rec perstren_typ;
begin
open perstren_recs_cur(uic);
loop
fetch perstren_recs_cur into out_rec;
exit when not perstren_recs_cur%FOUND;
PIPE row (out_rec);
end loop;
close perstren_recs_cur;
exception
when others then
if perstren_recs_cur%isopen then
close perstren_recs_cur;
end if;
raise;
return;
end;
end;Oracle bug when executing the query in a function
-
Oracle OUTER JOIN on more than one table
Hi!
Friends, please help with this urgent problem: How can an outer join be written on more than one table?
An SQL Server query:
SELECT * from a INNER JOIN b on a.id = b.id LEFT OUTER JOIN c ON c.id = a.id AND c.id = b.id
works fine with SQL SERVER
But Oracle query:
SELECT * from a,b,c WHERE a.id = b.id AND a.id = c.id (+) AND b.id = c.id (+)
gives an error: OUTER JOIN cannot be used on more than one table? Why?
I use OracleDriver from classes12.zip to connect to Oracle8i database.
Please, help!The Oracle 8i and later SQL reference reads that the following "join_types" are supported and under this syntax it does not limit the LEFT OUTER JOIN (syntax the same as SQLServer example in original note) to two tables as implied in these notes:
The join_type indicates the kind of join being performed:
Specify INNER to indicate explicitly that an inner join is being performed. This is the default.
Specify RIGHT to indicate a right outer join.
Specify LEFT to indicate a left outer join.
Specify FULL to indicate a full or two-sided outer join. In addition to the inner join, rows from both tables that have not been returned in the result of the inner join will be preserved and extended with nulls.
You can specify the optional OUTER keyword following RIGHT, LEFT, or FULL to explicitly clarify that an outer join is being performed. -
Translating SQL from MYSQL to ORACLE with more than one outer join.
I will translate the following sqlquery from MYSQL to ORACLE:
SELECT ticket.ticket_no,ticket.ticket_dato,ticket.ticket_subject,ticket.customer_id,customer_name,ticket.ticket_own_read, ticket.department_id, department.department_name, priority_name, tickstat_name, tickettype_name
FROM customer, ticket left join department
on ticket.department_id = department.department_id left join priority on ticket.priority_id = priority.priority_id
left join ticketstatus on ticket.tickstat_id = ticketstatus.tickstat_id
left join tickettype on ticket.tickettype_id = tickettype.tickettype_id
where ticket.customer_id = customer.customer_id and customer.owner_id =
#session.owner_id#
I have tried in ORACLE with:
SELECT ticket.ticket_no,ticket.ticket_dato,ticket.ticket_subject,ticket.customer_id,customer_name,ticket.ticket_own_read, ticket.department_id, department.department_name, priority_name, tickstat_name, tickettype_name
FROM customer, ticket ,department, priority, ticketstatus, tickettype
where
ticket.department_id(+) = department.department_id and
ticket.priority_id(+) = priority.priority_id and
ticket.tickstat_id(+) = ticketstatus.tickstat_id and
ticket.tickettype_id(+) = tickettype.tickettype_id and
ticket.customer_id = customer.customer_id and customer.owner_id = #session.owner_id#
I get an error:
MERANT][ODBC Oracle driver][Oracle]ORA-01417: a table may be outer joined to at most one other table
How do I translate the code to ORACLE?I think that your syntax is wrong. The (+) operator should be on the right hand table column, not the left hand table column if you want all rows on the left hand table column. If this syntax is really what you want, you can create underlying views for each join condiction.
-
How to use OUTER JOIN in Oracle Answers Filters?
Hi, I need to have a filter on an 'Oracle Answers' report.
The query from the NQQuery.log appears as below. (I have simplified the SELECT clause here for easy reading)
SELECT t692.enquiry_business_route AS c1,
t692.enquiry_id AS c11, t913.YEAR AS c12,
t913.full_date AS c13, t666.surname AS c14,
t666.post_code AS c15, t855.company_name AS c16,
t983.notes AS c30
FROM
mkt_dw_enev_enhi_dim t983,
mkt_dw_key_partner_dim t855,
mkt_dw_event_type_dim t821,
mkt_dw_customer_dim t666,
mkt_dw_time_dim t913,
mkt_dw_enquiry_event_fact t692
WHERE (
t692.enquiry_id = t983.enqu_id
AND t666.customer_dim_key = t692.customer_dim_key
AND t692.event_date_time_key = t913.time_dim_key
AND TRUNC(t983.event_date)= t913.FULL_DATE
AND t692.event_type = t821.event_type_dim_key
AND t692.key_partner_dim_key = t855.key_partner_dim_key
AND t821.event_type_category = 'RECEIVE_FEE'
AND t913.YEAR = 2009
and t692.enquiry_id = 535986
For the following two lines I would like to have the OUTER JOIN.
AND t692.event_type = t821.event_type_dim_key(+)
AND t821.event_type_category(+) = 'RECEIVE_FEE' (THIS IS THE FILTER CONDITION, AT THE MOMENT IT DOESN'T WORK WITH OUTER JOIN SYMBOL)
Please could you let me know the best way of achieving the above.
Thanks
SrikanthIn the BMM layer in the join condition you will be able to specify the join to be (left, right or full outer join).
You can even add the required table in the LTS(logical table source) and also specify a left, right or full outer join there as well.
There is an interesting work around as mentioned in the below blog to get to the Outer join results with out changing anything in rpd but in Answers.
http://obiee101.blogspot.com/2008/11/obiee-outerjoin-workaround.html
Hope it helps
Thanks
prash -
Multiple Outer join in ORACLE 8.1.6
Hi ,
Can anybody suggest me how can i use multiple outer join on one table. I'm using ORACLE 8.1.6.
I know this version of oracle doesnt support this. But is there anmy other wa\y I can achieve this.
Thanks amd Regards
DeependraTricky question - but I went through this about 3 months ago, and found a good thread on here that explains it pretty well.
check out Re: Outer join a table with two diff table
You basically will have to create an inline view with one outer join in there, and then a second outer join on the outside. Read through the posts in that thread and it should help! -
Oracle.jbo.RowAlreadyDeletedException with outer join
Hi,
I have created a VO, based on an EO, with an outer join present.
The first time I query my data (search) everything goes well, but when I perform a search the second time, I receive the error message: "oracle.apps.fnd.framework.OAException: oracle.jbo.RowAlreadyDeletedException: JBO-25019: Entiteitsrij van sleutel oracle.jbo.Key[202 53162 ] not found in XxpostMmpParametersEO."
The reason why is because of the outer join there is no 1 to 1 relationship between the EO and the VO. However for the first time , it works fine.
Does someone have an idea how I can avoid the error for my second search action?
Thanks in advance!
br
GuyHi all,
the following article:
http://radio.weblogs.com/0123729/stories/2003/05/15/entityObjectOverTableWhosePrimaryKeyMayBeNull.html
suggest a possible workaround. It wok fine, but it is not generic! :((
By
Alessandro -
Outer join query for SQL server from Oracle
Hi All,
My question is regarding making queries from Oracle to SQL Server database thorugh DBLink.
In my oracle database I have a DBLink emp.world for SQL Server database.
I need to query SQL Server data from oracle (so that this query can be combined with other oracle tables).
Query is given below:
SELECT
a."EmpID" as "Employee ID",
a."EmpStatus" "Employee Status"
b."EmpSub" as "Employee Subjects"
FROM
[email protected] a
left outer join [email protected] b on a."EmpID" = b."suEmpID"
ORDER BY a."EmpID";My problem is when I run the same query from oracle, it does not show the EmpID that does not exist in Subjects table, but when run from actual SQL Server database, it shows all the records.
Samples are given below:
Run from Oracle
Employee ID Employee Status Employee Subjects
101 Active Maths
102 Active Maths
102 Active Physics
104 Inactive Chemistry
Run form SQL Server
Employee ID Employee Status Employee Subjects
101 Active Maths
102 Active Maths
102 Active Physics
103 Active NULL
104 Inactive ChemistryI am not sure why in oracle outer join for SQL server tables is not working. What is the right way for outer join in this case.
I am using oracle database 10gR2 and SQL Server 2005.
Please Help.
Thanks.SELECT
a."EmpID" as "Employee ID",
a."EmpStatus" "Employee Status"
b."EmpSub" as "Employee Subjects"
FROM
[email protected] a
left outer join [email protected] b on a."EmpID" = b."suEmpID"
ORDER BY a."EmpID";
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm#sthref3175
From your description, it appears you may need a right outer join. You want to get back all the rows from 'B', not from 'A'. Try a right join and let us know. -
How to use outer join on 2 tables with Oracle 8i
Could anyone tell me the Oracle 8i syntax equivalent to :
select user.name, city.adress, contry.name
from user
left outer join city on (user.rCity = city.code)
left outer join country on (user.rCountry = country.code)
I tried following :
select user.name, city.adress, contry.name
from user, city, contry
where user.rCity (+) = city.code
and user.rCountry (+) = country.code
but displayed following error :
ORA-01417: a table may be outer joined to at most one other table
Thank youLogically I would expect a user to have a city and a country, or not. In that case the outer join should be on the other tables. Making your query:
select user.name, city.adress, country.name
from user, city, country
where user.rCity = city.code (+)
and user.rCountry = country.code (+); -
Oracle 8i -multiple LEFT OUTER JOIN
Hi,
I have to convert some stored procedure from Sql Server to Oracle 8i where I have multiple LEFT OUTER JOIN on a table. Because Oracle 8i accept only one outer join on a table how can I convert this:
select a.id, b.id
from test as a LEFT JOIN test1 b ON a.id(+)=b.id
and a.display(+)=b.display
and a.name(+)='Done';
Thanks.FROM test a LEFT JOIN test1 b ON b.key = a.keyis equivalent to
FROM test a, test1 b WHERE b.key(+) = a.keyThere is a restriction (when using the "(+)" syntax) that a table may be outer-joined to at most one other table, but that does not prevent you from having multiple join conditions between those two tables.
From your example I'm not sure whether you need this:
SELECT a.id, b.id
FROM test a
, test1 b
WHERE a.name = 'Done'
AND b.id (+)= a.id
AND b.display (+)= a.display;or this:
SELECT a.id, b.id
FROM test1 b
, test a
WHERE a.id (+)= b.id
AND a.display (+)= b.display;
WHERE a.name (+)= 'Done'; -
Oracle 11g - Nested loops on outer joins
Hello,
I have a select query that was working with no problems. The results are used to insert data into a temp table.
Recently, it would not complete executing. The explain plan shows a cartesian. But, there could be problems with using nested loops on the outer join. Interestingly, when I copy production code and rename the temp table and rename the view, it works.
Can someone take a look at the code and help. Maybe offer a suggestion on tuning too? Thanks.
CREATE TABLE "CT"
( "TN" VARCHAR2(30) NOT NULL ENABLE,
"COL_NAME" VARCHAR2(30) NOT NULL ENABLE,
"CDE" VARCHAR2(5) NOT NULL ENABLE,
"CDE_DESC" VARCHAR2(80) NOT NULL ENABLE,
"CDE_STAT" CHAR(1));
insert into CT (TN, COL_NAME, CDE, CDE_DESC, CDE_STAT)
values ('INDSD', 'STCD', 'U', 'RF', 'A');
insert into CT (TN, COL_NAME, CDE, CDE_DESC, CDE_STAT)
values ('AT', 'TCD', '001', 'RL', 'A');
insert into CT (TN, COL_NAME, CDE, CDE_DESC, CDE_STAT)
values ('AT', 'TCD', '033', 'PFR', 'A');
CREATE TABLE "IPP"
( "IND_ID" NUMBER(9,0) NOT NULL ENABLE,
"PLCD" VARCHAR2(5) NOT NULL ENABLE,
"CBCD" VARCHAR2(5));
insert into IPP (IND_ID, PLCD, CBCD)
values (2007, 'AS', '04');
insert into IPP (IND_ID, PLCD, CBCD)
values (797098, 'AS', '34');
insert into IPP (IND_ID, PLCD, CBCD)
values (797191, 'AS','04');
CREATE TABLE "INDS"
( "OPCD" VARCHAR2(5) NOT NULL ENABLE,
"IND_ID" NUMBER(9,0) NOT NULL ENABLE,
"IND_CID" NUMBER(*,0),
"GFLG" VARCHAR2(1),
"HHID" NUMBER(9,0),
"DOB" DATE,
"DOB_FLAG" VARCHAR2(1),
"VCD" VARCHAR2(5),
"VTDTE" DATE,
"VPPCD" VARCHAR2(4),
"VRCDTE" DATE NOT NULL ENABLE,
"VDSID" NUMBER(9,0),
"VTRANSID" NUMBER(12,0),
"VOWNCD" VARCHAR2(5),
"RCDTE" DATE,
"LRDTE" DATE
insert into INDS (OPCD, IND_ID, IND_CID, GFLG, HHID, DOB, DOB_FLAG, VCD, VTDTE, VPPCD, VRCDTE, VDSID, VTRANSID, VOWNCD, RCDTE, LRDTE)
values ('USST', 2007, 114522319, '', 304087673, to_date('01-01-1980', 'dd-mm-yyyy'), 'F', '2', to_date('06-04-2011 09:21:37', 'dd-mm-yyyy hh24:mi:ss'), '', to_date('06-04-2011 09:21:37', 'dd-mm-yyyy hh24:mi:ss'), 1500016, null, 'USST', to_date('06-04-2011 09:21:37', 'dd-mm-yyyy hh24:mi:ss'), to_date('18-07-2012 21:52:53', 'dd-mm-yyyy hh24:mi:ss'));
insert into INDS (OPCD, IND_ID, IND_CID, GFLG, HHID, DOB, DOB_FLAG, VCD, VTDTE, VPPCD, VRCDTE, VDSID, VTRANSID, VOWNCD, RCDTE, LRDTE)
values ('USST', 304087678, 115242519, '', 304087678, to_date('01-01-1984', 'dd-mm-yyyy'), 'F', '2', to_date('06-04-2011 09:21:39', 'dd-mm-yyyy hh24:mi:ss'), '', to_date('06-04-2011 09:21:39', 'dd-mm-yyyy hh24:mi:ss'), 1500016, null, 'USST', to_date('06-04-2011 09:21:39', 'dd-mm-yyyy hh24:mi:ss'), to_date('18-07-2012 21:52:53', 'dd-mm-yyyy hh24:mi:ss'));
CREATE TABLE "INDS_TYPE"
( "IND_ID" NUMBER(9,0) NOT NULL ENABLE,
"STCD" VARCHAR2(5) NOT NULL ENABLE);
insert into INDS_type (IND_ID, STCD)
values (2007, 'U');
insert into INDS_type (IND_ID, STCD)
values (313250322, 'U');
insert into INDS_type (IND_ID, STCD)
values (480058122, 'U');
CREATE TABLE "PLOP"
( "OPCD" VARCHAR2(5) NOT NULL ENABLE,
"PLCD" VARCHAR2(5) NOT NULL ENABLE,
"PPLF" VARCHAR2(1));
insert into PLOP (OPCD, PLCD, PPLF)
values ('USST', 'SP', 'Y');
insert into PLOP (OPCD, PLCD, PPLF)
values ('PMUSA', 'ST', '');
insert into PLOP (OPCD, PLCD, PPLF)
values ('USST', 'RC', '');
CREATE TABLE "IND_T"
( "OPCD" VARCHAR2(5) NOT NULL ENABLE,
"CID" NUMBER(9,0) NOT NULL ENABLE,
"CBCD" VARCHAR2(5),
"PF" VARCHAR2(1) NOT NULL ENABLE,
"DOB" DATE,
"VCD" VARCHAR2(5),
"VOCD" VARCHAR2(5),
"IND_CID" NUMBER,
"RCDTE" DATE NOT NULL ENABLE
insert into IND_T (OPCD, CID, CBCD,PF, DOB, VCD, VOCD, IND_CID, RCDTE)
values ('JMC', 2007, '04', 'F',to_date('11-10-1933', 'dd-mm-yyyy'), '2', 'PMUSA', 363004880, to_date('30-09-2009 04:31:34', 'dd-mm-yyyy hh24:mi:ss'));
insert into IND_T (OPCD, CID, CBCD,PF, DOB, VCD, VOCD, IND_CID, RCDTE)
values ('JMC', 2008, '04', 'N',to_date('01-01-1980', 'dd-mm-yyyy'), '2', 'PMUSA', 712606335, to_date('05-04-2013 19:36:05', 'dd-mm-yyyy hh24:mi:ss'));
CREATE TABLE "IC"
( "CID" NUMBER(9,0) NOT NULL ENABLE,
"CF" CHAR(1));
insert into IC (CID, CF)
values (2007, 'N');
insert into IC (CID, CF)
values (100, 'N');
insert into IC (CID, CF)
values (200, 'N');
CREATE OR REPLACE FORCE VIEW "INDSS_V" ("OPCD", "IND_ID", "IND_CID", "GFLG", "HHID", "DOB", "DOB_FLAG", "VCD", "VTDTE", "VPPCD", "VRCDTE", "VDSID", "VTRANSID", "VOWNCD", "RCDTE", "LRDTE") AS
SELECT DISTINCT a.OPCD, a.IND_ID, a.IND_CID, a.GFLG, a.HHID,
a.DOB, a.DOB_flag, a.VCD, a.VTDTE,
a.VPPCD, a.VRCDTE, a.VDSID, a.VTRANSID,
a.VOWNCD, a.RCDTE, a.LRDTE
FROM INDS a, INDS_type b
WHERE a.IND_ID = b.IND_ID
AND b.STCD in (select CDE
from CT --database link
where TN = 'INDSD'
and COL_NAME = 'STCD'
and CDE_STAT = 'A') ;
--insert /*+ parallel(IND_T,2) */ into IND_T
select /*+ parallel(a,4) */
a.OPCD as OPCD
, a.IND_ID as CID
, b.CBCD as CBCD
, NULL as BFCD
, 'N' as PF
, a.DOB as DOB
, a.VCD as VCD
, a.VOWNCD as VOCD
, a.IND_CID as IND_CID
, a.RCDTE as RCDTE
from INDSS_V a
, (select /*+ parallel(IPP,4) */ * from IPP IPP , PLOP PLO
where plo.PLCD = ipp.PLCD
and PPLF='Y') b
, IC c
where a.IND_ID = b.IND_ID (+)
and a.OPCD = b.OPCD (+)
and a.IND_ID = c.CID
and c.CF = 'N';Please consult
HOW TO: Post a SQL statement tuning request - template posting
Also format your code and post it using the [ code ] and [ /code ] tags. (Leave out the extra space after [ and before ])
Sybrand Bakker
Senior Oracle DBA
Edited by: sybrand_b on 10-apr-2013 17:57 -
Post Author: wtfinc
CA Forum: Data Connectivity and SQL
After upgrading to Oracle 9i, the SQL queries generated by Crystal Reports XI contain a syntax errors when performing Outer Joins. The particular error returned by Oracle is "Old Style Outer Join can not be used with ANSI Joins". Does anyone know a work around short of changing the datbase connection to a command and rewriting the report?Post Author: Jagan
CA Forum: Data Connectivity and SQL
If you choose SQL Query from Crystal's Database menu, does the SQL have a combination of old and new syntax?
Maybe you are looking for
-
Touch Screen unresponsive after iOS 8 update
My 1 year old 64GB iPhone 5 touch screen started to become unresponsive after iOS 8 update It's not consistent. Touch screen functionality will seize whilst phone is being used for either answering calls, typing messges, surfing, gaming etc and won't
-
Since updating Firefox browser, i am unable to gain access to my yahoo email account. I can access the email with Interent Explorer with no trouble. Whenever I click on a mail link on the yahoo sites to check my mail, I get rerouted to an error page
-
Help in FM 'FILE_GET_NAME_USING_PATH'.
Hi, I have to upload data in a flat file from the internal table to the application server.I am trying to use the FM 'FILE_GET_NAME_USING_PATH' to get the phiysical file path for upload into the application server.The FM is giving an error that 'defi
-
Diagnostic Mode: How can you tell if the scan disk is working?
I put my ipod into diagnostic mode and went to the scan hard drive utility. The problem is that does not seem to be working. I get the following message: Read Verify Scan Scan takes a while Before Scan: Start Scan- Does that mean the scan is in proce
-
For the past two days my iphone 4S has been crashing every app and cutting out while I'm talking I did a factory reset but it's still doing it HELP