With out using order by clause
display the details of the employees with sal in descending order, without using order by clause
Don't forget that it's just for fun :)Well it's not entirely for fun :-)
There are real life users who might have real production problems and the rely and input/feedback from this forum.
I do not :)You spread untested answers/knowledge that might be wrong.
I can't imagine where you can see cartesian. It's
equijoin by primary key.I suggest you test it.
JFUI hierarchy is built after joining. And this
hierarchy is bamboo-tree. So result must be sorted
acording hierarchy.I know what hierarchical ordering is :-)
And here's a little test i did on your behalf, on the EMP table :-)
select e1.*
from e e1,
( select e2.id, count(*) as rn from e e2, e e3
where e3.sal >= e2.sal
and e3.id >= e2.id
group by e2.id
) e4
where e1.id = e4.id
start with e4.rn = 1
connect by e4.rn = prior e4.rn + 1
SQL*Plus: Release 10.1.0.4.2 - Production on Wed Jul 25 16:02:19 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter user-name: scott/tiger
Connected to:
Oracle Database 10g Release 10.2.0.1.0 - Production
SCOTT@ORCL> set lines 1000
SCOTT@ORCL>
SCOTT@ORCL>
SCOTT@ORCL> select emp1.*
2 from emp emp1,
3 ( select emp2.empno, count(*) as rn from emp emp2, emp emp3
4 where emp3.sal >= emp2.sal
5 and emp3.empno >= emp2.empno
6 group by emp2.empno
7 ) emp4
8 where emp1.empno = emp4.empno
9 start with emp4.rn = 1
10 connect by emp4.rn = prior emp4.rn + 1;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7839 KING PRESIDENT 17-DEC-80 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7788 SCOTT ANALYST 7566 09-DEC-82 3000 20
7566 JONES MANAGER 7839 02-APR-81 2975 20
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7876 ADAMS CLERK 7788 12-JAN-83 1100 20
7566 JONES MANAGER 7839 02-APR-81 2975 20
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7900 JAMES CLERK 7698 03-DEC-81 950 30
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7566 JONES MANAGER 7839 02-APR-81 2975 20
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7902 FORD ANALYST 7566 3000 20
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7788 SCOTT ANALYST 7566 09-DEC-82 3000 20
7566 JONES MANAGER 7839 02-APR-81 2975 20
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7876 ADAMS CLERK 7788 12-JAN-83 1100 20
7566 JONES MANAGER 7839 02-APR-81 2975 20
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7900 JAMES CLERK 7698 03-DEC-81 950 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7934 MILLER CLERK 7782 1301 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7788 SCOTT ANALYST 7566 09-DEC-82 3000 20
7566 JONES MANAGER 7839 02-APR-81 2975 20
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7876 ADAMS CLERK 7788 12-JAN-83 1100 20
7566 JONES MANAGER 7839 02-APR-81 2975 20
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7900 JAMES CLERK 7698 03-DEC-81 950 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
42 rows selected.
SCOTT@ORCL>Regards,
Tony
Similar Messages
-
Difference Ref cursor with/with out using clause
Hi everyone,
When I am using dynamic sql with USING clause ,the results are not sorted in Ascending order.
DECLARE
TYPE emp_refcursor IS REF CURSOR;
emp_rc emp_refcursor;
TYPE v_emp_id IS TABLE OF number INDEX BY PLS_INTEGER;
TYPE v_last_name IS TABLE OF varchar2(50) INDEX BY binary_integer;
V_empno v_emp_id;
v_ename v_last_name;
p_deptno number := &U_DEPTNO;
v_limit number := 10;
v_ordcolumn varchar2(20) := 'employee_id';
v_stmt varchar2(1000);
BEGIN
v_stmt :=
'select employee_id,last_name from employees
where department_id = :x order by :y ';
dbms_output.put_line(v_stmt);
OPEN emp_rc FOR v_stmt USING p_deptno,v_ordcolumn;
LOOP
FETCH emp_rc BULK COLLECT INTO v_empno,v_ename LIMIT v_limit;
EXIT WHEN v_empno.count = 0;
FOR I IN v_empno.first .. v_empno.last
LOOP
dbms_output.put_line(v_empno(i)||' '||v_ename(i));
END LOOP;
END LOOP;
END;
When I use dynamic sql with out USING cluase,results are sorted in Ascending order.
DECLARE
TYPE emp_refcursor IS REF CURSOR;
emp_rc emp_refcursor;
TYPE v_emp_id IS TABLE OF number INDEX BY PLS_INTEGER;
TYPE v_last_name IS TABLE OF varchar2(50) INDEX BY binary_integer;
V_empno v_emp_id;
v_ename v_last_name;
p_deptno number := &U_DEPTNO;
v_limit number := 10;
v_ordcolumn varchar2(20) := 'employee_id';
v_stmt varchar2(1000);
BEGIN
v_stmt :=
'select employee_id,last_name from employees
where department_id = '||p_deptno ||
' order by '||v_ordcolumn;
dbms_output.put_line(v_stmt);
OPEN emp_rc FOR v_stmt;
LOOP
FETCH emp_rc BULK COLLECT INTO v_empno,v_ename LIMIT v_limit;
EXIT WHEN v_empno.count = 0;
FOR I IN v_empno.first .. v_empno.last
LOOP
dbms_output.put_line(v_empno(i)||' '||v_ename(i));
END LOOP;
END LOOP;
END;
P.S :---- department_id (used) = 50;
Please can some one explain why this is happening like this.
Thanks
Raghu
--------------------------------------------------------------------------------Hi sundar,
I am new to oracle and learning/trying to get the same output by using differnt methods,rather than using FOR LOOP ,I tried to use ref cursor with dynamic sql.I am in a belief that ref cursor's with dynamic sql are faster than FOR LOOP,irrespective of the size of data.Can you correct me if I am wrong.
Coming back to ur reply,how should my statement look like,when using ref cursor
with USING claus to sort data by asc/desc order.
Thanks in advance
Raghu -
Opening and closing stock with sales order and with out sales order
hello,
any body please help me my client want to check opening stock and and closing stock in areport.
material contains batch and some material with sales order and some are with out sales order. my client is asking this in a single layout. please tell me isthere any teport or bapi or function module to get this report.
this is very uregent. and layout is requesting like opening stock, production stock, sales stock and closing stock.
please guide me to get this report.
Thanks & Regads
BhaktaTransaction MB5B
For sales order related use specila stock as E and use radio button indicator in stock type
For stock w/o sales order, use special stock indiactor as "space' and stock type valuated stock.
to get a perticular month,opening stock/closing stock enter the start date/end date as month start and end date.
See the o/p which will give the stock as required by you -
How To Split File In to Multiple Files With out using B.P.M
Hi Guys,
How To Split File In to Multiple Files With out using B.P.M.
Thanks in advance
Regards's
KIran.BHello
below r the links were u will find message spilitting by graphicaaly i.e without using BPM.
/people/claus.wallacher/blog/2006/06/29/message-splitting-using-the-graphical-mapping-tool
Sender File Adapter with file conversion Multimapping --file content conversion with split messg mapping
https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2748---- [original link is broken] [original link is broken] [original link is broken]
multimappig
/people/narendra.jain/blog/2005/12/30/various-multi-mappings-and-optimizing-their-implementation-in-integration-processes-bpm-in-xi
hope this resolve your problem
thank's
Chetan -
Please suggest a select query / sub query with out using any subprograms or
source table: Three columns ORIGIN, DESTINATION,MILES
Origin Destination Miles
Sydney Melbourne 1000
Perth Adelaide 3000
Canberra Melbounre 700
Melbourne Sydney 1000
Brisbane Sydney 1000
Perth Darwin 4000
Sydney Brisbane 1000
out put :Three columns ORIGIN, DESTINATION,MILES
Duplicate routes are to be ignored so the output is
Origin Destination Miles
Sydney Melbourne 1000
Perth Adelaide 3000
Canberra Melbounre 700
Brisbane Sydney 1000
Perth Darwin 4000
Please suggest a select query / sub query with out using any subprograms or functions/pkgs to get the out put table.Hi,
user9368047 wrote:
... Please suggest a select query / sub query with out using any subprograms or functions/pkgs to get the out put table.Why? If the most efficient way to get the results you want involves using a function, why wouldn't you use it?
Here's one way, without any functions:
SELECT a.*
FROM source_table a
LEFT OUTER JOIN source_table b ON a.origin = b.destination
AND a.destination = b.origin
AND a.miles = b.miles
WHERE b.origin > a.origin -- Not b.origin > b.origin
OR b.origin IS NULL
;If you'd care to post CREATE TABLE and INSERT statements for your sample data, then I could test this.
Edited by: Frank Kulash on Nov 6, 2012 7:39 PM
Corrected WHERE clause after MLVrown (below) -
How to use "Order by" clause dynamically on LOV values in 10g r2 forms
Hi ,
I have following requirement,please guide me.
1 Create a List Of Values with 2 fields, Code and Description
2. Do not use order by clause in record Group Query
3. Attach this LOV to a field in Form
4. When user invokes the LOV user will see two fields in LOV with header as Code and Description
5. Now when user clicks on Column Header “Code” then LOV should be sorted on Code
6. And if User clicks on Column Header “Description” then LOV should be sorted on Description
Thanks in Advance.Kindly post this problem in this forum ->
[Forms Forum|http://forums.oracle.com/forums/forum.jspa?forumID=82]
And, close this thread by marked it as answered. ;)
Regards.
Satyaki De. -
Selecting records from DB table with out using internal tables
hi,
i need to retrieve values from a database table based on few fields and date as well. however, i need to check whether the date is less or equal to the current date and along with that i should get the appropriate record. how can i do that with out using internal table.
field1-----date---
11111----
20070219
11111--20070214 <---
11111----
20070205
in the above scenario i should get the second record
Regards,
Kranthi.Try:
REPORT ztest MESSAGE-ID 00.
TABLES bkpf.
SELECT * FROM bkpf
UP TO 1 ROWS
WHERE budat <= sy-datum
ORDER BY budat DESCENDING.
ENDSELECT.
Rob -
Async-Sync scenario with out using BPM
Hi All,
With SP19 we can implement File-RFC-File scenario with out using BPM.
But can any one suggest how can I implement the following File-RFC-File scenario without using BPM.
My input file has five elements. A1,A2,A3,A4,A5
The RFC (BAPI) needs A2 and A3 as input and it produces the output R6.
Now in the destination I need to populate D1,D2,D3,D4,D5,D6.
D1 has to be mapped from A1 and so on till fifth element. D6 will be mapped from R6. In order to achieve this we need to store the value of source interface before calling the RFC so that when we get the response back we can populate the entire destination structure.
Can anyone advise how to go about it. I don't want to use a BPM here.
Thanks
AbinashHi
the following thread may help you
Weblog to send Response from RFC to File in Asyn Mode Using Proxy [original link is broken]
File - RFC - File without a BPM - Possible from SP 19.
Thanks,
Ram -
Last 10 records of a table with out using count
How can i get last 10 records of a table with out using count() method? if there is some page size(eg 10) , and if we want last page. is it posible without ount()? if posible how?
Message was edited by:
user480375"is there any other way without nesting?"
Not correctly, no. What is your problem with nesting? Nested queries are not inherently slower than unnested queries. In some cases, such as this, they are the only correct way to do the query. Even an analytic version of the Top N needs to be nested because:
SQL> SELECT object_name
2 FROM t
3 WHERE ROW_NUMBER() OVER (ORDER BY object_name DESC) < 11
4 /
WHERE ROW_NUMBER() OVER (ORDER BY object_name DESC) < 11
ERROR at line 3:
ORA-30483: window functions are not allowed hereTTFN
John -
How to get the inserted row primary key with out using select statement
how to return the primary key of inserted row ,with out using select statement
Edited by: 849614 on Apr 4, 2011 6:13 AMyes thanks to all ,who helped me .its working fine
getGeneratedKeys
String hh = "INSERT INTO DIPOFFERTE (DIPOFFERTEID,AUDITUSERIDMODIFIED)VALUES(DIPOFFERTE_SEQ.nextval,?)";
String generatedColumns[] = {"DIPOFFERTEID"};
PreparedStatement preparedStatement = null;
try {
//String gen[] = {"DIPOFFERTEID"};
PreparedStatement pstmt = conn.prepareStatement(hh, generatedColumns);
pstmt.setLong(1, 1);
pstmt.executeUpdate();
ResultSet rs = pstmt.getGeneratedKeys();
rs.next();
// The generated order id
long orderId = rs.getLong(1); -
How do I view ipod music files with out using I tunes?
I trying to view my Ipod music files without using itunes. But when I conect my Ipod to my pc I can only view contacts, notes, and caladar through the driver.
How do I view ipod music files with out using I tunes?they should be under ur my music folder if u have windows
-
Adding data file with out using brtools /sapdba
Hi all,
How to add data file to table spaces with out using brtools /sapdba.Please let meknow.
Satya.why would you do that? whats your requirement?
You can use sql commands (I prefer doing it via brtools),
example
alter tablespace <name of the tablespace> add datafile '<path of the datafile>' size <size in Mb>M autoextend <on/off> next <size> maxsize <size>;
regards
Juan -
Is it possible to transfer music between iPhones and iPods with out using iTunes
Is it possible to transfer music between iPhones and iPods with out using iTunes
Nope. Both require iTunes on a computer to sync music from.
Unless the iPod is an iPod Touch and the music was bought from iTunes. In which case the Touch can simply go to the iTunes App, under Purchased and download the purchased songs for free. -
can i connect a external hard drive to apple tv 3 generation, for see my movies itunes with out use streaming or icloud? in apple tv 3 and 2?
That i want to know is i can connect a external hard drive to apple tv, for see my movies that i keep in my external hard drive, i dont want to see then whit the streaming and icloud, or used my laptop o pc for access de movies and stuff.
i put iny spanish to, because i feel my english is not so good, but i hope you understand me.
if i can´t connect a external hard drive, wich others media players divices you know that can see itunes movies?
¿quisiera saber si se puede conectar una memoria externa al apple tv, para ver el contenido de itunes que tengo guardado en esa memoria como peliculas, ect?
lo que no quiero es usar la icloud, o el servicio streamig para ver mi contenido, ni tener que usar la computadora para ver mi contenido el la tv?
y de no poderse conectar que otros dispositivos media pleyer conoces para ver peliculas de itunes en la tv?Welcome to the Apple Community.
can i connect a external hard drive to apple tv 3 generation
Unfortunately not. -
How can i get new apple id with out using credit card or visa card
how can i get a new apple id with out using credit card or visa card?
Hi xianlycier06,
If you are looking to create an Apple ID without using a credit card, you may find the following article helpful:
Apple Support: Creating an iTunes Store, App Store, iBooks Store, and Mac App Store account without a credit card
http://support.apple.com/kb/HT2534
Regards,
- Brenden
Maybe you are looking for
-
Hi, I have a doubt in AWT. We needed a custom title bar for our dialogs. Since we are using JDK 1.3(Actually J2me personal profile 1.0), its not possible to use setUndecorated() method. Hence we made a custom dialog class extending the java.awt.Windo
-
Hi, While trying to open the database I am getting the error ORA-32004 The Alert Log file showed the following Depricated parameter entry Deprecated system parameters with specified values: sql_trace End of deprecated system parameter listing Please
-
Please help with this code....
I create a button with ActionListner and a writeCd method. Now I want everytime i push the button, it will read the writeCd method. I dont' know how to make it work. Please help me out as soon as possible. Thanks a lot. Below are the codes of the but
-
Is Photoshop Elements the program where you take photos and can create a video
Is Photoshop Elements the program where you take photos and can create a video
-
Im getting this error message everytime i try to update. please could some one give me some advice. "Make sure you have permission to write to /private/tmp/501/TemporaryItems/com.apple.SoftwareUpdate, then try again." iBook G4 Mac OS X (10.3.9)