Navigate to Particular Record [message #625023] |
Tue, 30 September 2014 07:04 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.gravatar.com/avatar/9807c59f4b66faa80f4f759abc7bac59?s=64&d=mm&r=g) |
Mayur Shinde
Messages: 60 Registered: August 2014 Location: Pune, Maharashtra
|
Member |
|
|
Hi,
I have table name as "TRANS_MASTER" as given below:
-------------------------------
code|description|value1|value2
-------------------------------
1 | A | 10 | 100
2 | B | 20 | 200
3 | C | 30 | 300
4 | D | 40 | 400
5 | E | 50 | 500
------------------------------------
I am displaying the above record fine.
Now, if I give input = 1 then cursor should point to that particular record.
i.e. as per entered code cursor should be on that record...
Please help me...
[EDITED by LF: removed superfluous empty lines; applied [code] tags]
[Updated on: Tue, 30 September 2014 15:05] by Moderator Report message to a moderator
|
|
|
Re: Navigate to Particular Record [message #625024 is a reply to message #625023] |
Tue, 30 September 2014 07:10 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
cookiemonster
Messages: 13937 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Go to the first record.
Start a loop, check if the value in the current record is the one you want.
If not go to the next record.
Exit loop when you reach the right record or run out of records.
|
|
|
|
|
Re: Navigate to Particular Record [message #625062 is a reply to message #625060] |
Wed, 01 October 2014 01:16 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](http://www.gravatar.com/avatar/9807c59f4b66faa80f4f759abc7bac59?s=64&d=mm&r=g) |
Mayur Shinde
Messages: 60 Registered: August 2014 Location: Pune, Maharashtra
|
Member |
|
|
Thank you.
Problem is resolved.
I write below code:
DECLARE
BEGIN
IF :BLOCK_TOOL.S_GRADE_CD IS NULL AND :BLOCK_TOOL.S_GRADE_DESC IS NULL THEN
ERR_MESSAGE('Please enter Grade Code OR Grade Description...');
GO_ITEM('BLOCK_TOOL.S_GRADE_CD');
ELSE
BEGIN
GO_BLOCK('TRANSACTIONS_MST');
FIRST_RECORD;
LOOP
IF :TRANSACTIONS_MST.GRADE_CD = :BLOCK_TOOL.S_GRADE_CD OR :TRANSACTIONS_MST.GRADE_DESC = :BLOCK_TOOL.S_GRADE_DESC THEN
GO_ITEM(:SYSTEM.CURSOR_RECORD);
ELSE
NEXT_RECORD;
END IF;
EXIT WHEN :TRANSACTIONS_MST.GRADE_CD = :BLOCK_TOOL.S_GRADE_CD OR :TRANSACTIONS_MST.GRADE_DESC = :BLOCK_TOOL.S_GRADE_DESC OR :SYSTEM.LAST_RECORD='TRUE';
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND THEN
ERR_MESSAGE('No Data found for above Grade Code OR Grade Description...!');
END;
END IF;
END;
Some one can suggest me for "On click of above 'CODE' column or 'Description' column, How to display records as either ascending or descending.."
[Updated on: Wed, 01 October 2014 01:17] Report message to a moderator
|
|
|
Re: Navigate to Particular Record [message #625077 is a reply to message #625062] |
Wed, 01 October 2014 03:54 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
cookiemonster
Messages: 13937 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
To get the data in a different order you would need to change the blocks order by property using set_block_property and then requery the data with execute_query.
There's nothing in the above code that will raise no_data_found by the way so that exception handler is pointless.
|
|
|
|