Home » Developer & Programmer » Forms » Data Block ignoring the order by clause (form, 11g, windows 7 professional)
Data Block ignoring the order by clause [message #546357] Tue, 06 March 2012 05:23 Go to next message
monkey_suit
Messages: 21
Registered: February 2011
Junior Member
Hi everyone,
I have a real problem with form, specifically one of its data blocks. In the order by property of the block i specify it to sort on a branch in ascending order(i tried descending as well) but for some reason the form ignores that and sorts it on the ROWNUM. I even removed the where clause, the order by clause and changed the query data source type to FROM clause and changed the data source name to pre-query. I then created the query string in the block's pre-query trigger and set query_data_source_name property to that query string and still the data in the block is not being sorted on the branch number but instead on the ROWNUM. any help will be much appreciated. thanks.
Re: Data Block ignoring the order by clause [message #546358 is a reply to message #546357] Tue, 06 March 2012 05:26 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What is the BRANCH column's datatype?

Could you post a test case (CREATE TABLE and INSERT INTO several sample records, as well as query you used - especially its ORDER BY clause) so that we could see it?
Re: Data Block ignoring the order by clause [message #546366 is a reply to message #546358] Tue, 06 March 2012 05:58 Go to previous messageGo to next message
monkey_suit
Messages: 21
Registered: February 2011
Junior Member
its a number(4) and it's described like that in the table as well. the order by clause is simply a branch.branch_no asc. i can't display the code though, but the branch table joins with a company table which its joined on a company number that FK in the branch table. the reason for that is to see in which country the branch resides in. also there no overiding of the order_by clause.
Re: Data Block ignoring the order by clause [message #546373 is a reply to message #546366] Tue, 06 March 2012 06:20 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I was hoping that BRANCH was a character. As it is not, and there's no SET_BLOCK_PROPERTY which would modify the ORDER BY clause, I can't think of anything else, sorry.
Re: Data Block ignoring the order by clause [message #546382 is a reply to message #546373] Tue, 06 March 2012 07:15 Go to previous messageGo to next message
monkey_suit
Messages: 21
Registered: February 2011
Junior Member
i know its the darnedest thing because i was modifying a query in another blocks's trigger and i didn't even touch a the block and then i noticed that the sorting was buggy and found out that it was sorting on the rownum. no matter what i do to the order by clause nothing changes.
Re: Data Block ignoring the order by clause [message #546385 is a reply to message #546382] Tue, 06 March 2012 07:29 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
How exactly did you determine it's ordering on rownum?
Because generally speaking order by rownum gives a random order as rownum as only assigned as the records are selected.
Try using get_block_property('<block name>', last_query) to see what exact query the form is issuing to the DB.
Re: Data Block ignoring the order by clause [message #546392 is a reply to message #546357] Tue, 06 March 2012 08:29 Go to previous message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
I would do a pl/sql search for ORDER_BY to see if you set the default sort order anywhere. Also, what did you put in the ORDER BY CLAUSE of the block? Could be a syntax error.
Previous Topic: how to insert and update with single statement...?
Next Topic: Can't copy selected records to another block
Goto Forum:
  


Current Time: Fri Jul 05 23:24:37 CDT 2024