Re: SQL Selection Set Questions
Posted in 1997
Topics: Jobs, Consulting & Announcements
Larry W. Berman wrote: > > After performing a SQL select on a table, I need to then know how to work > with the selection set to: > > 1. Step through each record (row) > 2. Retrieve the value for a specific field in each row > 3. Set the value of a specific field in each row > 4. Run another SQL select with an "order by" parameter against the first > selection set to create a new sorted set. > > Thanks for your help. > > Larry Berman Hi Larry! You can handle this a few ways. If these are truly the stpes you want to go through, you can write a PL/SQL procedure. Then you can use cursors, loop through your data, change it and write more result sets out. I think another approach that can work by what you're showing here is the use of the simple, yet powerful DECODE function. If all you want to do is change the value of some result set based on certain values then DECODE can work fine. Then your results can contain the modified results which you can then sort as required. Without any more info that's the best that I can do. Good luck!! Altan Khendup Senior Consultant KPMG Peat Marwick LLP Enabling Technologies Data Management NOTE: The views in this email do not represent KPMG Peat Marwick LLP in any way.