SQL Query, please help very urgent
I am a newbie is sql.
I have two tables called test_master and test_detail.
Both tables contains pos_id as common field.
In test_detail got sub_id and to get the people under a given pos_id, I join with pos_id of test_master.
In the where condition, when I give the pos_id, it's returning only
the first level. How can I get the second level and get all the levels?
Any help is highly appreciable.It's very urgent.
Looking forward to hear from you.
Thanks
Newbie
Ok, I am pasting the description of the master and detail in the order.
Master
EMPLOYEE_NO VARCHAR2(30)
ORGANIZATION_ID NUMBER(15)
ORGANIZATION_NAME VARCHAR2(240)
POSITION_ID NUMBER(15)
POSITION_NAME VARCHAR2(240)
Detail
POSITION_ID NUMBER(15)
SUBORDINATE_ID NUMBER(15)
ORGANIZATION_ID NUMBER(15)
POSITION_NAME VARCHAR2(50)
Here is the sql, I want to get all the subordinates under a given position_id of the master.
Looking forward to hear from you.
select a.employee_no,a.POSITION_ID,a.POSITION_NAME,a.EMPLOYEE_NAME,
b.position_id,b.subordinate_id from portal_employee_master_test a,
portal_structure_test b
where a.POSITION_ID = b.POSITION_ID and a.POSITION_ID='xyz'
and b.position_ID=a.POSITION_ID
Similar Messages
-
Cluster bar chart- sql query please help-
Hi,
I am trying to create cluster bar chart and am stumped with this sql query.Any help is appreciated.
Here is my table
city region issue value
c1 north i1 y
c1 north i2 y
c2 north i1 n
c2 north i2 y
c3 south i1 y
c3 south i2 n
c4 east i1 n
c4 east i2 n
The bar chart will have 3 series, north south and east.
And labels will be i1 and i2. value will be number of times this issue was encountered(y) in this region.
How can I get something like this from the above table-
region issue count(yes)
north i1 1
north i2 2
south i1 1
south i2 0
east i1 0
east i2 0
thanksWITH table1 AS
(SELECT 1435177 qte_id, 2 seq_no
FROM dual
UNION ALL
SELECT 1435177 qte_id, 5 seq_no
FROM dual
UNION ALL
SELECT 1435177 qte_id, 7 seq_no
FROM dual
UNION ALL
SELECT 1435177 qte_id, 8 seq_no
FROM dual
UNION ALL
SELECT 1435177 qte_id, 12 seq_no
FROM dual
UNION ALL
SELECT 1435177 qte_id, 14 seq_no
FROM dual
table2 AS
SELECT 1435177 qte_id, 1 seq_no, 98500 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 2 seq_no, 98500 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 3 seq_no, 0 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 4 seq_no, 98500 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 5 seq_no, 98500 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 7 seq_no, 98500 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 8 seq_no, 98500 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 11 seq_no, 59300 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 12 seq_no, 59300 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 14 seq_no, 59300 cmmt_curr_amt
FROM dual
SELECT qte_id, t2_seq_no, cmmt_curr_amt - cmmt_curr_lag diff
FROM
(SELECT t2.qte_id, t2.seq_no t2_seq_no, t1.seq_no t1_seq_no, cmmt_curr_amt, LAG(cmmt_curr_amt,1,0) OVER (PARTITION BY t2.qte_id ORDER BY t2.seq_no) cmmt_curr_lag
FROM table1 t1, table2 t2
WHERE t2.qte_id = t1.qte_id (+)
AND t2.seq_no = t1.seq_no(+)
ORDER BY 1,2
WHERE t1_seq_no IS NOT NULL
ORDER BY 1,2
QTE_ID T2_SEQ_NO DIFF
1435177 2 0
1435177 5 0
1435177 7 0
1435177 8 0
1435177 12 0
1435177 14 0 -
Problem with Accessing Deployed Servlets Please help, very urgent.
Inspite of going through lots of Docs. I am not able to access the JSP which is deployed using JDeveloper 3.2 in the browser? What should be the URL and where should I place the JSP and the related files in the Apache Server (Specific directory)?
Please help, this is very Urgent.
Could I get some sites where I can get detailed description of how to deploy and access Servlets and JSPS using JDeveloper 3.2 for OAS 9i?
Thanks in advance,
Regards,
Kavita.
nullHi Kativa,
In answer to your first question: In most apache installs, you want to place all your JSPs under the Apache/htdocs directory. This htdocs directory becomes the root directory of your HTTP request, so, for example, to access the file
Apache/htdocs/mydir/myJSP.jsp
you'd point your browser to
server:port/mydir/myJSP.jsp]http://server:port/mydir/myJSP.jsp
As to your second question: Do you mean Oracle 9iAS? If so, look at this HOWTO: http://technet.oracle.com:89/ubb/Forum2/HTML/006398.html
JDeveloper 3.2 does not support deployment to OAS (the predecessor to iAS), but there was no OAS 9i.
null -
Passing parameter to a SQL query - Please help
Hi All,
I am new to JDBC. I have been trying to pass an external variable to an SQL Query.
The query is
String username1="le";
PreparedStatement pstmt = null;
pstmt = c.prepareStatement("select * from users where USER_NAME like '%?%'");
pstmt.setString(1, username1);
pstmt.executeQuery();
ResultSet rs = pstmt.getResultSet();
I am trying to retrieve values from the users table where the USER_NAME column value that is a String contains the supplied value username1.
I am using the question mark (?) character to pass the value from the variable username1. I am also using the '%' substitution character which matches for any number of characters. So, the above query should retrieve rows where the USER_NAME is something like "charles","leander","Elena" etc.( that contains "le")
I am getting the error:
SQLException: java.sql.SQLException: ORA-01006: bind variable does not exist
I changed the query to
PreparedStatement pstmt = null;
pstmt = c.prepareStatement("select * from users where USER_NAME like '% " + username1 + "%'");
//pstmt.setString(1, username1);
pstmt.executeQuery();
This time , it is not giving the error and retrieving properly.
But I want to use the original query and use the "pstmt.setString(1, username1); " . Is there any way of achieving this?
Please help.
Cheers,
charles_amhi,
try this...
String username1="%le%";
pstmt = c.prepareStatement("select * from users where USER_NAME like ?")
pstmt.setString(1,username1);
cheers,
rpk -
Hi experts,
what i want to do is write a single query which will show whether a employee
exits in the company or not.I have two tables emp and dept.There are as follows.
SQL> select * from emp;
NAME DEPTNO EMPNO
xxx 10 33036
YYY 12 2345
ZZZ 13 678
KKK 14 5678
RRR 15 7865
SQL> select * from dept;
DEPTNO LOCATION
10 AAA
11 BBB
12 CCC
13 DDD
what i want is it will select records from the emp table and find whether corrosponding
deptno really exists in the dept table.If the value is found in deptno column the dept table then it will set the value
Y other wise it will be N and all i have to do with the help of a single query.
expected result
name empno exists
xxx 33036 Y
YYY 2345 Y
ZZZ 678 Y
KKK 5678 N
RRR 7865 N
Please help.
Regards
RajatSELECT EMPNO, NAME , EMPNO , NVL( ( SELECT 'Y' FROM DEPT WHERE EMP.DEPTNO=DEPT.DEPTNO),'N') EXIST
FROM EMP
ORDER BY 1
Demo
SQL> WITH EMP AS(
2 SELECT 'XXX' NAME , 10 DEPTNO ,33036 EMPNO FROM DUAL UNION
3 SELECT 'YYY', 12, 2345 FROM DUAL UNION
4 SELECT 'ZZZ', 13 ,678 FROM DUAL UNION
5 SELECT 'KKK', 14 ,5678 FROM DUAL UNION
6 SELECT 'RRR', 15 ,7865 FROM DUAL ),
7 DEPT AS(
8 SELECT 10 DEPTNO,'AAA' DNAME FROM DUAL UNION
9 SELECT 11 ,'BBB' FROM DUAL UNION
10 SELECT 12 ,'CCC' FROM DUAL UNION
11 SELECT 13 ,'DDD'FROM DUAL )
12 SELECT EMPNO, NAME , EMPNO , NVL( ( SELECT 'Y' FROM DEPT WHERE EMP.DEPTNO=DEPT.DEPTNO),'N')
EXIST
13 FROM EMP
14 ORDER BY 1
15 /
EMPNO NAM EMPNO E
678 ZZZ 678 Y
2345 YYY 2345 Y
5678 KKK 5678 N
7865 RRR 7865 N
33036 XXX 33036 Y
SQL> Edited by: Salim Chelabi on Dec 7, 2008 4:15 AM -
Table1
QTE_ID SEQ_NO
1435177 2
1435177 5
1435177 7
1435177 8
1435177 12
1435177 14
Table2
QTE_ID SEQ_NO CMMT_CURR_AMT
1435177 1 98500
1435177 2 98500
1435177 3 0
1435177 4 98500
1435177 5 98500
1435177 7 98500
1435177 8 98500
1435177 11 59300
1435177 12 59300
1435177 14 59300
The result should be
QTE_ID SEQ_NO CMMT_CURR_AMT
1435177 2 0 (where 0 = cmmt_curr_amt of seq 2 - cmmt_curr_amt of seq 1 from table 2)
1435177 5 0 (where 0 = cmmt_curr_amt of seq 5 - cmmt_curr_amt of seq 4 from table 2)
1435177 7 0 (where 0 = cmmt_curr_amt of seq 7 - cmmt_curr_amt of seq 5 from table 2)
1435177 8 0 (where 0 = cmmt_curr_amt of seq 8 - cmmt_curr_amt of seq 7 from table 2)
1435177 12 0 (where 0 = cmmt_curr_amt of seq 12 - cmmt_curr_amt of seq 11 from table 2)
1435177 14 0 (where 0 = cmmt_curr_amt of seq 14 - cmmt_curr_amt of seq 12 from table 2)
I have to get the difference of cmmt_curr_amt from the table2 from seq 14 to seq 12 for seq14 in table 1.
Please help me in writing the query.
Thanks in advance.
SrinivasWITH table1 AS
(SELECT 1435177 qte_id, 2 seq_no
FROM dual
UNION ALL
SELECT 1435177 qte_id, 5 seq_no
FROM dual
UNION ALL
SELECT 1435177 qte_id, 7 seq_no
FROM dual
UNION ALL
SELECT 1435177 qte_id, 8 seq_no
FROM dual
UNION ALL
SELECT 1435177 qte_id, 12 seq_no
FROM dual
UNION ALL
SELECT 1435177 qte_id, 14 seq_no
FROM dual
table2 AS
SELECT 1435177 qte_id, 1 seq_no, 98500 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 2 seq_no, 98500 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 3 seq_no, 0 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 4 seq_no, 98500 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 5 seq_no, 98500 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 7 seq_no, 98500 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 8 seq_no, 98500 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 11 seq_no, 59300 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 12 seq_no, 59300 cmmt_curr_amt
FROM dual
UNION ALL
SELECT 1435177 qte_id, 14 seq_no, 59300 cmmt_curr_amt
FROM dual
SELECT qte_id, t2_seq_no, cmmt_curr_amt - cmmt_curr_lag diff
FROM
(SELECT t2.qte_id, t2.seq_no t2_seq_no, t1.seq_no t1_seq_no, cmmt_curr_amt, LAG(cmmt_curr_amt,1,0) OVER (PARTITION BY t2.qte_id ORDER BY t2.seq_no) cmmt_curr_lag
FROM table1 t1, table2 t2
WHERE t2.qte_id = t1.qte_id (+)
AND t2.seq_no = t1.seq_no(+)
ORDER BY 1,2
WHERE t1_seq_no IS NOT NULL
ORDER BY 1,2
QTE_ID T2_SEQ_NO DIFF
1435177 2 0
1435177 5 0
1435177 7 0
1435177 8 0
1435177 12 0
1435177 14 0 -
How can maintain log file Please help Very Urgent.
I am developping an application in PDK. From my application I need maintain a log file in the server side. Please help me how can I do this. If you do have links regarding this matter please pass it.
You might want to use the SAP Logging API. see
<a href="http://help.sap.com/saphelp_nw04s/helpdata/en/d2/5c830ca67fd842b2e87b0c341c64cd/frameset.htm">Logging and Tracing</a>
In NWDS include a reference to logging.jar (use variable SAP_LOGGING_LIB_HOME).
You can then write to the log in this way:
public class Xyz {
private static final Location TRACE = Location.getLocation(Xyz.class);
// It is not nice to set the severity in static code - only for demonstration purposes.
// For production-ready code this should be done via a log-configuration.xml
// to allow configuration of the severity at runtime.
TRACE.setEffectiveSeverity(Severity.ALL);
public void myMethod() {
final String METHOD = "myMethod()";
TRACE.entering(METHOD);
TRACE.debugT("whatever");
TRACE.exiting(METHOD); -
I need to denormalize data in sql query, please help!
With the query
select ref, start_time, end_time, person
from appointments
I get, eg:
REF START_TIME END_TIME PERSON
1234 10:00 11:00 USER1
1234 10:00 11:00 USER2
The users want to see it like this:
REF START_TIME END_TIME PERSON
1234 10:00 11:00 USER1, USER2
How do I do this just in sql?
cheers
Tracey.Apologies, my mistake, I forgot to connect by the ref as well...
(Note: you can ignore the CAST to VARCHAR2(40) as that just helped me get the formatted output.)
SQL> ed
Wrote file afiedt.buf
1 with t as (select 1234 as ref, '10:00' as start_time, '11:00' as end_time, 'USER1' as person from dual union all
2 select 1234, '10:00', '11:00', 'USER2' from dual union all
3 select 345, '11:00', '12:00', 'USER3' from dual)
4 -- END OF TEST DATA
5 select ref, start_time, end_time, CAST(MAX(LTRIM(SYS_CONNECT_BY_PATH(person,', '),', ')) AS VARCHAR2(40)) as users
6 from (select ref, start_time, end_time, person
7 ,row_number() over (partition by ref, start_time, end_time order by person) rn
8 from t) t
9 CONNECT BY rn = PRIOR rn+1 AND ref = PRIOR ref
10 START WITH rn = 1
11* GROUP BY ref, start_time, end_time
SQL> /
REF START END_T USERS
1234 10:00 11:00 USER1, USER2
345 11:00 12:00 USER3
SQL> -
Response already commited error. Please help very urgent
Hello,
I am getting "RESPONSE HAS ALREADY BEEN COMMITED" error, when I open a report.
Please explain why do the get this error and how can I prevent it from coming.
Thanks in advance.
RaghuCan't really give much more than general guidelines as you haven't provided that much information.
A stack trace indicating what caused the "response already commited" error would be useful in diagnosis...
HTTP is one request, one response.
You get a request, you can only send one response to it.
When dealing with a JSP your response html text gets written to a buffer, and then to the output stream.
You can change your response output any time until the output is committed.
The response gets committed if
- the buffer fills up with data. The default size of the buffer on a JSP page is 8kb If more than 8kb of data is written, then it will commit the response. You can change the size of the buffer with the [<%@ page %> directive|http://java.sun.com/products/jsp/syntax/2.0/syntaxref2010.html#15653]
- you flush the output buffer manually
What sort of things cause the buffer to be cleared and reset? Anything that changes your response completely.
The obvious causes:
- a jsp:forward
- a response.sendRedirect
- an exception that tries to load the error page.
How to prevent it?
1 - if you are going to forward or redirect from a jsp page do it as early as possible in the page to prevent the buffer filling up.
2 - just because you issued a <jsp:forward> doesn't necessarily mean the page has stopped executing. Put it in an if/else block or similar so that after it does the forward/redirect it doesn't keep executing that same page. -
Please help(Very Urgent)
Hi,
Iam facing with one problem I can upload file upto 40mb by running my swing interface(java -Xmx256m ActionDemo4).If I select above 40mb size of file then it giving me Error on Dos-Prompt(java.lang.OutOfMemory).Now I increase jvm memory by
(-Xmx540m)then my swing Interface run perfectly but when I select file size above 40mb then my machine hanged(Then It is not giving me Error on Dos-prompt) and giving me Error by system[your system running on low virtual machine.Plz close some application or add additional paging file or increase size of paging file of virtual memory]. My machine spesification:-
Operating system:-winNT4.0(Service Pack4.0)
Ram:-256mb
Processor:-Pentium-3
Hard-disk:-20GB
I try to configure my machine like that:-
Settings-Control Panel-System-Performance-VirtualMemory:-I changed in
1.Paging File size for selected Drive:-
Drive C:
Space Available: 834MB
Initial Size: 256MB
Maximum Size: 306MB
Drive D:
Space Available: 7870MB
Initial Size: 14MB
Maximum Size: 14MB
2.Total paging file for all Drives:-
Minimum Allocated: 2MB
Recommened: 267MB
Currently Allocated: 270MB
3.Registry Size:-
Current Registry Size: 13MB
Maximum Registry size: 60MB
But I couldn't slove my Problem.Plz Guide me How I can slove my problem.Excepting Quick Reply.
With Best Regards
BikashIncrease your virtual paging memory to about 512m. This will give you a total of 768m.
This is accessed via control panel->system->performance on NT. Other windows boxes vary slightly. -
I need sql query please help me out
I have two databases 1) erp 2) edusource
In erp database i have table master tables and columns like RecordId , value type ,Feildtext,description,Meaining,parentid etc
data stores based on value type like
1
Country
In
India
NULL
NULL
True
2
Country
Aus
Austrilia
NULL
NULL
True
3
Country
Usa
United States of America
NULL
NULL
True
4
Country
Uk
Great Britian
NULL
NULL
True
5
State
AP
Andhrapradesh
NULL
1
True
6
State
MH
Maharastha
NULL
1
True
7
State
TN
Tamilnadu
NULL
1
True
8
State
Sdy
Sydney
NULL
2
True
9
State
MEL
Melbourne
NULL
2
True
10
Location
IN-Hyd
Hyderabad
NULL
1
True
11
Location
In SEz
Sez-Hyderabad
NULL
1
True
NULL
NULL
NULL
NULL
NULL
NULL
NULL
for country and state we have a relation ship parentid and recordid
country
1 Country
In India
NULL
NULL 1
2 Country
Aus Austrilia
NULL
NULL 1
3 Country
Usa United States of America NULL
NULL 1
4 Country
Uk Great Britian
NULL
NUL 1
5 State
AndhraPradesh Ap
NULL 1
1
6 State
Maharastha MH
NULL 1
1
7 State
Tamilnadu TN
NULL 1
1
8 State
Sydney Sdy NULL
2 1
9 State Melbourne MEL
NULL 2
1
in edusource database i have location and columns like countryname,statename,feildtext,descriptiom,isactive
i need to insert data in edusource
database of tbl_ maplocation from that that databaseTry this out:
DECLARE @geog TABLE (ID INT, type VARCHAR(20), Abrev VARCHAR(6), name VARCHAR(30), parentID INT, Active VARCHAR(5))
INSERT INTO @geog (ID, type, Abrev, name, parentID, Active) VALUES
(1 , 'Country' ,'In ', 'India ', NULL, 'TRUE'),(2 , 'Country' ,'Aus ', 'Austrilia ', NULL, 'TRUE'),
(3 , 'Country' ,'Usa ', 'United States of America', NULL, 'TRUE'),(4 , 'Country' ,'Uk ', 'Great Britian ', NULL, 'TRUE'),
(5 , 'State' ,'AP ', 'Andhrapradesh ', 1 , 'TRUE'),(6 , 'State' ,'MH ', 'Maharastha ', 1 , 'TRUE'),
(7 , 'State' ,'TN ', 'Tamilnadu ', 1 , 'TRUE'),(8 , 'State' ,'Sdy ', 'Sydney ', 2 , 'TRUE'),
(9 , 'State' ,'MEL ', 'Melbourne ', 2 , 'TRUE'),(10 , 'Location' ,'IN-Hyd', 'Hyderabad ', 1 , 'TRUE'),
(11 , 'Location' ,'In SEz', 'Sez-Hyderabad ', 1 , 'TRUE')
SELECT g1.ID, COALESCE(g2.name,g1.name) AS countryName, g1.name AS stateName, g1.name AS fieldText, CASE WHEN COALESCE(g2.Active,'TRUE') = 'TRUE' AND g1.Active = 'TRUE' THEN 'TRUE' ELSE 'FALSE' END AS Active
FROM @geog g1
LEFT OUTER JOIN @geog g2
ON g1.parentID = g2.ID
AND g1.type IN ('location','state')
WHERE g1.Active = 'TRUE'
AND COALESCE(g2.Active,'TRUE') = 'TRUE'
I think you may want to further the relationship, and have 10 be the parent for 11, so you can get country, state, location. -
Error Pl help-Very urgent!
Am getting the following error.Please help very urgent
500 Translator.CompilationFailedExceptionCompiler errors:
Found 1 semantic error compiling "D:/JRun4/servers/default/default-ear/default-war/WEB-INF/jsp/jrun__quicklinks2ejspf.java":
502. for (Enumeration e = prioLinkBean.getGlobalTop() ; e.hasMoreElements() ;)
<---------->
*** Error: "prioLinkBean" is either a misplaced package name or a non-existent entity.
Translator.CompilationFailedExceptionCompiler errors:
Found 1 semantic error compiling "D:/JRun4/servers/default/default-ear/default-war/WEB-INF/jsp/jrun__quicklinks2ejspf.java":
502. for (Enumeration e = prioLinkBean.getGlobalTop() ; e.hasMoreElements() ;)
<---------->
*** Error: "prioLinkBean" is either a misplaced package name or a non-existent entity.prioLinkBean.getGlobalTop();
are u sure this method returns an Enumeration ???
post ur code!
[email protected] -
Please i need help very urgent !!! after deleting my exchange account because the company changed the password , I lost 150 200 contacts and i need to get them back very soon ! i never backed up on itunes ..please help
No. The contacts are "owned" by the Exchange server.
The Exchange server is owned by the company.
Everything on the Exchange server is owned by the company.
If you quit or were terminated, and your access to the system has been revoked, then there is nothing you and do at this point. Once you deleted the account from your phone, all of the associated data was deleted.
NEVER store personal information on company systems. -
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> -
How to improve the performance of the attached query, Please help
Hi,
How to improve performance of the below query, Please help. also attached explain plan -
SELECT Camp.Id,
rCam.AccountKey,
Camp.Id,
CamBilling.Cpm,
CamBilling.Cpc,
CamBilling.FlatRate,
Camp.CampaignKey,
Camp.AccountKey,
CamBilling.billoncontractedamount,
(SUM(rCam.Impressions) * 0.001 + SUM(rCam.Clickthrus)) AS GR,
rCam.AccountKey as AccountKey
FROM Campaign Camp, rCamSit rCam, CamBilling, Site xSite
WHERE Camp.AccountKey = rCam.AccountKey
AND Camp.AvCampaignKey = rCam.AvCampaignKey
AND Camp.AccountKey = CamBilling.AccountKey
AND Camp.CampaignKey = CamBilling.CampaignKey
AND rCam.AccountKey = xSite.AccountKey
AND rCam.AvSiteKey = xSite.AvSiteKey
AND rCam.RmWhen BETWEEN to_date('01-01-2009', 'DD-MM-YYYY') and
to_date('01-01-2011', 'DD-MM-YYYY')
GROUP By rCam.AccountKey,
Camp.Id,
CamBilling.Cpm,
CamBilling.Cpc,
CamBilling.FlatRate,
Camp.CampaignKey,
Camp.AccountKey,
CamBilling.billoncontractedamount
Explain Plan :-
Description Object_owner Object_name Cost Cardinality Bytes
SELECT STATEMENT, GOAL = ALL_ROWS 14 1 13
SORT AGGREGATE 1 13
VIEW GEMINI_REPORTING 14 1 13
HASH GROUP BY 14 1 103
NESTED LOOPS 13 1 103
HASH JOIN 12 1 85
TABLE ACCESS BY INDEX ROWID GEMINI_REPORTING RCAMSIT 2 4 100
NESTED LOOPS 9 5 325
HASH JOIN 7 1 40
SORT UNIQUE 2 1 18
TABLE ACCESS BY INDEX ROWID GEMINI_PRIMARY SITE 2 1 18
INDEX RANGE SCAN GEMINI_PRIMARY SITE_I0 1 1
TABLE ACCESS FULL GEMINI_PRIMARY SITE 3 27 594
INDEX RANGE SCAN GEMINI_REPORTING RCAMSIT_I 1 1 5
TABLE ACCESS FULL GEMINI_PRIMARY CAMPAIGN 3 127 2540
TABLE ACCESS BY INDEX ROWID GEMINI_PRIMARY CAMBILLING 1 1 18
INDEX UNIQUE SCAN GEMINI_PRIMARY CAMBILLING_U1 0 1Hello,
This has really nothing to do with the Oracle Forms product.
Please, send the SQL or/and PL/SQL questions in the corresponding forums.
Francois
Maybe you are looking for
-
Setting up a small office network - advice needed
We are to move our small office (3 people) from a shared office environment to our own office space. That has the huge advantage that we´ll finally be Mac-only, but the agreeable disadvantage that there is no longer a networking professional around.
-
I don't really know much about actionscript, but I want the login page to show up when the movie start, to go away when someone logs in and to come back if someone logs out. I also want the pages to appear dynamically and not use goToAndStop or .vis
-
Hi, It appears that a URL can't be called from a menu using the Portal toolset because the get_menu_link function doesn't work in this release. You get an insufficient privilege error. This is now a bug, #1852576, which development is working on. Doe
-
My Faces t:panelTabbedPane Background Color Issue.
Hi I am using the <t:panelTabbedPane> and <t:panelTab>. I am trying to applying below mentioned CSS for the background color for tabs. .tabpanel{position:absolute; cursor:hand; font-weight: bold; text-align: center; border: 1px; border-color:#ffffff;
-
Facetime not working after Mountain Lion update
I have a Macbook Pro. After I updated to Mountain Lion (from Lion), Facetime no longer works. I've tried with multiple people, but they aren't receiving my calls and I'm not receiving their calls. In Lion Facetime worked fine, but now it's not workin