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 .
Below is the desc table : 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 stumbled about some weird 11gR2 behavior (running on AIX).When I performed a join between a table with user based content (parts belonging to an sourcing scope) and a base table (parts available) whereas the parts have to fulfill a special regular expression, it showed that the same query is faster when using outer join than inner join (about 0.7sec vs. 20sec; which makes me believe that regexp_like works wrong when involved in an inner join).
i tried the same statement with a standard like (but not fulfilling the same condition).This time performance was as expected (inner join outperforming outer join).
Oracle version information Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production PL/SQL Release 11.2.0.2.0 - Production CORE 11.2.0.2.0 Production TNS for IBM/AIX RISC System/6000: Version 11.2.0.2.0 - Production NLSRTL Version 11.2.0.2.0 - Production [code]...
I can see it, the execution plan for the "inner join" doesn't show so much more costs than the one for the outer (but why at all is does an inner join cost more?) ...The execution plan for both "not like" is the same and (surprisingly ;-) ) similar to "outer-regexp".
I hope sample data are not needed as there would be needed a lot...this is the second time I came across the "plan worse but execution time better" phenomenon.
I am trying to join column names from a table with data from a different table. I think i should be able to pass the parameter to a 'select list' in a query. Look at my sample data below. And the data in sales table can grow till 15 rows and similarly corresponding columns in saleshist.
I am having trouble retrieving the Max, latest date, from a table with a join to one another table and other fields from both.I was able to get the MAX service_date grouped by id. But once I tried to add more fields to the query and another table it won't work.
Here is what I have:
selectMAX(cs.service_date), cs.notes, cs.applicant_id,wr.program_code,wr.last_name,wr.first_name,wr.region_code,wr.status_cd from cs join wr on cs.applicant_id=wr.applicant_id where wr.status_cd='AC' group by cs.applicant_id
- one ASM instance - X DB instances - each DB instance uses 2 or more dedicated diskgroups from the ASM instance - there is one diskgroup named FREEDISK that contains spare disks
On each DB instance you can see:
- the list and global parameters of all diskgroups using v$asm_diskgroup view - the list and parameters of all disks the instance is using with v$asm_disk view
So my question is: how (if this is possible) to know the list of (spare) disks in FREE DISK disk group?
Whenever you're trying to create a table instance chart, and if theres 3 primary keys(composite keys). Do u put in the table instance chart as PK1, PK2, PK3 for the 3 primary keys?
And also if theres 2 foreign keys in the table, do u put in as FK1, FK2 on their key types?
oracle 10g to select column from about 8 table . I start with this statement
select A.a, B.b, C.c, D.d, E.e, F.f, G.g, H.h from A full outer join B on(A.a=B.b) full outer join C on(B.b=C.c) full outer join D on(C.c=D.d_ . . .. . . .
two history tables with each record having effective date and end date needs to join (date is in dd/mm/yyyy)
table one
effdate enddate ID Name 01/08/2010 04/08/2010 01 devendra 04/08/2010 06/08/2010 01 deven
table two
effdate enddate ID Family 01/08/2010 02/08/2010 01 X 02/08/2010 03/08/2010 01 Y 03/08/2010 05/08/2010 01 Z 05/08/2010 06/08/2010 01 W
Expected output
effdate enddate ID Name Family 01/08/2010 02/08/2010 01 devendra X 02/08/2010 03/08/2010 01 devendra Y 03/08/2010 04/08/2010 01 devendra Z 04/08/2010 05/08/2010 01 deven Z 05/08/2010 06/08/2010 01 deven W
I have a table that contains 15 columns. Say each columns contains name of fruits. And another master table which contains names of valid fruits. Now I have to create another table from these tables such that for each column if the fruit name is present in the master table then fruit-name is populated else "invalid" is populated. I know using left join for 15 times to the same master table can work. But I found this very clumsy. Is there any other way of doing it.This is just a sample case. In real scenario I have a table of 800 million records and master table of 30000 records.
Explain the mechanism of this sql statement. I tried to understand how it goes but I really got confused.
select e.last_name, m.last_name mgr from employees e join employees m on (e.manager_id = m.employee_id)
The first line seems clear to me that will bring the names of employees and second column will bring names of managers. Second line is clear as well, but the third line couldn't understand. in my mind it should be like that
m.manager_id = e.employee_id
I tired this but doesn't work so what happened exactly in that full statement, I mean how it will match. I just want to understand the mechanism.
select distinct c.process_id a.role_id,a.email_address,c.process_name from role a, notification_role b, process c where a.role_id=b.role_id and b.process_id = c.process_id
I have 2 tables as shown below. I have to join those tables and get data as in table 3. Condition is I have to get sum of scores for each student where category is 1 and active is Y.
Table1: col1col2category A 10 1 A 10 2 B 10 1 B 20 2 C 10 1 D 20 1 J 30 1
Table2: colAcolBActive A10Y A20N B30Y B40N Z35Y
Table3: STUDENTSCORE A20 B40 C10 D20 J30 Z35
query to show student name and sum of his score where category is 1 and active is Y. I am using Oracle 8i.
I have 2 tables Table a(girlscoutid, item, quarter)Table b(girlscoutid, fname, lname) I want to get the names of ppl who did not sell any item/s for the
I've created a query so I can easily compare two sets of data for two different instruments:
select a.CalId, a.AtName, a.NRef, a.VaLoat, a.ValTime, a.ValRing, cvs.NRef, cvs.CalId, cvs.AtName, cvs.VaLoat, cvs.Valtime, cvs.ValRing from CalcAttribute a, CalcAttribute cvs where a.NRef like '438815' and cvs.NRef like '438813' and a.CalId *= cvs.CalId and a.AtName *= cvs.AtName union
[Code]...
This works great - however I want to add an addtional condition, basically so it only returns where the two are not equal.
I thought I should just be able to add an extra: and a.ValLoat *<> cvs.ValLoat and a.ValLoat <>* cvs.ValLoat
But it doesnt seem to like this (Incorrect syntax near '<'.)
create table ACTIONARI_ARH ( actionar_id NUMBER(10) not null, id VARCHAR2(20) not null, id_2 VARCHAR2(20), tip VARCHAR2(1), nume VARCHAR2(100), prenume VARCHAR2(100), adresa VARCHAR2(200),
[code]....
and this view
CREATE OR REPLACE VIEW ACTIONARI AS SELECT "ACTIONAR_ID","ID","ID_2","TIP","NUME","PRENUME","ADRESA","LOCALITATE","JUDET","TARA","CERT_DECES","DATA_REGISTRU" Data_operare,"USER_MODIF","DATA_MODIF","REZIDENT" FROM ( select
[code]....
The table has about 30 milion records and holds persons names, addresses, personal id (id), and internal id(actionar_id) and date when a new adress has been added.
The view is about getting only the most recent info for one person (actionar_id).
if i run a
a) select * from actionari a where a.actionar_id = 'nnnnnnn', result is returned immediatly, oracle uses index and does not do a full table scan.
b) select * from actionari a where a.actionar_id in ('nnnnnnn','mmmmmm','ooooooo'), result is returned immediatly, oracle uses index and does not do a full table scan.
my problem when i use this view in a join.let's assume i have another table with no more than 500 records, something like
create table SMALL_TABLE ( actionar_id NUMBER(10) not null, ...... );
and if i run
select * from SMALL_TABLE s join actionari a on a.actionar_id = s.actionar_id;
it takes like forever to process, forever means 1~3 minutes.by looking at the execution plan, oracle does a full table scan, creates the view for all unique 7milion persons, and only then joins the result with the actionar_is's in the small table and returns the desired 500 record result.i am using oracle 10g.
I need to delete all the registers where the table 1 does join with table 2 in 3 fields... for example:
delete taba1 t1 where t1.campo1 in ( select distinct(tr.campo1) from tabla1 tr, tabla2 t2 where t2.error = 0 tr.campo1 = t2.campo1 and tr.campo2 = t2.campo2
In normal sql statement: select sum(order_items.quantity*items.price) sales_price from order_items,items where order.item_id=items.item_id;
I have to put this logic in either a stored procedure or Function just to calculate sum(order_items.quantity*items.price) and store the aggregated value as Sales_price in DB. Then we have to call this from Informatica Stored procedure Transformation where we will have only one output port as Sales_price,this is to load into summary table. All the aggregate calculations and joining of 2 tables should be done on DB side and only one output should be populated when we execute this procedure.
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'm trying to test moving a single instance 11202 database to single instance w/ grid infra.
Here is what I've done:
1. Install a database (11202), single instance and create a database 2. Install Grid Software only (user: grid) 3. start the cluster 4. "srvctl add database -d orclsidb -o $ORACLE_HOME" to register the database with grid. 4.1> I was able to start/stop the database with srvctl command here onwards 5. configure disks using asmlib and start the asm 6. "srvctl add asm" to register asm with grid. 7. PROBLEM ... when I try to "backup as copy database format '+ASM_DATA_DG';" from oracle user it errors out as below:
RMAN> backup as copy database format '+ASM_DATA_DG';
Starting backup at 24-AUG-12 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=134 device type=DISK channel ORA_DISK_1: starting datafile copy input datafile file number=00011 name=/fs0/oracle/oradata/orclsidb/sjc883p_indx_large_01.dbf RMAN-00571:
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 08/24/2012 08:53:29 ORA-19504: failed to create file "+ASM_DATA_DG" ORA-12547: TNS:lost contact ORA-15001: diskgroup "ASM_DATA_DG" does not exist or is not mounted ORA-15055: unable to connect to ASM instance ORA-12547: TNS:lost contactConsidering "TNS: lost contact" I tried to see if grid listener is aware of ASM instance:
[Code]....
All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=usracdb03.rwcats.com)(PORT=1522))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production Start Date 22-AUG-2012 06:08:53 Uptime 2 days 2 hr. 50 min. 48 sec Trace Level off
i want to get table name, constraint name, constraint type with join processes in string type. this is what i want: alter table tablename add constraint constraintname constrainttype(columnname)
creating an ASM instance. I've never done this before and searched all known documentation. I just can't seem to figure this out. This is an 11g database on a WinXp machine for testing purpose before attempting to do this on a live production environment