Report Parameter Query

To discuss Oracle Forms & Reports related technical issues.
Post Reply
najm
Posts: 74
Joined: Wed Apr 05, 2006 8:04 am
Location: Pakistan

Report Parameter Query

Post by najm »

1 SELECT DEPTNO,DNAME FROM DEPT
2 ORDER BY DEPTNO DESC

DEPTNO DNAME
--------- --------------
40 OPERATIONS
30 SALES
20 RESEARCH
10 ACCOUNTING

i want the Second Highest Deptno on the Top and the others are as it is Which query is Apply there fore the result like this

DEPTNO DNAME
--------- --------------
30 SALES
40 OPERATIONS
20 RESEARCH
10 ACCOUNTING
then i want to show this in a parameter form is it possible

Najm
omerjaved100
Posts: 25
Joined: Fri Mar 31, 2006 4:49 pm
Location: United Kingdom

Post by omerjaved100 »

Dear,
Here is the work way round to get the required results.

alter table dept add seq_no number;
update dept set seq_no=1 where deptno=30;
select Deptno,DName from dept order by seq_no,deptno desc;

DEPTNO DNAME
---------- --------------
30 SALES
40 OPERATIONS
20 RESEARCH
10 ACCOUNTING NEW YORK

Regards,
M.Omer Javed
ERP Technical Consultant
Mob:+923214647529/ +923004479693
najm
Posts: 74
Joined: Wed Apr 05, 2006 8:04 am
Location: Pakistan

Post by najm »

Very Great full for taking intrust but it does not fulfils the requirement i don't want to run any alter/update query becoz for example today i have a dept no 30 on top then after some days it should be deptno 50,80 or any other highest deptno and as on i want dynamic query.

Najm
omerjaved100
Posts: 25
Joined: Fri Mar 31, 2006 4:49 pm
Location: United Kingdom

Post by omerjaved100 »

select DEPTNO , dname, loc from
(
select dname,DEPTNO , loc ,
rownum sl
from dept order by deptno desc
) order by case when sl=2 then 0 else sl end;

Is it resolves the issue Najam?

Regards,
M.Omer Javed
ERP Technical Consultant
Mob:+923214647529/ +923004479693
najm
Posts: 74
Joined: Wed Apr 05, 2006 8:04 am
Location: Pakistan

Post by najm »

Thanks It's Work

Najm
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests