[10g] Complex Order By clause...
I can manually sort my data, and can provide the logic I use to do that, but I need help actually putting it into an order by clause.
I am working in XE, 10g...
Here's some sample data to start with:
CREATE TABLE inventory_history
( time_stamp CHAR(20)
, part_nbr CHAR(25)
, act_date DATE
, ord_nbr CHAR(10)
, ln_nbr CHAR(3)
, code_pre CHAR(3)
, code_sfx CHAR(3)
, user_id CHAR(36)
, qty NUMBER(15,4)
, adj_qty NUMBER(15,4)
, cnt_qty NUMBER(15,4)
INSERT INTO inventory_history
VALUES ('20080716100442488094','N174X53A',TO_DATE('07/16/2008','mm/dd/yyyy'),NULL,NULL,'MTL','INS','user2',0,0,31);
INSERT INTO inventory_history
VALUES ('20080717135714597592','N174X53A',TO_DATE('07/17/2008','mm/dd/yyyy'),NULL,NULL,'MTL','INS','user2',31,0,0);
INSERT INTO inventory_history
VALUES ('20100401145927954563','N174X53A',TO_DATE('04/01/2010','mm/dd/yyyy'),NULL,NULL,'MTL','INS','user1',0,0,31);
INSERT INTO inventory_history
VALUES ('20100917085814607499','N174X53A',TO_DATE('09/17/2010','mm/dd/yyyy'),NULL,NULL,'MTL','INS','user1',30,0,0);
INSERT INTO inventory_history
VALUES ('20080715093021657035','N174X53A',TO_DATE('07/15/2008','mm/dd/yyyy'),'P000012345','001','POR','LIN','user5',31,0,0);
INSERT INTO inventory_history
VALUES ('20080716100406218646','N174X53A',TO_DATE('07/16/2008','mm/dd/yyyy'),'P000012345','001','MTL','INS','user2',31,0,0);
INSERT INTO inventory_history
VALUES ('20080819111303812239','N174X53A',TO_DATE('08/19/2008','mm/dd/yyyy'),'P000012345','002','POR','LIN','user5',31,0,0);
INSERT INTO inventory_history
VALUES ('20100504083427334677','N174X53A',TO_DATE('05/04/2010','mm/dd/yyyy'),'P000012345','002','POR','RTV','user3',31,0,0);
INSERT INTO inventory_history
VALUES ('20100512095750285578','N174X53A',TO_DATE('05/12/2010','mm/dd/yyyy'),'P000012345','002','POR','LIN','user6',30,0,0);
INSERT INTO inventory_history
VALUES ('20100614130143734676','N174X53A',TO_DATE('06/14/2010','mm/dd/yyyy'),'P000012345','002','MTL','INS','user1',0,0,30);
INSERT INTO inventory_history
VALUES ('20100412101824624708','N174X53A',TO_DATE('04/12/2010','mm/dd/yyyy'),'P000012345','004','POR','LIN','user4',31,0,0);
INSERT INTO inventory_history
VALUES ('20100422150057876187','N174X53A',TO_DATE('04/22/2010','mm/dd/yyyy'),'P000012345','004','MTL','INS','user2',0,0,31);
INSERT INTO inventory_history
VALUES ('20100504081750020711','N174X53A',TO_DATE('05/04/2010','mm/dd/yyyy'),'P000012345','004','POR','RTV','user3',31,0,0);
INSERT INTO inventory_history
VALUES ('20100512095303832580','N174X53A',TO_DATE('05/12/2010','mm/dd/yyyy'),'P000012345','004','POR','LIN','user6',31,0,0);
INSERT INTO inventory_history
VALUES ('20100712133833381506','N174X53A',TO_DATE('07/12/2010','mm/dd/yyyy'),'P000012345','004','MTL','INS','user1',31,0,0);
INSERT INTO inventory_history
VALUES ('20091124130834762244','015-279A',TO_DATE('11/24/2009','mm/dd/yyyy'),'P000045557','002','POR','LIN','user12',10,0,0);
INSERT INTO inventory_history
VALUES ('20091124131110241744','015-279A',TO_DATE('11/24/2009','mm/dd/yyyy'),'P000045557','002','POR','ADJ','user12',0,10,0);
INSERT INTO inventory_history
VALUES ('20091124131850641554','015-279A',TO_DATE('11/24/2009','mm/dd/yyyy'),'P000045557','002','POR','ADJ','user12',0,-20,0);
INSERT INTO inventory_history
VALUES ('20091124131916249134','015-279A',TO_DATE('11/24/2009','mm/dd/yyyy'),'P000045557','002','POR','LIN','user12',10,0,0);
INSERT INTO inventory_history
VALUES ('20091124135601215291','015-279A',TO_DATE('11/24/2009','mm/dd/yyyy'),'P000045557','002','POR','ADJ','user12',0,10,0);
INSERT INTO inventory_history
VALUES ('20091124140318980761','015-279A',TO_DATE('11/24/2009','mm/dd/yyyy'),NULL,NULL,'MTL','INS','user13',10,0,0);
INSERT INTO inventory_history
VALUES ('20091124142344235001','015-279A',TO_DATE('11/24/2009','mm/dd/yyyy'),'P000045557','002','POR','ADJ','user12',0,-10,0);
INSERT INTO inventory_history
VALUES ('20100701123833300000','test',TO_DATE('07/01/2010','mm/dd/yyyy'),'P000011111','001','POR','LIN','user12',5,0,0);
INSERT INTO inventory_history
VALUES ('20100705964833300000','test',TO_DATE('07/05/2010','mm/dd/yyyy'),'P000011111','001','MTL','INS','user2',5,0,0);
INSERT INTO inventory_history
VALUES ('20100702123456700000','test',TO_DATE('07/02/2010','mm/dd/yyyy'),'P000011111','002','POR','LIN','user6',5,0,0);
INSERT INTO inventory_history
VALUES ('20100704987654300000','test',TO_DATE('07/04/2010','mm/dd/yyyy'),NULL,NULL,'MTL','INS','user1',5,0,0);And this is what I'm looking to do ... this is how I want the above data sorted:
TIME_STAMP PART_NBR ACT_DATE ORD_NBR LN_NBR CODE_PRE CODE_SFX USER_ID QTY ADJ_QTY CNT_QTY
20091124130834762244 015-279A 11/24/2009 P000045557 002 POR LIN user12 10 0 0
20091124131110241744 015-279A 11/24/2009 P000045557 002 POR ADJ user12 0 10 0
20091124131850641554 015-279A 11/24/2009 P000045557 002 POR ADJ user12 0 -20 0
20091124131916249134 015-279A 11/24/2009 P000045557 002 POR LIN user12 10 0 0
20091124135601215291 015-279A 11/24/2009 P000045557 002 POR ADJ user12 0 10 0
20091124140318980761 015-279A 11/24/2009 MTL INS user13 10 0 0
20091124142344235001 015-279A 11/24/2009 P000045557 002 POR ADJ user12 0 -10 0
20080715093021657035 N174X53A 7/15/2008 P000012345 001 POR LIN user5 31 0 0
20080716100406218646 N174X53A 7/16/2008 P000012345 001 MTL INS user2 31 0 0
20080716100442488094 N174X53A 7/16/2008 MTL INS user2 0 0 31
20080717135714597592 N174X53A 7/17/2008 MTL INS user2 31 0 0
20080819111303812239 N174X53A 8/19/2008 P000012345 002 POR LIN user5 31 0 0
20100401145927954563 N174X53A 4/1/2010 MTL INS user1 0 0 31
20100512095750285578 N174X53A 5/12/2010 P000012345 002 POR LIN user6 30 0 0
20100614130143734676 N174X53A 6/14/2010 P000012345 002 MTL INS user1 0 0 30
20100412101824624708 N174X53A 4/12/2010 P000012345 004 POR LIN user4 31 0 0
20100422150057876187 N174X53A 4/22/2010 P000012345 004 MTL INS user2 0 0 31
20100512095303832580 N174X53A 5/12/2010 P000012345 004 POR LIN user6 31 0 0
20100712133833381506 N174X53A 7/12/2010 P000012345 004 MTL INS user1 31 0 0
20100917085814607499 N174X53A 9/17/2010 MTL INS user1 30 0 0
20100701123833300000 test 7/1/2010 P000011111 001 POR LIN user12 5 0 0
20100705964833300000 test 7/5/2010 P000011111 001 MTL INS user2 5 0 0
20100702123456700000 test 7/2/2010 P000011111 002 POR LIN user6 5 0 0
20100704987654300000 test 7/4/2010 MTL INS user1 5 0 0This is the logic I use to sort the data manually:
If the record has ord_nbr/ln_nbr (they aren't NULL), then sort by part_nbr, ord_nbr, ln_nbr, and time_stamp, in that order.
And here's the complicated part...
If the record does not have ord_nbr/ln_nbr (they are NULL, and this can only happen on MTL-INS transactions), then it needs to be placed into the sort I just described via this logic:
It must be placed with the other records with the same part_nbr, after the closest previous POR LIN transaction by time_stamp (for that part_nbr), but before the next chronological MTL-INS transaction by time_stamp (for that part_nbr), and between those 2 constraints, fit in by time_stamp.
Any suggestions??
Edited by: user11033437 on Sep 23, 2010 3:13 PM (Fixed order of sample data, so part_nbr was ascending, though really the overall sort doesn't matter, just the sorting within each part_nbr group.)
Hi,
user11033437 wrote:
... And this is what I'm looking to do ... this is how I want the above data sorted:
TIME_STAMP PART_NBR ACT_DATE ORD_NBR LN_NBR CODE_PRE CODE_SFX USER_ID QTY ADJ_QTY CNT_QTY
20091124130834762244 015-279A 11/24/2009 P000045557 002 POR LIN user12 10 0 0
20091124131110241744 015-279A 11/24/2009 P000045557 002 POR ADJ user12 0 10 0
20091124131850641554 015-279A 11/24/2009 P000045557 002 POR ADJ user12 0 -20 0
20091124131916249134 015-279A 11/24/2009 P000045557 002 POR LIN user12 10 0 0
20091124135601215291 015-279A 11/24/2009 P000045557 002 POR ADJ user12 0 10 0
20091124140318980761 015-279A 11/24/2009 MTL INS user13 10 0 0
20091124142344235001 015-279A 11/24/2009 P000045557 002 POR ADJ user12 0 -10 0
20080715093021657035 N174X53A 7/15/2008 P000012345 001 POR LIN user5 31 0 0
20080716100406218646 N174X53A 7/16/2008 P000012345 001 MTL INS user2 31 0 0
20080716100442488094 N174X53A 7/16/2008 MTL INS user2 0 0 31
20080717135714597592 N174X53A 7/17/2008 MTL INS user2 31 0 0
20080819111303812239 N174X53A 8/19/2008 P000012345 002 POR LIN user5 31 0 0
20100401145927954563 N174X53A 4/1/2010 MTL INS user1 0 0 31
20100512095750285578 N174X53A 5/12/2010 P000012345 002 POR LIN user6 30 0 0
20100614130143734676 N174X53A 6/14/2010 P000012345 002 MTL INS user1 0 0 30
20100412101824624708 N174X53A 4/12/2010 P000012345 004 POR LIN user4 31 0 0
20100422150057876187 N174X53A 4/22/2010 P000012345 004 MTL INS user2 0 0 31
20100512095303832580 N174X53A 5/12/2010 P000012345 004 POR LIN user6 31 0 0
20100712133833381506 N174X53A 7/12/2010 P000012345 004 MTL INS user1 31 0 0
20100917085814607499 N174X53A 9/17/2010 MTL INS user1 30 0 0
20100701123833300000 test 7/1/2010 P000011111 001 POR LIN user12 5 0 0
20100705964833300000 test 7/5/2010 P000011111 001 MTL INS user2 5 0 0
20100702123456700000 test 7/2/2010 P000011111 002 POR LIN user6 5 0 0
20100704987654300000 test 7/4/2010 MTL INS user1 5 0 0This is the logic I use to sort the data manually:
If the record has ord_nbr/ln_nbr (they aren't NULL), then sort by part_nbr, ord_nbr, ln_nbr, and time_stamp, in that order.
And here's the complicated part...
If the record does not have ord_nbr/ln_nbr (they are NULL, and this can only happen on MTL-INS transactions), then it needs to be placed into the sort I just described via this logic:
It must be placed with the other records with the same part_nbr, after the closest previous POR LIN transaction by time_stamp (for that part_nbr), but before the next chronological MTL-INS transaction by time_stamp (for that part_nbr), and between those 2 constraints, fit in by time_stamp.Sorry, I don't see how you get those results from that data.
In normal string stort order '015-279A' comes before 'N174X53A', which comes before 'test'. How do you get the order you want?
Then within each part_nbr, your explanation seems to say you want the rows with NULL ord_nbr to come right after the preceding POR-LIN row (where "preceding" means according to time_stamp), which would result in this order:
TIME_STAMP PART_NBR ACT_DATE ORD_NBR LN_ COD
20091124130834762244 015-279A 11/24/2009 P000045557 002 POR
20091124131110241744 015-279A 11/24/2009 P000045557 002 POR
20091124131850641554 015-279A 11/24/2009 P000045557 002 POR
20091124131916249134 015-279A 11/24/2009 P000045557 002 POR
20091124140318980761 015-279A 11/24/2009 MTL
20091124135601215291 015-279A 11/24/2009 P000045557 002 POR
20091124142344235001 015-279A 11/24/2009 P000045557 002 POR
20080715093021657035 N174X53A 7/15/2008 P000012345 001 POR
20080716100442488094 N174X53A 7/16/2008 MTL
20080717135714597592 N174X53A 7/17/2008 MTL
20080716100406218646 N174X53A 7/16/2008 P000012345 001 MTL
20080819111303812239 N174X53A 8/19/2008 P000012345 002 POR
20100401145927954563 N174X53A 4/1/2010 MTL
20100504083427334677 N174X53A 5/4/2010 P000012345 002 POR
20100512095750285578 N174X53A 5/12/2010 P000012345 002 POR
20100917085814607499 N174X53A 9/17/2010 MTL
20100614130143734676 N174X53A 6/14/2010 P000012345 002 MTL
20100412101824624708 N174X53A 4/12/2010 P000012345 004 POR
20100422150057876187 N174X53A 4/22/2010 P000012345 004 MTL
20100504081750020711 N174X53A 5/4/2010 P000012345 004 POR
20100512095303832580 N174X53A 5/12/2010 P000012345 004 POR
20100712133833381506 N174X53A 7/12/2010 P000012345 004 MTL
20100701123833300000 test 7/1/2010 P000011111 001 POR
20100705964833300000 test 7/5/2010 P000011111 001 MTL
20100702123456700000 test 7/2/2010 P000011111 002 POR
20100704987654300000 test 7/4/2010 MTLCan you explain the sorting rules agian, using different words.
Explain in particular why the rows that are in the wrong place above should be changed.
The code I used to get the results above was:
WITH got_r_num AS
SELECT time_stamp
, part_nbr
, act_date
, ord_nbr
, ln_nbr
, code_pre
, code_sfx
, ROW_NUMBER () OVER ( PARTITION BY part_nbr
ORDER BY ord_nbr
, ln_nbr
, time_stamp
) AS r_num
FROM inventory_history
SELECT time_stamp
, part_nbr
, act_date
, ord_nbr
, ln_nbr
, code_pre
FROM got_r_num
ORDER BY part_nbr
, CASE
WHEN ord_nbr IS NOT NULL
THEN r_num
ELSE LAST_VALUE ( CASE
WHEN code_pre = 'POR'
AND code_sfx = 'LIN'
THEN r_num
END
IGNORE NULLS
) OVER ( PARTITION BY part_nbr
ORDER BY time_stamp
END
, r_num
;It's a good thing that you're using Oracle 10; earlier versions didn't have the IGNORE NULLS feature in LAST_VALUE. That can be worked around, but it's complicated, and this is complicated enough already.
By the way, if you want to experiment with this kind of ORDER BY expression, I suggest you iput it in the SELECT clause, like this:
WITH got_r_num AS
SELECT time_stamp
, part_nbr
, act_date
, ord_nbr
, ln_nbr
, code_pre
, code_sfx
, ROW_NUMBER () OVER ( PARTITION BY part_nbr
ORDER BY ord_nbr
, ln_nbr
, time_stamp
) AS r_num
FROM inventory_history
SELECT time_stamp
, part_nbr
, act_date
, ord_nbr
, ln_nbr
, code_pre
, code_sfx
, CASE
WHEN ord_nbr IS NOT NULL
THEN r_num
ELSE LAST_VALUE ( CASE
WHEN code_pre = 'POR'
AND code_sfx = 'LIN'
THEN r_num
END
IGNORE NULLS
) OVER ( PARTITION BY part_nbr
ORDER BY time_stamp
END
as O_NUM
, r_num
FROM got_r_num
ORDER BY part_nbr
, o_num
, r_num
;Edited by: Frank Kulash on Sep 23, 2010 5:39 PM
Sorry, I left off some columns of output. I'll fix it when I have time, which is not now.
Similar Messages
-
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. -
Hi All,
I want to order my SELECT using "dynamic ORDER BY". I have a CURSOR (in my PL/SQL procedure) contains a select with ORDER BY clause. I have implemented two combobox in my form (the first contains the column name, the second contains ASC and DESC).I tried with the next:
1) Dynamic ORDER BY in CURSOR with combobox results. IT DOESN'T WORK.
2) Using a block property named "ORDER BY CLAUSE". Here I put, for example, :myBlock.comboColumnOrder. IT DOESN'T WORK.
3) Using a function: set_block_property(myBlock,order_by,:myBlock.comboColumnOrder) or set_block_property(myBlock,default_where,:myBlock.comboColumnOrder). IT DOESN'T WORK.
4) Using dynamic CURSOR: ORACLE FORMS give me an error that said: "...it can't to the CLIENT-SIDE".
I have thought my last solution, but it maybe cumbersome. I do a TEMPORARY TABLE, and my CURSOR insert in this TABLE, and then I'll fetch to my BLOCK.
Thanks a lot.
PS: My ORACLE Version is 10g.PROCEDURE CHEQUEAR_V0 IS
V_ORDEN VARCHAR2(50) := '' || :BLOCK_CHECK.ORDER_BY_NAME || ' ' || :BLOCK_CHECK.ORDER_BY_ASC_DES ;
CURSOR FILA_RESULTADO_TABLA IS
SELECT Last_name,First_name,App_user, App_role, UserDB
FROM adm_users
WHERE
((Last_name IS NULL OR Last_name LIKE '%'||:BLOCK_CHECK.Last_name||'%') AND
(First_name IS NULL OR First_name LIKE '%'||:BLOCK_CHECK.First_name||'%') AND
(App_user IS NULL OR App_user LIKE '%'||:BLOCK_CHECK.App_user||'%') AND
(App_role IS NULL OR App_role LIKE '%'||:BLOCK_CHECK.App_role||'%') AND
(UserDB IS NULL OR UserDB LIKE '%'||:BLOCK_CHECK.User_DB||'%'))
ORDER BY V_ORDEN;
V_Last_name VARCHAR2(50);
V_First_name VARCHAR2(50);
V_App_user VARCHAR2(50);
V_App_role VARCHAR2(50) ;
V_User_DB VARCHAR2(50);
CONT NUMBER ;
BEGIN
CONT := 1 ;
GO_BLOCK('BLOCK_APPS_GRANTS');
CLEAR_BLOCK;
SYNCHRONIZE;
OPEN FILA_RESULTADO_TABLA;
LOOP
FETCH FILA_RESULTADO_TABLA INTO V_Last_name,V_First_name,V_App_user,V_App_role,V_User_DB ;
EXIT WHEN FILA_RESULTADO_TABLA%NOTFOUND;
:BLOCK_APPS_GRANTS.Last_name := V_Last_name ;
:BLOCK_APPS_GRANTS.First_name := V_First_name ;
:BLOCK_APPS_GRANTS.App_user := V_App_user ;
:BLOCK_APPS_GRANTS.App_role := V_App_role ;
:BLOCK_APPS_GRANTS.User_DB := V_User_DB ;
NEXT_RECORD;
CONT := CONT+1;
END LOOP;
IF FILA_RESULTADO_TABLA%ISOPEN THEN
CLOSE FILA_RESULTADO_TABLA;
END IF;
SET_BLOCK_PROPERTY('BLOCK_APPS_GRANTS', ORDER_BY, :BLOCK_CHECK.ORDER_BY_NAME || ' ' || :BLOCK_CHECK.ORDER_BY_ASC_DES);
GO_BLOCK('BLOCK_APPS_GRANTS');
EXECUTE_QUERY;
synchronize;
exception when others then
raise;
END;
Thanks a lot.
Edited by: user11285646 on 22-jul-2009 2:30 -
[JPA/TOPLINK] is the function "lower" supported in "order by" clause?
In EJB-QL
I can use lower() or upper() in where clause.
But there is always a parse exception thrown when i tried to use it in main clause or order by clause.
works:
select s from Student s where lower(s.name) like 'm%'
exception thrown:
select s from Student s where s.name like 'm%' order by lower(s.name)
OR --------------
Why i am asking this is that the resultset returned from database is not alphabetical sorted but ascii sorted, which means any characters with upper case is always prior to the ones with lower case.
If EJB-QL doesn't support using lower() in order by clause, do I have any other options to avoid this problem?
BTW, it is the Oracle 10g we are using as DB
many thanks,
Xuphey
Edited by: Xuphey on Nov 29, 2007 1:33 AMIf you want to do this, you'd have to use dynamic SQL (execute immediate or DBMS_SQL). For the easier 'execute immediate' approach, you'd do something like
create or replace someProc( someArg varchar2 )
as
strSQL varchar2(4000)
begin
strSQL := <<string containing your SQL statement up to the order by clause>>
strSQL := strSQL || 'ORDER BY ' || someArg
execute immediate strSQL;
endJustin -
Dual Case Column names fail in select ORDER BY clause
This one is solved, but I thought someone might be able to explain why it happens.
I'm a newbie, since I just downloaded Oracel XE last night, and am trying it out.
I set up a trivial table with 4 text columns. As it happened, I used dual case for some of my column names, such as 'Nickname'.
When trying out the Query Builder, the Select statement failed whenever I added a sort.
After some head scratching and back-and-forth with the sample data base (HR), I finally renamed all the columns to upper case. (e.g. column 'Nickname' became 'NICKNAME'). Then it works.
Seems like a bug, but maybe it's just a feature. Here's the code generated by the Query Builder. As you can see, there are no quotes around the Table name or column names in the ORDER BY clause (and the dual case version of the column name works if I put the quotes in manually and run it with SQL command.) Seems quirky.
select "TEAMS"."NICKNAME" as "NICKNAME",
"TEAMS"."CITY" as "CITY",
"TEAMS"."DIVISION" as "DIVISION",
"TEAMS"."CONFERENCE" as "CONFERENCE"
from "TEAMS" "TEAMS"
order by TEAMS.NICKNAME ASCWelcome to forum. :)
Now, answering your question - no i don't think this is a bug.
It is your code - which create this bug.
Now, question is - what happen?
Just check your select and from clause. You put all the names are in double quote. When you put anything within double quotes - it become a case sensitive. So, the problem occurs there.
Let's see ->
satyaki>
satyaki>select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
Elapsed: 00:00:01.11
satyaki>
satyaki>create table s_otn
2 (
3 id number(4)
4 );
Table created.
Elapsed: 00:00:02.14
satyaki>
satyaki>set lin 80
satyaki>
satyaki>desc s_otn;
Name Null? Type
ID NUMBER(4)
satyaki>
satyaki>desc S_OTN;
Name Null? Type
ID NUMBER(4)
satyaki>
satyaki>desc s_OtN;
Name Null? Type
ID NUMBER(4)
satyaki>
satyaki>drop table s_otn;
Table dropped.
Elapsed: 00:00:05.22
satyaki>
satyaki>
satyaki>create table "S_otn"
2 (
3 id number(4)
4 );
Table created.
Elapsed: 00:00:00.12
satyaki>
satyaki>
satyaki>desc S_otn;
ERROR:
ORA-04043: object S_otn does not exist
satyaki>
satyaki>desc S_OTN;
ERROR:
ORA-04043: object S_OTN does not exist
satyaki>
satyaki>desc s_otn;
ERROR:
ORA-04043: object s_otn does not exist
satyaki>
satyaki>desc "S_OTN";
ERROR:
ORA-04043: object "S_OTN" does not exist
satyaki>
satyaki>desc "S_otn";
Name Null? Type
ID NUMBER(4)
satyaki>Got me?
Regards.
Satyaki De. -
SQL Query rewrite, remove ORDER BY clause
Hello,
we've just installed a proprietary application which uses an Oracle 11.2.0.2 RAC database. We've seen that one of the auto-generated application's queries
has poor performance (3-5 minutes for results), the query does a SELECT and at the end it uses an ORDER BY clause. If we remove the ORDER BY clause
the query returns the results in less than 5 seconds. Unfortunately, we can't re-write the query in the application since we don't have any access to it and
i was wondering if there is a way to rewrite the specific query from the database.
We've already seen the SQL Patch but we can change only the hints of the query so we can't remove the ORDER BY clause from it. From what we've seen
outlines also change only the hints and not the actual sql statement.
Is there a way to rewrite the specific query from the database ?
thanks in advance,
GiannisMaybe DBMS_ADVANCED_REWRITE can help but this a SQL question than has very likely nothing to do with RAC.
See http://www.oracle-base.com/articles/10g/dbms_advanced_rewrite.php. -
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 43119] Query Failed: [nQSError: 16001] ODBC error state: 37000 code: 8180 message: [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared.. [nQSError: 16001] ODBC error state: 37000 code: 1033 message: [Microsoft][ODBC SQL Server Driver][SQL Server]The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified.. [nQSError: 16002] Cannot obtain number of columns for the query result. (HY000)
I have already tried to follow this thread below, but no change.
HI
In this specific report ran above the offending sql uses a CTE.
I am on 11.1.1.6.1, Windows Server 2008
Currently in testing phase in migration from 10g.
I know what the error means, just not how to resolve it or what setting may be causing this.In Physical layer, go to specific database(Physical layer's) properties, database features tab -> Un check the EXPRESSION_IN_ORDERBY_SUPPORTED.
For that failed report, go to Answers-> advance tab-> Look for 'Advanced SQL Clauses'
Check this box to issue an explicit Select Distinct
Let me know updates
If helps Pls mark correct or helpful -
Order by clause -dyamically in Forms
I am using Forms 6i. I want to do Forms to Excel stuff and I am doing this by opening a cursor and then start Excel routine using OLE2.
The user will select the 'order by' columns from a list-field in the form.
Problem is I have given Order by clause as given below sample, but it just don't work..
How to accomplish this ??
declare
Cursor emp_cursor is
SELECT code,name,dept,desig,salary
FROM emp
order by :s1,:s2;
begin
-- excel routine
end;Hi vdsk,
Here is link to create_group_from_query built_in:
http://www.oracle.com/webapps/online-help/forms/10g/state?navSetId=_&navId=3&vtTopicFile=f1_help/builta_c/creategp.html&vtTopicId=
you can prepare your select statement and then concatenate with order by clause. I think that is the best soultion for you.
Regards
Jakub -
Cursor ORDER BY Clause Changing Row Count In BULK COLLECT ... FOR LOOP?
Oracle 10g Enterprise Edition Release 10.2.0.4.0 running on Windows Server 2003
Oracle Client 10.2.0.2.0 running on Windows 2000
I have some PL/SQL code that's intended to update a column in a table based on a lookup from another table. I started out by testing it with the UPDATE statement commented out, just visually inspecting the DBMS_OUTPUT results to see if it was sane. During this testing I added/changed the cursor ORDER BY clause to make it easier to read the output, and saw some strange results. I've run the code 3 times with:
1. no ORDER BY clause
2. ORDER BY with two columns (neither indexed)
3. ORDER BY with one column (not indexed)
and get three different "rows updated" counts - in fact, when using the ORDER BY clauses it appears that the code is processing more rows than without either ORDER BY clause. I'm wondering why adding / changing an ORDER BY <non-indexed column> clause in a cursor would affect the row count?
The code structure is:
TYPE my_Table_t IS TABLE OF table1%ROWTYPE ;
my_Table my_Table_t ;
CURSOR my_Cursor IS SELECT * FROM table1 ; -- initial case - no ORDER BY clause
-- ORDER BY table1.column1, table1.column2 ; -- neither column indexed
-- ORDER BY table1.column2 ; -- column not indexed
my_Loop_Count NUMBER := 0 ;
OPEN my_Cursor ;
LOOP
FETCH my_Cursor BULK COLLECT INTO my_Table LIMIT 100 ;
EXIT WHEN my_Table.COUNT = 0 ;
FOR i IN 1..my_Table.COUNT LOOP
my_New_Value := <call a pkg.funct to retrieve expected value from another table> ;
EXIT WHEN my_New_Value IS NULL ;
EXIT WHEN my_New_Value = <an undesirable value> ;
IF my_New_Value <> my_Table(i).column3 THEN
DBMS_OUTPUT.PUT_LINE( 'Changing ' || my_Table(i).column3 || ' to ' || my_New_Value ) ;
UPDATE table1 SET column3 = my_New_Value WHERE column_pk = my_Table(i).column_pk ;
my_Loop_Count := my_Loop_Count + 1 ;
END IF ;
END LOOP ;
COMMIT ;
END LOOP ;
CLOSE my_Cursor ;
DBMS_OUTPUT.PUT_LINE( 'Processed ' || my_Loop_Count || ' Rows ' ) ;Hello (and welcome),
Your handling the inner cursor exit control is suspect, which will result in (seemingly) erratic record counts.
Instead of:
LOOP
FETCH my_Cursor BULK COLLECT INTO my_Table LIMIT 100 ;
EXIT WHEN my_Table.COUNT = 0 ;
FOR i IN 1..my_Table.COUNT LOOP
my_New_Value := <call a pkg.funct to retrieve expected value from another table> ;
EXIT WHEN my_New_Value IS NULL ;
EXIT WHEN my_New_Value = <an undesirable value> ;
IF my_New_Value my_Table(i).column3 THEN
DBMS_OUTPUT.PUT_LINE( 'Changing ' || my_Table(i).column3 || ' to ' || my_New_Value ) ;
UPDATE table1 SET column3 = my_New_Value WHERE column_pk = my_Table(i).column_pk ;
my_Loop_Count := my_Loop_Count + 1 ;
END IF ;
END LOOP ;
COMMIT ;
END LOOP ;Try this:
LOOP
FETCH my_Cursor BULK COLLECT INTO my_Table LIMIT 100 ;
FOR i IN 1..my_Table.COUNT LOOP
my_New_Value := <call a pkg.funct to retrieve expected value from another table> ;
EXIT WHEN my_New_Value IS NULL ;
EXIT WHEN my_New_Value = <an undesirable value> ;
IF my_New_Value my_Table(i).column3 THEN
DBMS_OUTPUT.PUT_LINE( 'Changing ' || my_Table(i).column3 || ' to ' || my_New_Value ) ;
UPDATE table1 SET column3 = my_New_Value WHERE column_pk = my_Table(i).column_pk ;
my_Loop_Count := my_Loop_Count + 1 ;
END IF ;
EXIT WHEN my_Cursor%NOTFOUND;
END LOOP ;
END LOOP ;
COMMIT ;Which also takes the COMMIT outside of the LOOP -- try to never have a COMMIT inside of any LOOP.
Additionally, not too sure about these:
my_New_Value := <call a pkg.funct to retrieve expected value from another table> ;
EXIT WHEN my_New_Value IS NULL ;
EXIT WHEN my_New_Value = <an undesirable value> ;Any one of those EXITs will bypass your my_Loop_Count increment.
Edited by: SeánMacGC on Jul 9, 2009 8:37 AM
Had the cursor not found in the wrong place, now corrected. -
Long run time with ORDER by clause
Hi,
I am having a query which is executing fine(in 2 mins) but when i am using order by clause in it, its taking around 13 mins.
Can anyone suggest what could be th reason and how to execute the same query are get the ordered record?
thanks.Sorry for not providing complet details.
Database version id 10g.
Below is the execution plan when using with order by clause.
Execution Plan
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | 1 | 118 | 1538 |
| 1 | FILTER | | | | |
| 2 | HASH JOIN | | 16657 | 1089K| 56 |
| 3 | TABLE ACCESS FULL | FILETYP | 6 | 60 | 3 |
| 4 | TABLE ACCESS FULL | FILETYPSOURCEID | 16657 | 927K| 52 |
| 5 | NESTED LOOPS | | 1 | 35 | 3 |
| 6 | TABLE ACCESS BY INDEX ROWID | FILEWAREHOUSE | 1 | 25 | 2 |
| 7 | INDEX RANGE SCAN | FILEWAREHOUSE_DX2 | 1 | | 2 |
| 8 | TABLE ACCESS BY INDEX ROWID | EXTFILE | 1 | 10 | 1 |
| 9 | INDEX UNIQUE SCAN | PK_EXTFILE | 1 | | 1 |
| 10 | SORT ORDER BY | | 1 | 118 | 1538 |
| 11 | NESTED LOOPS | | 1 | 118 | 1534 |
| 12 | NESTED LOOPS OUTER | | 1 | 100 | 1533 |
| 13 | NESTED LOOPS OUTER | | 1 | 96 | 1532 |
| 14 | NESTED LOOPS | | 1 | 88 | 1531 |
| 15 | HASH JOIN | | 5 | 360 | 1524 |
| 16 | TABLE ACCESS BY INDEX ROWID | RTXN | 1 | 22 | 1 |
| 17 | NESTED LOOPS | | 117 | 5148 | 1518 |
| 18 | VIEW | VW_SQ_1 | 20869 | 448K| 1441 |
| 19 | HASH GROUP BY | | 20869 | 427K| 1441 |
| 20 | FILTER | | | | |
| 21 | TABLE ACCESS BY INDEX ROWID| RTXNSTATHIST | 20869 | 427K| 1304 |
| 22 | INDEX RANGE SCAN | RTXNSTATHIST_DX2 | 20869 | | 29 |
| 23 | INDEX RANGE SCAN | PK_RTXN | 1 | | 1 |
| 24 | NESTED LOOPS | | 1 | 24 | 3 |
| 25 | TABLE ACCESS BY INDEX ROWID | FILEWAREHOUSE | 1 | 14 | 2 |
| 26 | INDEX RANGE SCAN | FILEWAREHOUSE_DX2 | 1 | | 2 |
| 27 | TABLE ACCESS BY INDEX ROWID | EXTFILE | 1 | 10 | 1 |
| 28 | INDEX UNIQUE SCAN | PK_EXTFILE | 1 | | 1 |
| 29 | TABLE ACCESS FULL | RTXNTYP | 1 | 28 | 5 |
| 30 | TABLE ACCESS BY INDEX ROWID | RTXNSTATHIST | 1 | 16 | 2 |
| 31 | INDEX RANGE SCAN | PK_RTXNSTATHIST | 1 | | 1 |
| 32 | TABLE ACCESS BY INDEX ROWID | NTWKNODE | 1 | 8 | 1 |
| 33 | INDEX UNIQUE SCAN | PK_NTWKNODE | 1 | | 1 |
| 34 | INDEX UNIQUE SCAN | PK_ORG | 1 | 4 | 1 |
| 35 | TABLE ACCESS BY INDEX ROWID | ACCT | 1 | 18 | 1 |
| 36 | INDEX UNIQUE SCAN | PK_ACCT | 1 | | 1 |
Below is the execution plan when running without ORDER BY clause...
Execution Plan
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | 1 | 135 | 1537 |
| 1 | FILTER | | | | |
| 2 | HASH JOIN | | 16657 | 1089K| 56 |
| 3 | TABLE ACCESS FULL | FILETYP | 6 | 60 | 3 |
| 4 | TABLE ACCESS FULL | FILETYPSOURCEID | 16657 | 927K| 52 |
| 5 | NESTED LOOPS | | 1 | 35 | 3 |
| 6 | TABLE ACCESS BY INDEX ROWID | FILEWAREHOUSE | 1 | 25 | 2 |
| 7 | INDEX RANGE SCAN | FILEWAREHOUSE_DX2 | 1 | | 2 |
| 8 | TABLE ACCESS BY INDEX ROWID | EXTFILE | 1 | 10 | 1 |
| 9 | INDEX UNIQUE SCAN | PK_EXTFILE | 1 | | 1 |
| 10 | NESTED LOOPS | | 1 | 135 | 1534 |
| 11 | NESTED LOOPS OUTER | | 1 | 117 | 1533 |
| 12 | NESTED LOOPS OUTER | | 1 | 113 | 1532 |
| 13 | NESTED LOOPS | | 1 | 105 | 1531 |
| 14 | HASH JOIN | | 5 | 445 | 1524 |
| 15 | TABLE ACCESS FULL | RTXNTYP | 1 | 28 | 5 |
| 16 | TABLE ACCESS BY INDEX ROWID | RTXN | 1 | 22 | 1 |
| 17 | NESTED LOOPS | | 117 | 7137 | 1518 |
| 18 | VIEW | VW_SQ_1 | 20869 | 794K| 1441 |
| 19 | HASH GROUP BY | | 20869 | 427K| 1441 |
| 20 | FILTER | | | | |
| 21 | TABLE ACCESS BY INDEX ROWID| RTXNSTATHIST | 20869 | 427K| 1304 |
| 22 | INDEX RANGE SCAN | RTXNSTATHIST_DX2 | 20869 | | 29 |
| 23 | INDEX RANGE SCAN | PK_RTXN | 1 | | 1 |
| 24 | NESTED LOOPS | | 1 | 24 | 3 |
| 25 | TABLE ACCESS BY INDEX ROWID | FILEWAREHOUSE | 1 | 14 | 2 |
| 26 | INDEX RANGE SCAN | FILEWAREHOUSE_DX2 | 1 | | 2 |
| 27 | TABLE ACCESS BY INDEX ROWID | EXTFILE | 1 | 10 | 1 |
| 28 | INDEX UNIQUE SCAN | PK_EXTFILE | 1 | | 1 |
| 29 | TABLE ACCESS BY INDEX ROWID | RTXNSTATHIST | 1 | 16 | 2 |
| 30 | INDEX RANGE SCAN | PK_RTXNSTATHIST | 1 | | 1 |
| 31 | TABLE ACCESS BY INDEX ROWID | NTWKNODE | 1 | 8 | 1 |
| 32 | INDEX UNIQUE SCAN | PK_NTWKNODE | 1 | | 1 |
| 33 | INDEX UNIQUE SCAN | PK_ORG | 1 | 4 | 1 |
| 34 | TABLE ACCESS BY INDEX ROWID | ACCT | 1 | 18 | 1 |
| 35 | INDEX UNIQUE SCAN | PK_ACCT | 1 | | 1 |
-------------------------------------------------------------------------------------------Edited by: user10754555 on Feb 5, 2010 6:02 PM -
Query hangs when given order by clause...help needed urgent
Hi ,
I have a table of size 4.1 GB.
QUERY IS :select * from rm_bil_bill order by bill_id desc;
the column Bill_id is primary key.
i have 6GB of temp tablespace.
the normal select works fine but then when it is suffixed with order by clause it is hanging for ever ...
Please help on this...
Thanks,
AshleeHI ,
Also like to add some information.
The table has been analysed on july 19th,
the explain plan for the above statement is :
SQL> SELECT * FROM TABLE( dbms_xplan.display );
PLAN_TABLE_OUTPUT
Plan hash value: 178181731
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)|
Time |
PLAN_TABLE_OUTPUT
| 0 | SELECT STATEMENT | | 24M| 3790M| | 1006K (2)|
03:21:17 |
| 1 | SORT ORDER BY | | 24M| 3790M| 10G| 1006K (2)|
03:21:17 |
| 2 | TABLE ACCESS FULL| RM_BIL_BILL | 24M| 3790M| | 123K (5)|
00:24:41 |
PLAN_TABLE_OUTPUT
9 rows selected.
SQL> SQL> SELECT * FROM TABLE(dbms_xplan.display);
PLAN_TABLE_OUTPUT
Plan hash value: 178181731
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)|
Time |
PLAN_TABLE_OUTPUT
| 0 | SELECT STATEMENT | | 24M| 3790M| | 1006K (2)|
03:21:17 |
| 1 | SORT ORDER BY | | 24M| 3790M| 10G| 1006K (2)|
03:21:17 |
| 2 | TABLE ACCESS FULL| RM_BIL_BILL | 24M| 3790M| | 123K (5)|
00:24:41 |
PLAN_TABLE_OUTPUT
9 rows selected.
THE TABLE DESCRIPTION:
SQL> desc rm_p01.RM_BIL_BILL
Name Null? Type
BILL_ID NOT NULL NUMBER(14)
STUDENT_ID NOT NULL NUMBER(14)
STUDENT_UIN NOT NULL VARCHAR2(20)
BILL_MONTH NOT NULL DATE
BILL_TYPE NOT NULL VARCHAR2(10)
SCHOOL_CODE NOT NULL VARCHAR2(10)
LEVEL_GRADE NOT NULL VARCHAR2(10)
CLASS_NAME VARCHAR2(10)
PUPIL_PROFILE_ID NOT NULL NUMBER(14)
BAL_BROUGHT_FORWARD NOT NULL NUMBER(10,2)
BILL_TOTAL_PAYMENT NOT NULL NUMBER(10,2)
BILL_OUTSTANDING_BAL NOT NULL NUMBER(10,2)
BILL_NET_CHARGES NOT NULL NUMBER(10,2)
BILL_TOTAL_PAYABLE NOT NULL NUMBER(10,2)
GENERATION_DATE NOT NULL DATE
GIRO_SO_IND CHAR(1)
GIRO_DEDUCTION_IND CHAR(1)
GIRO_DEDUCTION_DATE DATE
PRINT_DATA_EXTRACTION_IND CHAR(1)
PRINT_DATA_EXTRACTION_DATE DATE
REVIEW_IND CHAR(1)
REVIEW_DATE DATE
REVERSAL_MONTH DATE
VERSION_NO NOT NULL NUMBER(6)
CREATED_BY VARCHAR2(20)
CREATION_DATE DATE
LAST_UPDATED_BY VARCHAR2(20)
LAST_UPDATED_DATE DATE
BANK_ACCOUNT_NUMBER VARCHAR2(12)
BANK_ACRONYM VARCHAR2(30)
the table DDL :
CREATE TABLE "RM_P01"."RM_BIL_BILL"
( "BILL_ID" NUMBER(14,0) NOT NULL ENABLE,
"STUDENT_ID" NUMBER(14,0) NOT NULL ENABLE,
"STUDENT_UIN" VARCHAR2(20) NOT NULL ENABLE,
"BILL_MONTH" DATE NOT NULL ENABLE,
"BILL_TYPE" VARCHAR2(10) NOT NULL ENABLE,
"SCHOOL_CODE" VARCHAR2(10) NOT NULL ENABLE,
"LEVEL_GRADE" VARCHAR2(10) NOT NULL ENABLE,
"CLASS_NAME" VARCHAR2(10),
"PUPIL_PROFILE_ID" NUMBER(14,0) NOT NULL ENABLE,
"BAL_BROUGHT_FORWARD" NUMBER(10,2) NOT NULL ENABLE,
"BILL_TOTAL_PAYMENT" NUMBER(10,2) NOT NULL ENABLE,
"BILL_OUTSTANDING_BAL" NUMBER(10,2) NOT NULL ENABLE,
"BILL_NET_CHARGES" NUMBER(10,2) NOT NULL ENABLE,
"BILL_TOTAL_PAYABLE" NUMBER(10,2) NOT NULL ENABLE,
"GENERATION_DATE" DATE NOT NULL ENABLE,
"GIRO_SO_IND" CHAR(1),
"GIRO_DEDUCTION_IND" CHAR(1),
"GIRO_DEDUCTION_DATE" DATE,
"PRINT_DATA_EXTRACTION_IND" CHAR(1),
"PRINT_DATA_EXTRACTION_DATE" DATE,
"REVIEW_IND" CHAR(1),
"REVIEW_DATE" DATE,
"REVERSAL_MONTH" DATE,
"VERSION_NO" NUMBER(6,0) DEFAULT 0 NOT NULL ENABLE,
"CREATED_BY" VARCHAR2(20),
"CREATION_DATE" DATE DEFAULT SYSDATE,
"LAST_UPDATED_BY" VARCHAR2(20),
"LAST_UPDATED_DATE" DATE DEFAULT SYSDATE,
"BANK_ACCOUNT_NUMBER" VARCHAR2(12),
"BANK_ACRONYM" VARCHAR2(30),
PRIMARY KEY ("BILL_ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 NOLOGGING COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "DATAMEDIUM_RM_P" ENABLE
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS NOLOGGING
STORAGE(INITIAL 4294967296 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "DATAMEDIUM_RM_P" -
Hi, everyone,
I am trying to use the following insert statement to insert records in asc order. if i use the select statement alone the order by clause works fine, but when i use the same sql and add a insert into table statment the order by clause does not work. I am not getting the records in ascending order. could anybody help me in this regard?
INSERT INTO cat_sales_stg
select b.SSC,
ltrim(rtrim(a.CAT_DESC)) cat_desc,
SUM(a.AMOUNT) AMOUNT
FROM Trans a, SSC b
WHERE a.ACCOUNT_NUMBER = TO_CHAR(b.ACCOUNT_NUMBER)
AND a.TMONTH >= 200905 AND a.TMONTH <= 200910
AND a.FORMAT_NAME = 'ABC'
AND b.BMONTH = 200910
AND b.SAMPLE = 3
AND b.BANNER_NAME = 'ABC'
AND b.MODEL_NAME = 'XYZ'
group by b.SSC, ltrim(rtrim(a.CAT_DESC))
order by ssc,cat_desc
Thanks in advanceuser10636796 wrote:
Hi, everyone,
I am trying to use the following insert statement to insert records in asc orderWhat Toon, William, and others have said is that you DON'T insert rows in a specific order. That is completely outside the way relational databases are designed. You insert rows as unordered and use an ORDER BY clause in a SELECT when reading them. ORDER BY is for SELECT statements, not INSERT.
In particular Toon poined out that we can't control where individual rows get stored.
There is a databas object called a varray that can store data in sorted order. I have never seen them used because selecting the data back out again is more work; using an ordinary table and an ORDER BY clause is much easier. -
Suppress "Order By" clause in Answers Query
Hello,
Is it possible to Suppress "Order By" clause in Answers Query.
I'm using a database view as data source. In the view definition, "order by" clause is already specified. Is it possible to get the same order in the OBIEE report??
I do not want to use Sort Order column in the repository.
Thanks,
GirishYou add a rownumber to your DB view and use that to 'sort' your report.
regards
John
http://obiee101.blogspot.com/ -
How to make an ORDER BY clause dynamic
is there anyway to make the ORDER BY clause in an SQL query within a DB control
dynamic? I have tried to pass a String of the column name and place it in the
statement within {}, but it doesn't work"Mark" <[email protected]> wrote:
>
is there anyway to make the ORDER BY clause in an SQL query within a
DB control
dynamic? I have tried to pass a String of the column name and place
it in the
statement within {}, but it doesn't workDid you find how ? please let me know, I also need to have a dynamic order by
clause. -
In Report,order by clause is not working
Hi All,
For the report i prepared the query in this one am using the order by clause,i run the query in the sql plus working fine am getting the data based on the order by clause.when i use the same query for the report am getting the data but not in the order(i.e order by clause in not working).
Please help me how to do this one.
Thanks in Advance.
Regards,
Leelakrishna.GHi Dora,
Data is coming in the proper sequence,but in the first group data is not coming(In first group data first line only displaying,remaining data is not comming).
My req is:
The report is executing based on the creation date(i.e.,from creation date to today).
In this so many Purchase requisitions will be there for this one different approval in different times will be there.
For Ex:
we will take 2 PR number only(for the first one 3 approvals,second one 4 levels of approval).
1. one supplier 1person raised by 1PR submit
No Action
Approve
2. 2Supplier 2personraised by 2PR Submit
NO Action
Forword
Approve
with ur suggestion am trying data is gettin fine but first group first line is coming remaining data is not coing.
EX:
1. one supplier 1person raised by 1PR submit
No Action
Approve
2PR Submit
NO Action
Forword
Approve
Note:"2. 2Supplier 2personraised by " this kind of lines data is missing.
Can you pls check and suggest me how i can do this.
Thanks in Advance.
Regards,
Leelakrishna.G
Maybe you are looking for
-
Mail for Mac on new hard drive won't import Mail from old hd
I recently installed an additional hard drive (running Tiger), but I kept my old one (running Panther), too, to use as a backup. After resolving a few snags, the data and apps transferred over OK, but two days ago I (very foolishly) tried to make a c
-
Return Delivery for In-House Repair Order
When I create an In-House Repair order in CRM and replicate it to ECC, the return delivery does contain the special stock indicator "E", hence the stock is posted to unrestricted. This only happens with replicated orders. Any ideas?
-
Fullscreen Gallery image gets erased when scrolling on Chrome
I'm working on a website where we have an abstract video background playing behind a transparent logo, which when clicked scrolls the page down to the main content. The logo is layed over the video background as a single image in the Fullscreen Galle
-
Mac OS X 10.9.1 cant connect to HP 2840 printer
My Mac OS X 10.9.1 is not able to find my HP 2840 printer. Please help even my IT man hasnt solved it!
-
I have an existing 2 year verizon wireless plan, really want an iphone 6 and dont mind paying the 650. If i purchase an unlocked iphone 6 from apple online can i just transfer the sim card from my current phone (iphone 5s) to the unlocked iphone 6 an