Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Heelp need to walk through record

Re: Heelp need to walk through record

From: Martin Doherty <martin.doherty_at_oracle.nospam.com>
Date: Wed, 30 Oct 2002 12:14:50 -0800
Message-ID: <n8Xv9.4$kd1.136@news.oracle.com>


To put it in a nutshell, the only way to find a record in your current block without leaving insert mode is to write a loop that iterates through the records in the block, comparing each record for the desired search value, as per Alan's code example.

A possible enhancement might be to use a PL/SQL memory table as an index to internally track the search key values and corresponding record numbers, so your search loop (or hash algorithm) could access your memory table instead of the block directly, then issue a GO_RECORD once you have the record number. I have no idea if this would be faster than looping through the block records directly - you'd need to experiment, and maintaining that memory table would probably be a code nightmare in terms of trapping all necessary events via triggers.

Alan Mills wrote:

>"P B" <pbeliveau_at_avcorp.com> wrote in message
>news:id3truo9djbbsakisrafsr2oi3qsaa5i9f_at_4ax.com...
>
>
>>On Mon, 28 Oct 2002 21:50:14 GMT, Karsten Farrell
>><kfarrell_at_medimpact.com> wrote:
>>
>>
>>
>>>P B wrote:
>>>
>>>
>>>>I have a form which access a view. Record are access through a
>>>>composite primary key (file no and item name). I am able to move from
>>>>item to item using build-in like Next_Record, Previous_Record and
>>>>Go_Record which keep me into insert mode.
>>>>
>>>>The problem: the item are name. I would like to move from one record
>>>>to another without doing 200 times next record until I get the one
>>>>that I want. Go_Record is not usefull because I do not know the number
>>>>of the record associated to his name.
>>>>
>>>>I cannot also make a form (tab form) in which I list the record all in
>>>>one page since there is too many information to show.
>>>>
>>>>Since I might modify some item, I do not want to exit the inserting
>>>>mode and go into query mode to perform the search.
>>>>
>>>>How can I solve my problem
>>>>
>>>>
>>>If I understand your question, I think you need a "search" capability.
>>>Put a textbox on your form where the user can enter an item name. When
>>>they click the Search button, your trigger calls up the record(s) where
>>>item name is like whatever they type in the search textbox.
>>>
>>>
>>If I do that, I would have to leave the inserting mode and go into a
>>query mode in which case, the form will ask me if I want to save any
>>modification that I've done before which I don't want
>>
>>
>
>Not necessarily. You do not HAVE to do your searching from the database.
>If you have retrieved all the rows of possible interest your serach could be
>made from within the form itself. Soemthign alonjg the lines of...
>
>Enter search criteria in control block, press the 'go' button.
>Go_block('block to serach in');
>go to first record.
>while (:block.field != 'search value') // or test of your choice then
>go to next record
>
>This will leave you on a matching record and no need to force a commit
>because you haven;t cleared the block.
>
>Oh, and remember to catch the last record in case no match is found.
>
>Can't promise how hard this will be for hundreds of records though.
>
>OR
>
>whn you query your database block and add new records to it, maintain a
>PL/SQL table ro recordset. Do your searching within that. You can then
>simply Go_Record(x) where x is the result of seraching the PL/SQL table or
>recordset. Might be easier and quicker than trawling down a large database
>block.
>
>
>
>
Received on Wed Oct 30 2002 - 14:14:50 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US