Ordering according comparing - SQL Experts pls help
Hi All,
I want to measure the nearest points according to percentage between these points and order it.
by another way, i want to show the relation between points according to percentage value.
drop table temp_value;
create table temp_value(id number(10),location varchar2(20), percentage number(9));
insert into temp_value values (1,'LOC 1,2',30);
insert into temp_value values (2,'LOC 1,3',0);
insert into temp_value values (3,'LOC 1,4',0);
insert into temp_value values (4,'LOC 1,5',0);
insert into temp_value values (5,'LOC 1,6',50);
insert into temp_value values (6,'LOC 2,3',0);
insert into temp_value values(7,'LOC 2,4',0);
insert into temp_value values (9,'LOC 2,5',0);
insert into temp_value values (10,'LOC 2,6',10);
insert into temp_value values (11,'LOC 3,4',90);
insert into temp_value values (12,'LOC 3,5',80);
insert into temp_value values (13,'LOC 4,5',0);
insert into temp_value values (14,'LOC 4,6',0);
insert into temp_value values (15,'LOC 5,6',0); i want the output like this, the ordering of the point like this
4
3
5
6
1
2 or like this
6
1
2
4
3
5 if you ask me why this ordering i will say that
4 [90 percent between point 3,4 that mean can be 3,4 or 4,3]
3
5 [80 percent between 3,5 that mean can be 5 after 3,4]
6 [50 percent between 1,6 that mean can be 1,6 or 6,1 ]
1
2 [ 30 percent between 1,2 that mean can be 1,2 or 2,1] regards
Edited by: Ayham on Oct 6, 2012 10:18 AM
Edited by: Ayham on Oct 6, 2012 10:43 AM
Edited by: Ayham on Oct 6, 2012 8:04 PM
really i am happy to see you reply but the results is not correct
SQL> select A1.loc as Location, A1.rn as percentage, a2.rw as group_number from
asd a1,
2 (Select rn, row_number() over(order by rn desc) rw
3 from asd
4 group by rn) a2
5 where a1.rn = a2.rn;
LOCATION PERCENTAGE GROUP_NUMBER
4 90 1
3 90 1
5 80 2
3 80 2
6 50 3
1 50 3
2 30 4
1 30 4
6 10 5
2 10 5
6 0 6
LOCATION PERCENTAGE GROUP_NUMBER
6 0 6
5 0 6
5 0 6
5 0 6
5 0 6
4 0 6
4 0 6
4 0 6
4 0 6
3 0 6
3 0 6
LOCATION PERCENTAGE GROUP_NUMBER
2 0 6
2 0 6
2 0 6
1 0 6
1 0 6
1 0 6
28 rows selected.
SQL>it should be like this
LOC Group
3 1
4 1
5 1
1 2
6 2
2 2Edited by: Ayham on Oct 6, 2012 1:11 AM
Edited by: Ayham on Oct 6, 2012 1:11 AM
Similar Messages
-
SQL experts please help for a query
I have following table1.
What query can give the result as given below, SQL experts please help on this.
TABLE1
Event DATETIME
in 2/JAN/2010
out 2/JAN/2010
in 13/JAN/2010
out 13/JAN/2010
in 5/JAN/2010
out 5/JAN/2010
RESULT REQUIRED FROM THE SQL QUERY
COL1_IN COL2_OUT
2/JAN/2010 2/JAN/2010
13/JAN/2010 13/JAN/2010
5/JAN/2010 5/JAN/2010I tried to help, but this puzzles me.
Why is this not returning pre-selected set of rows, why it's doing some merge join cartezian ?
SQL> select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
SQL> select * from table1;
EVENT DATETIME
in 2/JAN/2010
out 2/JAN/2010
in 13/JAN/2010
out 13/JAN/2010
in 5/JAN/2010
out 5/JAN/2010
6 rows selected.
SQL> explain plan for
2 with a as
(select datetime from table1 where event='in'),
b as
(select datetime from table1 where event='out')
select a.datetime COL1_IN ,b.datetime COL2_OUT from a,b ;
Explained.
SQL> set wrap off
SQL> set linesize 200
SQL> select * from table(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 185132177
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 9 | 288 | 8 (0)| 00:00:01 |
| 1 | MERGE JOIN CARTESIAN| | 9 | 288 | 8 (0)| 00:00:01 |
|* 2 | TABLE ACCESS FULL | TABLE1 | 3 | 48 | 3 (0)| 00:00:01 |
| 3 | BUFFER SORT | | 3 | 48 | 5 (0)| 00:00:01 |
|* 4 | TABLE ACCESS FULL | TABLE1 | 3 | 48 | 2 (0)| 00:00:01 |
PLAN_TABLE_OUTPUT
Predicate Information (identified by operation id):
2 - filter("EVENT"='in')
4 - filter("EVENT"='out')
Note
- dynamic sampling used for this statement
21 rows selected.
SQL> with a as
(select datetime from table1 where event='in'),
b as
(select datetime from table1 where event='out')
select a.datetime COL1_IN ,b.datetime COL2_OUT from a,b ;
COL1_IN COL2_OUT
2/JAN/2010 2/JAN/2010
2/JAN/2010 13/JAN/2010
2/JAN/2010 5/JAN/2010
13/JAN/2010 2/JAN/2010
13/JAN/2010 13/JAN/2010
13/JAN/2010 5/JAN/2010
5/JAN/2010 2/JAN/2010
5/JAN/2010 13/JAN/2010
5/JAN/2010 5/JAN/2010
9 rows selected.
SQL> -
QUERY CLARIFICATION RQD : gurus, experts pls help
Hai,
I am facing problem in performance of the query. sample scenario i have created here pls help me to solve
**VEH_MAIN* TABLE (MASTER TABLE)*
CREATE TABLE VEH_MAIN
( VIP_MOT_IND VARCHAR2(10 BYTE),
VIP_IND NUMBER(10,0)
Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('MOT01',1);
Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('MOT02',5);
Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('M0T03',1);
Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('MOT01',2);
Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('MOT02',6);
Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('MOT01',3);
Insert into VEH_MAIN (VIP_MOT_IND,VIP_IND) values ('MOT01',4);
**VEH_ENGINE_SUB* (table for engine subclass)*
CREATE TABLE VEH_ENG_SUB
( ENG_SUBCLASS VARCHAR2(50 BYTE),
ENG_MOT_IND VARCHAR2(10 BYTE)
Insert into VEH_ENG_SUB (ENG_SUBCLASS,ENG_MOT_IND) values ('ENGSUB001','MOT01');
Insert into VEH_ENG_SUB (ENG_SUBCLASS,ENG_MOT_IND) values ('ENGSUB001','MOT02');
*VEH_ENG_IND( Detail table for engine subclass)*
CREATE TABLE VEH_ENG_IND
( "ENG_SUBCLASS" VARCHAR2(50 BYTE),
"ENG_IND" VARCHAR2(10 BYTE)
Insert into VEH_ENG_IND (ENG_SUBCLASS,ENG_IND) values ('ENGSUB001','1');
Insert into VEH_ENG_IND (ENG_SUBCLASS,ENG_IND) values ('ENGSUB001','2');
*VEH_AXIS( Master table for Engine Axis)*
CREATE TABLE VEH_AXIS
( ENG_AXIS VARCHAR2(50 BYTE),
AXIS_MOT_IND VARCHAR2(10 BYTE)
Insert into VEH_AXIS (ENG_AXIS,AXIS_MOT_IND) values ('ENGAXIS001','MOT01');
Insert into VEH_AXIS (ENG_AXIS,AXIS_MOT_IND) values ('ENGAXIS002','MOT02');
*VEH_AXIS_IND( Details table for engine axis)*
CREATE TABLE VEH_AXIS_IND
( ENG_AXIS VARCHAR2(50 BYTE),
ENG_IND VARCHAR2(10 BYTE)
Insert into VEH_AXIS_IND (ENG_AXIS,ENG_IND) values ('ENGAXIS001','1');
Insert into VEH_AXIS_IND (ENG_AXIS,ENG_IND) values ('ENGAXIS001','2');
Insert into VEH_AXIS_IND (ENG_AXIS,ENG_IND) values ('ENGAXIS001','3');
Insert into VEH_AXIS_IND (ENG_AXIS,ENG_IND) values ('ENGAXIS001','4');
Insert into VEH_AXIS_IND (ENG_AXIS,ENG_IND) values ('ENGAXIS002','5');
Insert into VEH_AXIS_IND (ENG_AXIS,ENG_IND) values ('ENGAXIS002','6');
Condition 1
if i select only ENGINE_SUBCLASS='ENGSUB001' then
SELECT vip_mot_ind,vip_ind
FROM veh_main V,
veh_eng_sub vsub,
veh_eng_ind vind
WHERE (v.vip_mot_ind= vsub.eng_mot_ind
and v.vip_ind=vind.eng_ind
and vsub.eng_subclass= vind.eng_subclass
AND vsub.eng_subclass='ENGSUB001' )output is
MOT01 1
MOT01 2
Condition 2:if i select only the Engine Axis='ENGAXIS002' then the
SELECT vip_mot_ind,vip_ind
FROM veh_main V,
veh_axis vaxis,
veh_axis_ind vaind
WHERE v.vip_mot_ind= vaxis.axis_mot_ind
and v.vip_ind= vaind.eng_ind
and vaind.eng_axis= vaxis.eng_axis
and vaxis.eng_axis='ENGAXIS002';MOT02 5
MOT02 6
Condition 3:
BOTH ENGINE AXIS AND ENGINE SUBCLASS
SELECT vip_mot_ind,vip_ind
FROM veh_main V,
veh_eng_sub vsub,
veh_eng_ind vind,
veh_axis vaxis,
veh_axis_ind vaind
WHERE (v.vip_mot_ind= vsub.eng_mot_ind
and v.vip_ind=vind.eng_ind
and vsub.eng_subclass= vind.eng_subclass
AND vsub.eng_subclass='ENGSUB001' )
AND ( v.vip_mot_ind= vaxis.axis_mot_ind
and v.vip_ind= vaind.eng_ind
and vaind.eng_axis= vaxis.eng_axis
and vaxis.eng_axis='ENGAXIS002');Null values returned. this is correct.
But the query PERFORMANCE fails in OR CONDITON as below
Condition 4;
SELECT vip_mot_ind,vip_ind
FROM veh_main V,
veh_eng_sub vsub,
veh_eng_ind vind,
veh_axis vaxis,
veh_axis_ind vaind
WHERE (v.vip_mot_ind= vsub.eng_mot_ind
and v.vip_ind=vind.eng_ind
and vsub.eng_subclass= vind.eng_subclass
AND vsub.eng_subclass='ENGSUB001' )
OR ( v.vip_mot_ind= vaxis.axis_mot_ind
and v.vip_ind= vaind.eng_ind
and vaind.eng_axis= vaxis.eng_axis
and vaxis.eng_axis='ENGAXIS002');output
MOT02 5
MOT02 5
MOT02 5
MOT02 5
MOT02 6
MOT02 6
MOT02 6
MOT02 6
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 1
MOT01 2
MOT01 2
MOT01 2
MOT01 2
MOT01 2
MOT01 2
MOT01 2
MOT01 2
MOT01 2
MOT01 2
MOT01 2
MOT01 2
This is sample example. when i implement in huge table with partition this scennario takes much time even 2 hours to run.
i want the output must be as below if i use OR condition like condition 4
MOT01 1
MOT01 2
MOT02 5
MOT02 6
Gurus and experts pls help me to solve this problem. Dont give any suggestion like
SELECT vip_mot_ind,vip_ind
FROM veh_main V,
veh_axis vaxis,
veh_axis_ind vaind
WHERE v.vip_mot_ind= vaxis.axis_mot_ind
and v.vip_ind= vaind.eng_ind
and vaind.eng_axis= vaxis.eng_axis
and vaxis.eng_axis='ENGAXIS002'
union
SELECT vip_mot_ind,vip_ind
FROM veh_main V,
veh_eng_sub vsub,
veh_eng_ind vind
WHERE (v.vip_mot_ind= vsub.eng_mot_ind
and v.vip_ind=vind.eng_ind
and vsub.eng_subclass= vind.eng_subclass
AND vsub.eng_subclass='ENGSUB001' )
}this will give correct result...
MOT01 1
MOT01 2
MOT02 5
MOT02 6
but the problem is we cannot implement this in query. because query get framed at runtime there will be so many implement has to be done. other than UNION pls give me more suggesion
waiting..
S
Edited by: A Beginner on Sep 11, 2010 12:51 AMcreate a view v1 with all the joins
select * from v1 where eng_subclass='ENGSUB001'
union
select * from v1 where eng_axis='ENGAXIS002'
If you really do not like the direct access with union, try this
select * from v1
where vsub_PK in (select vsub_PK from v1 where eng_subclass='ENGSUB001' )
OR vsub_PK in (select vsub_PK from v1 where eng_axis='ENGAXIS002')
--vsub_PK is the primary key of table vsub -
Calling SQL experts to help write a query
Trying to find some help from some sql experts.
I was asked to help write a query showing each Dialed_Number, the associated Call_Type, and Script(s) in an ICM configuration.
All the data I’m looking for seems to be in the following tables:
Dialed_Number (DialedNumberString, EnterpriseName, DialedNumberID)
Call_Type (CallTypeID, EnterpriseName)
Dialed_Number_Map (DialedNumberID, CallTypeID)
Call_Type_Map (CallTypeID, MasterScriptID)
Master_Script (MasterScriptID, EnterpriseName)
Thus far, my query looks like this:
SELECT distinct Dialed_Number.DialedNumberString, Dialed_Number.EnterpriseName AS DN_Name, Call_Type.EnterpriseName AS Call_Type_Name,
Master_Script.EnterpriseName AS ScriptName
FROM Call_Type_Map CROSS JOIN
Call_Type CROSS JOIN
Dialed_Number CROSS JOIN
Dialed_Number_Map CROSS JOIN
Master_Script
However, it’s returning every possible combination (it was 10x worse before adding the word ‘distinct’)
Ideally, I’d like the results to just show one row for each Dialed_Number (assumes 1:1 ratio of DN to CallType).
e.g.:
DN_Name DialedNumberString CallType_Name ScriptName
Can anyone offer any guidance or suggestion?Thanks Geoff,
I'd put this out on a couple different channels, and while yours is pretty good (I did remove the RoutingClientID from the where clause), I got another version that works just as well, and also includes DNs without CallTypes, and those which may have a CallType, but no script.
SELECT dn.DialedNumberString, dn.EnterpriseName AS Dialed_Number_Name, ct.EnterpriseName AS Call_Type_Name, ms.EnterpriseName AS Script_Name
FROM Dialed_Number dn
LEFT OUTER JOIN Dialed_Number_Map dnm ON dn.DialedNumberID = dnm.DialedNumberID
LEFT OUTER JOIN Call_Type ct ON dnm.CallTypeID = ct.CallTypeID
LEFT OUTER JOIN Call_Type_Map ctm ON ct.CallTypeID = ctm.CallTypeID
LEFT OUTER JOIN Master_Script ms ON ctm.MasterScriptID = ms.MasterScriptID
I believe the "joins" are supposedly more efficient, too.
Thanks for your contribution! -
hiii,
I have a table which has 14 rows & 8 cols.
I want covert it into 14 cols & 8 rows,
by using sql how to do it..pls help me.Oracle Database Search Results: pivot
-
Any java experts pls help me in converting attribute to XML formats
Pls help me oh my god i am a newbie here and i am given this project.
I had just written a XML doc. which looks like this
<ConsumerTransfer>
<TransactionId>
123:123
</TransactionId>
<Billingoption>
cash
</Billingoption>
</ConsumerTransfer>
I need to make this to attributes like
private String TransactionId()
private String BillingOption()
and so on.....
I need to convert this attributes to XML format
can any show me an example or the source codes for this
Really, I appreciate it.
JimmyKnotFor such node level operations I think that DOM would be a good idea. So here you go. Look for some nice tutorial for DOM and you got it.
salut -
Hi experts pls help me with this materialized view refresh time!!!
Hi Expeerts ,
Please clarify my doubt about this materialized view code
[\n]
CREATE MATERIALIZED VIEW SCHEMANAME.products_mv
REFRESH WITH ROWID
AS SELECT * from VIEW_TABLE@DATAOPPB;
[n]
Here i am creating a materialized view named products_mv of the view_table present in the remote server.Can anyone tell me when will my table product_mv will get refreshed if i follow this code.As what i read from the books is that the refresh period is implicit and is carried out by the database implicitly.so can u tell me suppose i insert 2 new records into my view_table when will this record get updated into my product_mv table.
I cant use primary key approach so this is the approach i am following .Kindly help me in understanding when will refresh of records occur in the materialized view product_mv...Pls help
regards
debashisHi Justin ,
Yes, my database can reasonably schedule other jobs too .Its not an issue.
Actually what i meant "fine in all aspects" is that will the matrerialized view will get refreshed w.r.t the documetum_v table present in my remote server.This is all i need to refresh my materialized view .
I queries the DBA_JOBS table .I could see the following result i have pasted below:-
[\n]
NLS_ENV
MISC_ENV INSTANCE
dbms_refresh.refresh('"WORKFLOW"."PRODUCTS_MV2"');
JOB LOG_USER PRIV_USER
SCHEMA_USER LAST_DATE LAST_SEC THIS_DATE THIS_SEC NEXT_DATE
NEXT_SEC TOTAL_TIME B
INTERVAL
FAILURES
WHAT
[n]
here WORKFLOW"."PRODUCTS_MV2 is the materialized view i have created.So can u tell me that whether we can predict our refresh part is functioning fine from this data.If so how?
Actually i am asking u in details as i dont have much exposure to materialized view .I am using it for the very first time.
Regds
debashis -
ORA-01458 error while using Pro*C to invoke PL/SQL procedure, pls help
I am using Pro*C (Oracle 10g on Itanium platform) to invoke PL/SQL procedure to read RAW data from database, but always encoutered ORA-01458 error message.
Here is the snippet of Pro*C code:
typedef struct dataSegment
unsigned short len;
unsigned char data[SIZE_DATA_SEG];
} msg_data_seg;
EXEC SQL TYPE msg_data_seg IS VARRAW(SIZE_DATA_SEG);
EXEC SQL BEGIN DECLARE SECTION;
unsigned short qID;
int rMode;
unsigned long rawMsgID;
unsigned long msgID;
unsigned short msgType;
unsigned short msgPriority;
char recvTime[SIZE_TIME_STRING];
char schedTime[SIZE_TIME_STRING];
msg_data_seg dataSeg;
msg_data_seg dataSeg1;
msg_data_seg dataSeg2;
short indSeg;
short indSeg1;
short indSeg2;
EXEC SQL END DECLARE SECTION;
qID = q_id;
rMode = (int)mode;
EXEC SQL EXECUTE
BEGIN
SUMsg.read_msg (:qID, :rMode, :rawMsgID, :msgID, :msgType, :msgPriority, :recvTime,
:schedTime, :dataSeg:indSeg, :dataSeg1:indSeg1, :dataSeg2:indSeg2);
END;
END-EXEC;
// Check PL/SQL execute result, different from SQL
// Only 'sqlcode' and 'sqlerrm' are always set
if (sqlca.sqlcode != 0)
if (sqlca.sqlcode == ERR_QUEUE_EMPTY) // Queue empty
throw q_eoq ();
char msg[513]; // Other errors
size_t msg_len;
msg_len = sqlca.sqlerrm.sqlerrml;
strncpy (msg, sqlca.sqlerrm.sqlerrmc, msg_len);
msg[msg_len] = '\0';
throw db_error (string(msg), sqlca.sqlcode);
and here is the PL/SQL which is invoked:
SUBTYPE VarChar14 IS VARCHAR2(14);
PROCEDURE read_msg (
qID IN sumsg_queue_def.q_id%TYPE,
rMode IN INTEGER,
raw_msgID OUT sumsg_msg_data.raw_msg_id%TYPE,
msgID OUT sumsg_msg_data.msg_id%TYPE,
msgType OUT sumsg_msg_data.type%TYPE,
msgPrior OUT sumsg_msg_data.priority%TYPE,
msgRecv OUT VarChar14,
msgSched OUT VarChar14,
msgData OUT sumsg_msg_data.msg_data%TYPE,
msgData1 OUT sumsg_msg_data.msg_data1%TYPE,
msgData2 OUT sumsg_msg_data.msg_data2%TYPE
) IS
BEGIN
IF rMode = 0 THEN
SELECT raw_msg_id, msg_id, type, priority, TO_CHAR(recv_time, 'YYYYMMDDHH24MISS'),
TO_CHAR(sched_time, 'YYYYMMDDHH24MISS'), msg_data, msg_data1, msg_data2
INTO raw_msgID, msgID, msgType, msgPrior, msgRecv, msgSched, msgData, msgData1, msgData2
FROM (SELECT * FROM sumsg_msg_data WHERE q_id = qID AND status = 0 ORDER BY sched_time, raw_msg_id)
WHERE ROWNUM = 1;
ELSIF rMode = 1 THEN
SELECT raw_msg_id, msg_id, type, priority, TO_CHAR(recv_time, 'YYYYMMDDHH24MISS'),
TO_CHAR(sched_time, 'YYYYMMDDHH24MISS'), msg_data, msg_data1, msg_data2
INTO raw_msgID, msgID, msgType, msgPrior, msgRecv, msgSched, msgData, msgData1, msgData2
FROM (SELECT * FROM sumsg_msg_data WHERE q_id = qID AND status = 0 ORDER BY recv_time, raw_msg_id)
WHERE ROWNUM = 1;
ELSE
SELECT raw_msg_id, msg_id, type, priority, TO_CHAR(recv_time, 'YYYYMMDDHH24MISS'),
TO_CHAR(sched_time, 'YYYYMMDDHH24MISS'), msg_data, msg_data1, msg_data2
INTO raw_msgID, msgID, msgType, msgPrior, msgRecv, msgSched, msgData, msgData1, msgData2
FROM (SELECT * FROM sumsg_msg_data WHERE q_id = qID AND status = 0 ORDER BY priority, raw_msg_id)
WHERE ROWNUM = 1;
END IF;
UPDATE sumsg_msg_data SET status = 1 WHERE raw_msg_id = raw_msgID;
EXCEPTION
WHEN NO_DATA_FOUND THEN
raise_application_error (-20102, 'Queue empty');
END read_msg;
where sumsg_msg_data.msg_data%TYPE, sumsg_msg_data.msg_data1%TYPE and sumsg_msg_data.msg_data2%TYPE are all defined as RAW(2000). When I test the PL/SQL code seperately, everything is ok, but if I use the Pro*C code to read, the ORA-01458 always happen, unless I change the SIZE_DATA_SEG value to 4000, then it passes, and the result read out also seems ok, either the bigger or smaller value will encounter ORA-01458.
I think the problem should happen between the mapping from internal datatype to external VARRAW type, but cannot understand why 4000 bytes buffer will be ok, is it related to some NLS_LANG settings, anyone can help me to resolve this problme, thanks a lot!It seems that I found the way to avoid this error. Now each time before I read RAW(2000) data from database, i initialize the VARRAW.len first, set its value to SIZE_DATA_SEG, i.e., the outside buffer size, then the error disappear.
Oracle seems to need this information to handle its data mapping, but why output variable also needs this initialization, cannot precompiler get this from the definition of VARRAW structure?
Anyone have some suggestion? -
HR SCHEMA FILES PRESENT BUT TABLES NOT SHOWN IN SQL DEVELOPER - PLS HELP
Dear DBA's,
I am studying towards the OCA and working through the SQL Fundamentals I Exam guide text book by John Watson and Roopesh Ramklass. I have a problem with accessing the HR Schema tables in SQL Developer. I can get connected to the HR schema but no information is available when i click on the + sign next to the "Tables (filtered)" link in SQL Developer under Human Resources - BTW (I've downloaded Oracle 11G)
Please help, I've tried the following already;
1. Downloaded the HR Schema sample scripts again
2. Resetting the Sample schema with this syntax in SQL PLUS - @?/demo/schema/mksample systempwd syspwd hrpwd oepwd pmpwd ixpwd shpwd bipwd default_tablespace temp_tablespace log_file_directory/
3. I have no Master script file so I cant recreate the sample scripts
I've been reading forums and trying to Google but I am too new at this and just can't get the HR schema to display all the information in SQL Developer. Please help as I really badly need to practice the exercises in the text book.
Any help to resolve this will be greatly appreciated.
Ali
Edited by: 942730 on Jun 26, 2012 1:15 AM942730 wrote:
Dear DBA's,
I am studying towards the OCA and working through the SQL Fundamentals I Exam guide text book by John Watson and Roopesh Ramklass. I have a problem with accessing the HR Schema tables in SQL Developer. I can get connected to the HR schema but no information is available when i click on the + sign next to the "Tables (filtered)" link in SQL Developer under Human Resources - BTW (I've downloaded Oracle 11G)
Please help, I've tried the following already;
1. Downloaded the HR Schema sample scripts again
2. Resetting the Sample schema with this syntax in SQL PLUS - @?/demo/schema/mksample systempwd syspwd hrpwd oepwd pmpwd ixpwd shpwd bipwd default_tablespace temp_tablespace log_file_directory/
3. I have no Master script file so I cant recreate the sample scripts
I've been reading forums and trying to Google but I am too new at this and just can't get the HR schema to display all the information in SQL Developer. Please help as I really badly need to practice the exercises in the text book.
Any help to resolve this will be greatly appreciated.
Alisqlplus
/ as sysdba
alter user HR identified by hr account unlock;
connect hr/hr
select table_name from user_tables;
exit -
URGENT, EXPERTS PLS HELP!!
I would like to know answer to following question:
"Is java.lang.Object" overused??? Pls reply immediately coz I doing my final year project at ivy league university and I need to hand in my assignment in next 2 hours!"Is java.lang.Object" overused??? Pls reply
immediately coz I doing my final year project at ivy
league university and I need to hand in my assignment
in next 2 hours!I love the story this implies. This issue is critical to a final year project? A final year project? Due in September?
How could it be relevant? I mean, if the final year project is an argument about the overuse of a particular idiom, then presumably the project is in the OP's area of expertise. So why is he asking about it here, now?
And if it's not his area of expertise... then he'd be expected to do some research, such as interviews. He'd be expected to do some research somewhat earlier than two hours before the project is due.
And of course the coup de grace, informing us that it's in an ivy league school. Those of us who weren't so fortunate to attend one, are of course obligated to help out those who do.
He must go to Yale.
Otherwise...a marvelous troll, sir! -
SQL Experts, Please help!!
Hi
Here is my query:
select
--Element Details:
pet.element_name, pet.element_type_id, pet.reporting_name,
decode(pet.processing_type, 'R', 'Recurring', 'Nonrecurring') "Processing Type",
pet.EFFECTIVE_START_DATE, pet.EFFECTIVE_END_DATE,
--Run Result Details:
prr.run_result_id,
NVL(prrv.RESULT_VALUE, 0)"Extra Mileage Details",
decode(piv.name, 'Pay Value', 'Amount',
'Number of KMs', 'Total Kilometers Covered',
'Vehicle Registration No', 'Vehicle Registration No.')"Input Value",
--Assignment Details:
paa.assignment_id,
--Time Period
ptp.START_DATE, ptp.end_date,
ptp.period_name "Payroll Period"
from
hr.pay_element_types_f pet,
hr.pay_run_results prr,
hr.pay_run_result_values prrv,
hr.pay_input_values_f piv,
hr.pay_assignment_actions assact,
hr.per_all_assignments_f paa,
hr.pay_payroll_actions payroll,
hr.per_time_periods ptp
where
pet.ELEMENT_TYPE_ID = prr.ELEMENT_TYPE_ID
and prr.run_result_id = prrv.run_result_id
and piv.input_value_id = prrv.input_value_id
and assact.ASSIGNMENT_ACTION_ID = prr.ASSIGNMENT_ACTION_ID
and paa.ASSIGNMENT_ID = assact.ASSIGNMENT_ID
and payroll.payroll_action_id = assact.PAYROLL_ACTION_ID
and ptp.TIME_PERIOD_ID = payroll.time_period_id
and pet.element_name = 'IVTB Extra Mileage'
and ptp.end_date between pet.effective_start_date and pet.effective_end_date
and ptp.end_date between paa.EFFECTIVE_START_DATE and paa.EFFECTIVE_END_DATE
and ptp.end_date between piv.effective_start_date and piv.effective_end_date
and paa.payroll_id != 0
and paa.pay_basis_id != 0
When I get the results, I get the Pay Value, Kilometers and Vehicle Registration no. in rows. They are my 'input values' having different input ids, however, they have same run result id and thus. I want to display them as separate columns each with the heading 'Pay value' , 'Kilometers' etc. and display my run resulyt value below each heading.
Is this possible? Can someone plz guide me?
Thanks in advance.
Regards,
Aparna GupteThis should be possible with SQL*Plus reporting
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14357/ch6.htm#CHDBEAAB
think it will be something like this;
COLUMN Pay_Value NEW_VALUE V_pay_value NOPRINT
COLUMN Kilometers NEW_VALUE V_Kilometers NOPRINT
COLUMN Registration NEW_VALUE V_Registration NOPRINT
TTITLE LEFT 'Heading: ' V_pay_value,V_Kilometers,V_Registration SKIP 2
BREAK ON piv.name SKIP PAGE
select
--Element Details:
pet.element_name, pet.element_type_id, pet.reporting_name,
decode(pet.processing_type, 'R', 'Recurring', 'Nonrecurring') "Processing Type",
pet.EFFECTIVE_START_DATE, pet.EFFECTIVE_END_DATE,
--Run Result Details:
prr.run_result_id,
NVL(prrv.RESULT_VALUE, 0)"Extra Mileage Details",
decode(piv.name, 'Pay Value', 'Amount',
'Number of KMs', 'Total Kilometers Covered',
'Vehicle Registration No', 'Vehicle Registration No.')"Input Value",
--Assignment Details:
paa.assignment_id,
--Time Period
ptp.START_DATE, ptp.end_date,
ptp.period_name "Payroll Period"
from
hr.pay_element_types_f pet,
hr.pay_run_results prr,
hr.pay_run_result_values prrv,
hr.pay_input_values_f piv,
hr.pay_assignment_actions assact,
hr.per_all_assignments_f paa,
hr.pay_payroll_actions payroll,
hr.per_time_periods ptp
where
pet.ELEMENT_TYPE_ID = prr.ELEMENT_TYPE_ID
and prr.run_result_id = prrv.run_result_id
and piv.input_value_id = prrv.input_value_id
and assact.ASSIGNMENT_ACTION_ID = prr.ASSIGNMENT_ACTION_ID
and paa.ASSIGNMENT_ID = assact.ASSIGNMENT_ID
and payroll.payroll_action_id = assact.PAYROLL_ACTION_ID
and ptp.TIME_PERIOD_ID = payroll.time_period_id
and pet.element_name = 'IVTB Extra Mileage'
and ptp.end_date between pet.effective_start_date and pet.effective_end_date
and ptp.end_date between paa.EFFECTIVE_START_DATE and paa.EFFECTIVE_END_DATE
and ptp.end_date between piv.effective_start_date and piv.effective_end_date
and paa.payroll_id != 0
order by piv.name,Number of KMs,Vehicle Registration No -
I can't check my order status!!! Pls help
Hello all,
I've just placed an order for a phone upgrade
and I use http://www.verizonwireless.com/b2c/orderstatus/OrderStatusForm to check my order status
but when I filled in the correct order # and my last name, it didn't show my order's status. It just ask me to download some file name OrderStatusSerlet (when I use Firefox, Google Chrome, Opera, and my android phone) or showed a page whose contain is something like this
µ kzÛ¸ñ·| „Ýì& %?vcKÔ÷9r’uë$îʉۦ©>ˆ„(8$À @ÉÎ&ýÕ“ô=DÒ“t |ˆ’e&Ù$J,Q3ƒy ó€ú÷N^ /þzþ˜ÌL ‘ó—ÎN‡Äi¹îåÞÐuO.NÈ_~ºxvFºí Å}㺏Ÿ;[¤|93c’#×], íÅ^[ªÐ½øÙ½F~]d?¶´]Ý Là ¶*¯†ý Œ ÙSßjr GB{ xw 3– ET„žÃ„CʧÕ®?c4 ”Šö 7 ¼bŠ¿“‚\rÅ"¦5y¡ ¦À4jRM†RL¹Š©áRôÝl (…ë³÷~Ì %¨U‹ý’ò¹çÀ Äi]Ü$Ì!~öÍs »6.jÙ#þŒ*ÍŒw:zÑzøðà°Õuˆ;ø ¿3°&¥a•' TÊÚ‘¹‰ØF|1¨Ú„AÈ|T:+ l >†}[ÿ_pàE\¼%àZÏá Ù! ”€ç ,q¯[ l¦Ø´ Oý kÏß-Ú¾Œ]K¨Ç“]ßÕà6 ¸S:ÇUÅçx¿ Ö†Š,=“Êø©!ß\huß6òÛ° ”Ñ„ªJ DÆ —TtÇ`é c¦P| © ¥—Ë´ FrB£v ܯÌ]H ÇC T ßJ À’wñï+ Øøê—”©›ª¨;dÔð̼-è ¥/¿µ®tÅ=÷Z×|J"ÃÈécòÛ¯î2Î~ø&fœ>^3ä5 Ÿ¾iµ0kÜ!&f §ž“(.~»EÔ÷!!óIÄΑO©CvÚ¾Ü{R & . »¿:p¥ [NUA¥'—|40J¢T·C)C¤ VÝÎnçàáû{»{û?v :ýÝÝC'Ó.I' íTžhûÚW<1UM¯èœfPg Š1Ÿ* 3â‘æf YÊJˆÜ ”º·m¬.Í^?Ç –§¦V ÑÊ¿+ ¹ ÊA¹ÒÎ`EÂG¬™SE¾» S®þŒë{Ÿ±ö [î 7– ó«îîuוüÍb– .Ÿ¾ ïz b©Ø· ñ‰¢·ÃùÅ"ätÊl»äS7žÈëÛûe«î…Y’Œ8äÈ!54ºÑ†œ+‰Z“'‘\ DÀ–sܝ6²ƒj¹Q“ÓÜWä dÄT l i;h’÷ï „ ˆns‡ 3W•u×Ôl|X7ç}oê¯ë ê¿Öú· Ù¬Cþ® ù] òû:ä?ꐨC Õ!ïÕ!ûuÈA òŸuÈڍýßÿÔaÿ÷¯×¡ÿîÔaI‰¼¿ {ÿþýà×Ð@ ˜I• ¾}ØZfØ|z. ’/Nè Ÿ³ ò Ì>±¡¡ópøyec°r–·£ä Uo™Ùñ¼ÊaÞi`§Pà¼&$ ÌýfÛÈ3¹`jH5Ë ^” Á+HÛMÌ'Í ÍlMóAɹ·.ñ¥àwÈCŒW,$÷I³…¥%™jn – eYÞ T é›… X¯ÉDˆ=ẠõY å¤(ªdÚ« Ù ¹P/„`Ñf¡Ã é5 í “¸ÙÏ¡Ï2# J =E¯^ ƒ9ÆŠY%ºC89¶Ç© ›äÔ°¸úý yt3Â[ç' «¨ 6ç>ÃKü*ô :…Ó ±?`ü‰Ý¬°U2FÊ3 e cöêâa¶M*€T)(¿ ¯’ ƒ ñ LûUø < srp>“‚r^Ea ]UD <“>]wÒH*c:‡–0·~³Ç‹€¬4-e©À îRÑ ZÇÞÄ ,Û b%¥Nùµýq Ê Òå ÷˜hé ¿nXýadå'’òsU :ÂaUYY+P9ó¼–fY|Ö-ÔAÝ/° r Õ_¨ ýèfiÞ¦t²&™¬Ø¾ LìE'B (Öa ÍQ·“\÷ª ×!fÿ S®XðÀÌŽRÒÞ.F™!¥´ ™€ÇP¿ìÍ]ÿ(‡ç ½â HÙÛ4 É? •oÿ ¼ M¿
And these errors appear on every computers I used
So how can I check my order status?
Please help me!!!
Thank yousame here.
ordered a phone last night and i keep getting a download that doesn't contain anything but gibberish. -
OCA certification (Senior, expert pls help!!)
Hi all, i am currently a java programmer and is keen to get OCA certify.
May i know what is the difference between 10g n 11g?
Also, y do i need to take 2 exams for 11g but onli 1 exam for 10g???
Lastly, is it possible to SELF STUDY for OCA as i do not have any oracle experience. Only have MS sql experience.
Thank Youhi thanks for your valued info.
But why is there only 1 exam needed for 10g and 2 for 11g?Oracle removed the 'SQL for beginners' exam for the 10g series. That [to me at least] proved to be a mistake as too many people were attempting to get certified without even beginner knowledge of the very language that runs the Oracle database platform. They restored that exam. Now there is verification that the OCA candidate at least can spell SQL, SELECT, UPDATE and so on, and might even be able to use the tools provided.
>
Based on your view, do u think i should start all
over from 9i then slowly upgrade or, take 11g directly?
Pls advise:)I think you should think about your future. Make a decision for yourself based on that. Does you future include Oracle9i DB? Is it important for you to verify that you understand Oracle9i DB?
Many people mistakenly think the purpose of the exam is to get a certificate. I disagree ... I think the purpose of certification is to verify - to yourself and to others - that you are aware of, and potentially understand, the material. (If you use brain dumps, or gunners, or other ways of cheating, you are not verifying that awareness or understanding and will eventually be caught - by your colleagues, your boss, or perhaps by yourself when you look at your reflection in the morning mirror.)
If you do not want to verify your knowledge about 9i, don't bother. -
Tree creation algorithm needed. Experts pls help
hi,
I'm writing a program that read data from database to create a Tree.
The database table:
DATA PREDATA POSTDATA
1 4 5
2 6 7
3 1 2
4 8 9
If the DATA has a PREDATA, it will be inserted into the left node otherwise null and POSTDATA will be inserted into right node. For example if I pass in 3 the Tree should look like the following:
3
1 2
4 5 6 7
8 9 null null null
ThanksThis is a fairly straighforward problem but I see two possible problems.
1) There could be more than one root. Any row with identifier that is never used as pre or post is a root.
2) If a row identifier is used more than once as pre or post then one no longer has a simple binary tree.
Dealing with 1) is easy - just have a set of roots. Dealing with 2) is not so easy.
My solution follows. It deals with 1 but not 2.
import java.util.*;
public class Test20040622
static String[][] testData =
{"1","4","5"},
{"2","6","7"},
{"3","1","2"},
{"4","8","9"},
static class TreeElement
TreeElement(String value, Object pre, Object post)
this.value = value;
this.pre = pre;
this.post = post;
public String toString()
return value;
String value;
Object pre;
Object post;
private Set treeRoots;
public Test20040622()
HashMap map = new HashMap();
// Build a map pointing from id to TreeElement
for (int rowIndex = 0; rowIndex < testData.length; rowIndex++)
String[] row = testData[rowIndex];
map.put(row[0], new TreeElement(row[0], row[1], row[2]));
// The set of keys to the TreeElements
treeRoots = new HashSet(map.keySet());
// Go through each of the elements replacing the
// pre and post String with the corresponding TreeElement
for (Iterator it = map.values().iterator(); it.hasNext();)
TreeElement treeElement = (TreeElement)it.next();
if (treeElement.pre instanceof String)
treeRoots.remove(treeElement.pre);
Object pre = map.get(treeElement.pre);
if (pre != null)
treeElement.pre = pre;
if (treeElement.post instanceof String)
treeRoots.remove(treeElement.post);
Object post = map.get(treeElement.post);
if (post != null)
treeElement.post = post;
// Convert the tree root Strings to TreeElements
HashSet roots = new HashSet();
for (Iterator it = treeRoots.iterator(); it.hasNext();)
roots.add(map.get(it.next()));
treeRoots = roots;
public void print()
for (Iterator it = treeRoots.iterator(); it.hasNext();)
printOne(it.next(), 0);
private void printOne(Object leaf, int level)
if (leaf instanceof TreeElement)
printOne( ((TreeElement)leaf).pre, level+1);
for (int i = 0; i < level; i++)
System.out.print(" ");
System.out.println(leaf);
if (leaf instanceof TreeElement)
printOne(((TreeElement)leaf).post, level+1);
public static void main(String[] args)
new Test20040622().print();
} -
Expert pls help: Sun IDM with ldap active sync
Hi all,
Currently i am configuring Sun IDM 6.0 SP1 to active sync with Sun directory server. I have enabled Retro Change Log but yet i cant find my changeNumber in directory server. Could anyone show me a way (search?) to get what changeNumber directory server currently running?Check the account used by IDM to access DS can search cn=changelog branch. If he is not Directory Manager, you probably need to set an ACI on that branch.
HTH
Maybe you are looking for
-
IPod nano recognized in MY Computer but not in iTunes
My iPod nano is recognized under My Computer but not in iTunes. I formaatted the iPod nano as FAT32 using the format option when right-clicking on the drive in My Computer. I installed the latest version of iTunes software. I adopted the five R's app
-
Can I partition a drive in Disk Utility without erasing files?
Hello, According to the third screenshot, I have the option of partitioning an external drive without losing files already on it, but when I try to do so, I only get a message indicating that it will erase the disk: http://osxdaily.com/2009/11/20/re
-
Getting a subset of results.
I am hoping someone can help me on this, because i really see no other way to do what i need to do. Is there ANY way, to be able to return ONLY the first X records of a SQL statement... say for example the first 5 records, or the first one record. I
-
App Store purchased items will not open
I can not access my purchased items through the Apps Store. I go to Updates and click on Purchased and it looks like its loading and then it just goes blank and takes me out of the Apps Store completely. Can any help me or tell me why this is happeni
-
Sony alpha 7/ 7R RAW files
Can the Sony alpha 7/7R RAW files be processed with Camera Raw CC?