title: PL/SQL Create an efficient navigation of records
body: <p>I need help on the application i'm trying to develop in PL/SQL</p>
  
  <p>Basically my application has 3 screens. 'Parameter screen', 'Results Screen' and 'Details Screen'</p>
  
  <p>Parameter screen - the user will select some parameters from dropdown box within a form. Then they will click
  the submit button and will be passed on the next screen (Results screen)</p>
  
  <p>Results screen - an sql query will run taking into account the parameters passed from the previous screen
  The result of the query will be displayed in a table sorted by for example (Surname). Example result below</p>
  
  <pre><code>|ID|EmployeeID|Surname|Date of Birth|
   1  1234       Adam    11-14-1995
   2  5678       Reyes   06-03-1993
   3  9876       Olivers 03-02-1992
  </code></pre>
  
  <p>The next screen (Details screen) will display more details about the employee. The transition between Results
  screen and Details screen will happen by clicking an href link of the employee_surname within the Results screen</p>
  
  <p>So in the above results table, the surname 'Reyes' is a clickable Reyes</p>
  
  <p>After they click a surname from the result, it will call the procedure details_screen (as show in above link) and process
  the parameters 'id' and 'emid' to run the query within that procedure and display again more information about that
  specific employee. The Details screen would look like this</p>
  
  <pre><code>ID: 2
  EmployeeID: 5678
  Surname: Reyes
  First Name: Alan
  Date of Birth: 06-03-1993
  Hobbies: Basketball
  </code></pre>
  
  <p>I managed to do all the screen from Parameters to Details Screen. However, I want to have some navigation of records
  within the 'Details Screen' so they don't have to go back to 'Results Screen' to go through all the records of employees.
  I want them to have previous and next navigation within the 'Details screen' such as the following</p>
  
  <pre><code>ID: 2
  EmployeeID: 5678
  Surname: Reyes
  First Name: Alan
  Date of Birth: 06-03-1993
  Hobbies: Basketball
  
  &lt;a href="details_screen?id=1&amp;emid=1234"&gt;Previous&lt;/a&gt; | &lt;a href="details_screen?id=3&amp;emid=9876"&gt;Next&lt;/a&gt;
  </code></pre>
  
  <p>That's where i'm stucked with. I don't know how to implement this. 
  example. I managed to implement a dirty solution of this but it requires running the same query used
  within the Results screen everytime they go forward or backward within the recordset.
  My query is more complicated than what I show in this and using my dirty way has a heavy price in terms of performance.</p>
  
  <p>Is there a more efficient way of doing this without running the query over and over again?
  Something like do the query once and use the result to render the navigation while the user is still navigating within the 'Details screen'
  Then maybe just query again only when the user start from the beginning (The Parameter screen)</p>
  
  <p>I only learned the basic of PL/SQL yesterday and i'm still a noob. I've heard of things like ref_cursor,varrays,nested tables,associative arrays but I don't really understand
  them and I don't know if they can even help me with my problem. So please advise on this. Thank you in advance
  and sorry for the very long explanation and bad grammar.</p>