Home » Developer & Programmer » Forms » sort data in no DB block (forms 10g)
sort data in no DB block [message #319846] Tue, 13 May 2008 03:32 Go to next message
bodoid
Messages: 7
Registered: January 2007
Junior Member
Hi all,

can anyone tell me, if it is possible to sort records in non db block in any simple way? I dont want to loop through records and sort them.

thank you all
Pavel

Re: sort data in no DB block [message #319850 is a reply to message #319846] Tue, 13 May 2008 03:53 Go to previous messageGo to next message
Littlefoot
Messages: 20893
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Hm, so it is a control block. It is not based on a table (or a view) so that you could populate it using EXECUTE QUERY. Therefore, you do that some other way. How exactly do you do that? Is it a cursor loop? If so, include ORDER BY clause into cursor's SELECT statement. Is it something different? If so, what?

The other option I can think of is that you'd want to sort records during a manual insert (user is typing values into block's items). I guess you don't want Forms to order these records by some criteria, do you?
Re: sort data in no DB block [message #319867 is a reply to message #319850] Tue, 13 May 2008 04:57 Go to previous messageGo to next message
bodoid
Messages: 7
Registered: January 2007
Junior Member
yes i do it in loop cursor, but i search a lot of values from another tables, so it is impossible to have "order by" in statement of cursor i think. All values i have after fulling the grid (block).

I hope you understand me

thank you
Re: sort data in no DB block [message #319880 is a reply to message #319867] Tue, 13 May 2008 05:53 Go to previous messageGo to next message
Littlefoot
Messages: 20893
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
it is impossible to have "order by" in statement of cursor

Wrong! What makes you think so?

SQL> declare
  2    cursor cur_e is                               --> this is a cursor declaration
  3      select e.ename, e.job, d.dname, e.sal, b.comm
  4      from emp e, dept d, bonus b     
  5      where e.deptno = d.deptno
  6        and b.ename (+) = e.ename
  7      order by d.dname, e.ename, b.comm;          --> this is the ORDER BY clause
  8    cur_r      cur_e%rowtype;
  9    l_sum_sal  number := 0;
 10  begin
 11    open cur_e;
 12    loop
 13      fetch cur_e into cur_r;
 14      exit when cur_e%notfound;
 15
 16      l_sum_sal := l_sum_sal + cur_r.sal;
 17    end loop;
 18    close cur_e;
 19    dbms_output.put_line('All of them earn ' || to_char(l_sum_sal, '$999G990D00'));
 20  end;
 21  /
All of them earn   $40,225.00

PL/SQL procedure successfully completed.

SQL>

I used such an example on purpose, just to emphasize the way cursor is explicitly declared (but I had to open it, fetch, take care about exiting the loop, close it); normally, I'd use cursor FOR loop which would eliminate most of these steps.
Re: sort data in no DB block [message #319902 is a reply to message #319880] Tue, 13 May 2008 06:36 Go to previous messageGo to next message
bodoid
Messages: 7
Registered: January 2007
Junior Member
you didn't understand ... it is impossible use it just in my case Smile ... i search some data from tables which are not in cursor.
Re: sort data in no DB block [message #319918 is a reply to message #319902] Tue, 13 May 2008 07:03 Go to previous messageGo to next message
Littlefoot
Messages: 20893
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Could you include these tables into the cursor declaration?

If not, I'm afraid you're out of luck.
Re: sort data in no DB block [message #320049 is a reply to message #319846] Tue, 13 May 2008 19:58 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
bodoid wrote on Tue, 13 May 2008 18:32
I dont want to loop through records and sort them.

Why? It will only take moments and there are no fees associated with sorting.

David
Re: sort data in no DB block [message #320235 is a reply to message #320049] Wed, 14 May 2008 07:03 Go to previous message
bodoid
Messages: 7
Registered: January 2007
Junior Member
djmartin wrote on Tue, 13 May 2008 19:58
bodoid wrote on Tue, 13 May 2008 18:32
I dont want to loop through records and sort them.

Why? It will only take moments and there are no fees associated with sorting.

David



i ment, i don't want use any sort algoritmus like shake, bubble sort etc.

never mind ... i think it is impossible to sort records in simple way.

Previous Topic: Wat's wrong with this code..
Next Topic: How to navigate through worksheets using DDE
Goto Forum:
  


Current Time: Mon Dec 05 06:38:59 CST 2016

Total time taken to generate the page: 0.10018 seconds