The requirement is to replicate the bu_id records with bu_id=0 as bu_id=414545 ( there is no lookup available) so the same table should act as a lookup table to populate bu_id for the records where bu_id=0
i.e., here it will replicate for the sku set with bu_id value=0
select a.ccn,b.bu_id,a.sku,b.sku
from test_item_bu_id a ,
( select distinct ccn,sku_num, bu_id
from test_item_bu_id
where bu_id in (414545) and CCN in ('M10000') ) b
where a.bu_id = 0 and a.sku <> b.sku and a.ccn= b.ccn
How can we avoid the last record, i.e., SKU=600-11437 since it is already having bu_id no need to replicate it, but it is getting replicated since the extra record with bu_id=0 exist for the same sku.
must generate a Cartesian join, but I do not know why it happens. dt.debtorkey, cl.clientkey, inv.invoicekey, ag.agingkey are primary keys of each table. The problem is: I got same tuple for 8 times.
Having production system: 11.2.0.1 on Windows Server x64 Test system: 9.2.0.1 on Windows XP
Problem preface: to get all unique CASEID which should be checked up by biometric system.What i should check - all CASEs for different PERSONs having same PHONEs at least among one phone type (1..4).Real table contains little bit more than 10 million records.I made test scripts.
Below the DDL for test table creation: ------------------------------------------ -- Create CASEINFO test table ------------------------------------------ DROP TABLE CASEINFO; CREATE TABLE CASEINFO
[code]...
Below i've put SQL/DLL to make test data.number of records inserted 2 millions. PERSON_COUNT := #/8; ------------------------------------------ -- fill CASEINFO with sample data ------------------------------------------ DECLARE I INTEGER;
[code]...
Below SQL select to check the data in created table. ------------------------------------------ -- Check test data counters ------------------------------------------ SELECT 'TOTAL',count(*) from CASEINFO UNION ALL SELECT 'LEGAL',count(*) from CASEINFO where
[code]...
The PROBLEM is that i am experiencing HUGE perfomance problems on both test and production systems with that query:
select distinct b.caseid from CASEINFO a, CASEINFO b where (a.person<>b.person) and (a.sex=b.sex) and ( (a.phone1=b.phone1) or (a.phone1=b.phone2) or (a.phone1=b.phone3) or
[code]...
This query takes almost 90 minutes to execute.And i do not know how to avoid this.Full SQL file to make test attached.
I was practicing on Recursive Subquery Factoring based on oracle examples available in the documentation URL....I was working on an example which prints the hierarchy of each manager with his/her related employees. Here is how I proceed.
WITH tmptab(empId, mgrId, lvl) AS ( SELECT employee_id, manager_id, 0 lvl FROM employees WHERE manager_id IS NULL UNION ALL SELECT employee_id, manager_id, lvl+1 FROM employees, tmptab WHERE (manager_id = empId) [code]....
107 rows selected.
SQL> However, by accident, I noticed that if instead of putting a comma between the table names I put CROSS JOIN, the very same query behaves differently.That is, if instead of writing
UNION ALL SELECT employee_id, manager_id, lvl+1 FROM employees, tmptab WHERE (manager_id = empId)I write . . . UNION ALL SELECT employee_id, manager_id, lvl+1 FROM employees CROSS JOIN tmptab WHERE (manager_id = empId)I get the following error message ERROR at line 4: ORA-32044: cycle detected while executing recursive WITH query
I remember, oracle supports both comme notation and CROSS JOIN for Cartesian product (= cross product). For example
SQL> WITH tmptab1 AS 2 ( 3 SELECT 'a1' AS colval FROM DUAL UNION ALL 4 SELECT 'a2' AS colval FROM DUAL UNION ALL 5 SELECT 'a3' AS colval FROM DUAL 6 ), [code]....
SQL> So if both comma notated and CROSS JOIN have the same semantic, why I get a cycle for the above mentioned recursive subquery factoring whereas the very same query works pretty well with comma between the table names instead of CROSS JOIN? Because if a cycle is detected (ancestor = current element) this means that the product with CROSS JOIN notation is generating some duplicates which are absent in the result of the comma notated Cartesian product.
The attachment contains the table info. The condition is that when there are childer for the master ,the master record shd be negated . Excuse me if this very easy. Example -DEL HAS children so the record with DEL and DEL SHD not be in the result query. Example -RAG HAS NO children. so the MASTER record should be taken.
we just installed the patch 10.0.2.0.5 on a 10.0.2.0.3 database and some selects didn't work as before. While changing the select clause, there are different counts.
There are 3 tables:
Detail_1 => MASTER_1 <= Detail_2
MASTER_1 has a primary and an unique Key. The 2 detail tables have FK. Now when selecting only columns from the detail tables (joined with master) we get cartesian selects. If i use one column of the master table in the select clause everything is fine.
I have 8 databases in multi master replication. I need to replicate only one rep object in to master sites. But I have 8 rep objects in the master definition site. is it possible to replicate the required rep object only without bringing the other rep objects in to replication.
I have a SQL statement that returns a set of columns...but...when I create table as <SQL statement> I get the same columns but with 2 of the columns containing each others data, e.g:
The SQL Select is correct and the Create Table As <SQL Select> is wrong.
Here is my SQL:
Create table ALTERNATENUMBERS as SELECT ctry, id, MAX(DECODE(tp,'EN', RN)) EN, MAX(DECODE(tp,'RN', RN)) RN, MAX(DECODE(tp,'AN', RN)) AN
[code]....
Unfortunately I cannot give you any data (too much of it) and small scale testing works, it's only when I run it on the 11million records do I get some (not all), just some of the data being mixed up between columns.
Now, I've tried:
1. Using SQLPLus - no joy
2. Creating the Table and then inserting the data into a blank table - also no joy
3. Using a VIEW - no joy, listagg doesn't work in VIEW tables
I do understand that without data it's hard to replicate the issue but why this statement works as a SELECT but when written to a table has data anomolies?
while replicating the master site via materialized views, in mViewGroups i issued:
BEGIN DBMS_REFRESH.MAKE ( name => 'mvadmin.hamza_refg', list => '', next_date => SYSDATE, interval => 'SYSDATE + 1/1440', -- for test purpose i used such a small interval implicit_destroy => FALSE, rollback_seg => '', push_deferred_rpc => TRUE, refresh_after_errors => FALSE); END;
in my previous attempt it worked all fine... i had a change in senerio, so i did my replication again from scractch using the same old spool in a new installation but even after 3 tries on replicating from scratch my objects are not getting refreshed automatically. even when i attempt to refresh the group it does not work. it works only when i refresh each of the participating object of the group manually.
I'm basically experimenting with the concept of replicating data from one instance to the other. Using this thread as a guide, I was wondering if I could create a service on an Apex 4.0 instance, and have an application apex.oracle.com consume that service?
i want to know the difference between Left outer join Vs. Right outer join? Its like which join is safer to use or is there any recommendations to use any join?
I am trying to update records in the target table based on the records coming in from source. For instance, if the incoming record is present in the target table I would update them in the target else I would simply insert. I have over one million records in my source while my target has 46 million records. The target table is partitioned based on calendar key. I implement this whole logic using Informatica. Looking at the informatica session log I find that the informatica code is perfectly fine but its in the update part it takes long time (more than 5 days to update one million records). find the TARGET TABLE query and the UPDATE query as below.
TARGET TABLE: CREATE TABLE OPERATIONS.DENIAL_REGRET_FACT ( CALENDAR_KEY INTEGER NOT NULL, DAY_TIME_KEY INTEGER NOT NULL, SITE_KEY NUMBER NOT NULL, RESERVATION_AGENT_KEY INTEGER NOT NULL, LOSS_CODE VARCHAR2(30) NOT NULL, PROP_ID VARCHAR2(5) NOT NULL, [code].....
I have written the following PL/SQL procedure to delete the records and count the number of records has been deleted.
CREATE OR REPLACE PROCEDURE Del_emp IS del_records NUMBER:=0; BEGIN DELETE FROM candidate c WHERE empid in (select c.empid from employee e, candidate c where e.empid = c.empid and e.emp_stat = 'TERMINATED' ); [code]....
I am running a query in our Clarity PPM database to return a list of all Support projects. This returns a simple list of project code and project name:
The query has the project resource tables associated with it, so I am able to list all resources allocated to the project. But for now i am only selecting a DISTINCT list of projects.
I have a separate query which returns a list of support resources.
select res.full_name, res.unique_name , dep.description from niku.srm_resources res, niku.pac_mnt_resources pac, niku.departments dep where res.unique_name = pac.resource_code and pac.departcode = dep.departcode and res.is_active = 1 and description like 'IMS%' and UPPER(dep.description) like '%SUP%'
What I need to be able to do in the first query, is return only projects that do NOT have a resource that appears in the resource list in the second query.
(the res.unique_name field in the second query can be linked to the same in the first query)
Logically, the process would be: 1. Identify Support Project 2. Identify Resources allocated to the project team 3. Compare with List of Support Resources 4. If any Resources in that list do NOT appear on the project, then return project.
I want to create a query with only the junction of these two queries:
- select id_utilizador,nbeneficiario,nome from adm_utilizadores a WHERE exists ( select 1 from adm_util_grupos b where a.id_utilizador = b.id_utilizador and b.id_grupo = '1') ;
- SELECT b.*,rownum as row_num FROM ADM_UTILIZADORES b ORDER BY $sidx $sord WHERE row_num BETWEEN $start AND $end";
Virtually want id_utilizador, nome, and nbeneficiario, I can get the first query, ordered me returning the first 10.
I have 2 tables SEC_MASTER_HISTA and SEC_MASTER_HISTB.
Now, I need to compare the data of the two tables column-wise.
Ideally the 2 tables should have the same security_alias values but in my case they do not as the two tables belong to 2 diff client models. There is however a main SECURITY_MASTERA and SECURITY_MASTERB tables which have the security_alias recorded and a primary_asset_id column value which can act as a link between SEC_MASTER_HISTA and SEC_MASTER_HISTB. But, I have not been able to figure out the exact query which will be ideal.
Attached are the table structures and the data it contains.
Note: I need to compare the Coupon and Freq column values of SEC_MASTER_HISTA and SEC_MASTER_HISTB.
im trying to update a column in the employee table with the value "YES". Im getting an error message saying im missing a SET statement from this code below:
update e SET e.review='YES' from employee inner join rentals r on e.employee_id=r.employee_id inner join job j on e.job_id=j.job_id where r.plate ='FY06WNT' and j.function !='MANAGER' and j.function !='PRESIDENT';
UPDATE dev10 SET c3 = dev12.c1 FROM dev10 INNER JOIN dev11 ON dev11.c3 = dev10.c1 CROSS JOIN dev12 WHERE (dev11.c2 LIKE 'BBBBBB') AND (dev12.c2 LIKE 'FFFFFF') / but, Oracle, what should we do new?
UPDATE Caxnode AS A INNER JOIN Caxnode AS B ON A.node_alias = B.node_alias SET A.partition_Type = 'LDOM', A.node_mode = 'LOGICAL', A.host_id = b.host_id, A.num_of_proc = b.num_of_proc WHERE (((A.node_mode)='virtual' Or (A.node_mode)='regular') AND ((B.partition_Type)='LDOM'));
This doesn't work in oracle, I googled and read that update doesnt work with inner join in oracle..
It is the simplest join or inner. An equijoin combines rows that have equivalent values for the specified columns.
SQL> select * from x;
NAME EMAIL EMPID Sam email@removed 1060 Rose email@removed 1061
[code]....
don't consider above mentioned queries I got valuable outputs.
NAMEEMAIL EMPID NAME EMAIL EMPID samemail@removed 1060 sam email@removed 1060 roseemail@removed 1061 rose email@removed 1061 sonaemail@removed 1062 sona email@removed 1062
Inner join shows matches only when they exist in both tables.so , i got records 1060,1061,1062
// Referencing columns used in a USING clause. SQL> select x.name,x.email,x.empid from x 2 inner join y 3 using (empid);
select x.name,x.email,x.empid from x * ERROR at line 1: ORA-25154: column part of USING clause cannot have qualifier
so query rewritten as
SQL> select x.name,x.email,empid from x 2 inner join y 3 using (empid); NAME EMAIL EMPID --------------- --------------- ---------- sam email@removed 1060 rose email@removed 1061 chris email@removed 1062
I mean see two different outputs.first output records twice displayed ... Yes i agree that is Inner join.second output records not displayed twice... common records only displayed once ,in x and y.
I think should n't use a table name or alias when referencing columns used in a USING clause... am i right ????
I want to know both are inner joins .how Oracle is determined both outputs ?
If i have a table T1 and a table T2. Table T1 is having 100 rows and table T2 is having 20 rows. When performing a Hash join ,which table should be used to make the hash table ,the larger one or the smaller one and why ?IF the data set is too small for considerations then please conser table T1 with 10 million of rows and table T2 with 1 million of rows.
SQL> desc RCA_SMART_CARD; Name Null? Type ----------------------------------------- -------- ---------------------------- N_CARD_ID NOT NULL NUMBER(10) C_CARD_SERIAL_NUMBER NOT NULL VARCHAR2(20) C_SIM_MSISDN VARCHAR2(20) C_SIM_IMSI VARCHAR2(20) C_LINKED_CARD VARCHAR2(20) N_PRO_IDENTIFIER NOT NULL NUMBER(4) C_CARD_TYPE VARCHAR2(1) N_SIM_STATE NUMBER(1) N_EEPROM_SPACE_LEFT NUMBER(9) N_VOLATILE_SPACE_LEFT NUMBER(9) N_NONVOLATILE_SPACE_LEFT NUMBER(9) N_CARD_OPTI NOT NULL NUMBER(15) N_PRODUCT_ID NUMBER(10) D_CREATION_DATE DATE D_MODIFICATION_DATE DATE D_STATUS_MODIFICATION_DATE DATE
SQL> desc IMEI; Name Null? Type ----------------------------------------- -------- ---------------------------- MSISDN NOT NULL VARCHAR2(20) IMEI NOT NULL VARCHAR2(16) DATE_MOD NUMBER(13) IMSI VARCHAR2(18) ICCID VARCHAR2(20) T_PROF RAW(20) EXTRA_DATA VARCHAR2(100)
If I want to join two table together . I want to search the number of record in IMEI that have N_SIM_STATE =1 in RCA_SMART_CARD . The MSISDN in IMEI is equal to C_SIM_MSISDN in RCA_SMART_CARD .
I have a piece of code that joined the same table onto itself twice in order to get the previous, current and future year's into columns in the same output.
Up until recently this has been working fine but the most recent data has just been uploaded into the table and now it comes up with an error.
On the second (left outer) join it now says that the column is ambiguously defined (ORA-00918). It doesn't matter which order the joins are in it is always the second join that the error pops up on.