473,322 Members | 1,566 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

PL/SQL Cursor - Reading records row by row and ignoring values

In a PL/SQL function.. I have a record set in a GTMP table as listed below.


My requirement is to read the record from this GTMP table and insert them into another GTMP table and ignore the records containing value ID '143','142','141' in the below example, Basically, I have to read the records from bottom i.e starting from ID 149 through 144. The key criteria is I need to ignore the records above Indicator 'Y' and UP_ID is null by node_number. I have to loop through for every node_no and store results in another GTMP tableHow can I achieve this in function?




Expand|Select|Wrap|Line Numbers
  1. ID    NODE_NO    ID    UP_ID    Indicator
  2. 12    R010    141    (NULL)    N
  3. 12    R010    142    141    N
  4. 12    R010    143    142    N
  5. 12    R010    144    (NULL)    Y
  6. 12    R010    145    144    N
  7. 12    R010    146    145    N
  8. 12    R010    147    146    N
  9. 12    R010    148    147    N
  10. 12    R010    149    148    N
  11. 12    R010    150    149    N
  12. 12    R010    151    150    N
  13. 12    R010    152    151    N
  14. 12    R010    153    152    N
  15. 12    R010    155    153    N
  16. 12    R010    156    146    N
  17. 12    R010    157    148    N
  18. 12    R010    158    153    N
  19. 12    R010    159    146    N
  20. 12    R010    160    148    N
  21. 12    R010    161    152    N
  22. 12    R010    163    161    N
  23. 12    R010    164    146    N
  24. 12    R010    165    148    N
  25. 12    R010    166    161    N
  26. 12    R010    167    145    N
  27. 12    R010    168    167    N
  28. 12    R010    169    148    N
  29. 12    R010    170    161    N
  30. 12    R010    171    167    N
  31. 12    R010    172    148    N
  32. 12    R010    173    161    N
  33. 12    R010    174    167    N
  34. 12    R010    175    148    N
  35. 12    R010    176    161    N
  36. 12    R010    177    167    N
  37. 12    R010    178    148    N
  38. 12    R010    179    161    N
  39. 12    R010    180    145    N
  40. 12    R010    181    180    N
  41. 12    R010    182    148    N
  42. 12    R010    183    153    N
  43. 12    R010    184    180    N
  44. 12    R010    185    148    N
  45. 12    R010    186    152    N
  46. 12    R010    188    186    N
  47. 12    R010    189    180    N
  48. 12    R010    190    148    N
  49. 12    R010    191    153    N
  50. 12    R010    192    180    N
  51. 12    R010    193    148    N
  52. 12    R010    194    152    N
  53. 12    R010    196    194    N
  54. 12    R010    197    180    N
  55. 12    R010    198    148    N
  56. 12    R010    199    153    N
  57. 12    R010    200    145    N
  58. 12    R010    201    200    N
  59. 12    R010    202    148    N
  60. 12    R010    203    194    N
  61. 12    R010    204    200    N
  62. 12    R010    205    148    N
  63. 12    R010    206    194    N
  64. 12    R010    207    200    N
  65. 12    R010    208    148    N
  66. 12    R010    209    194    N
  67. 12    R010    210    200    N
  68. 12    R010    211    148    N
  69. 12    R010    212    194    N
Mar 6 '15 #1
5 2485
Rabbit
12,516 Expert Mod 8TB
Why do you need to do this in a cursor? You can do this with a regular query. And why are you starting with 149?
Mar 6 '15 #2
I have to execute this in a PL/SQL function for multiple node_nos. Every node no would have similar record sets. In Simple terms, I just need to remove the records above indicator ='Y' and UP_ID=null for every node_no.
Mar 7 '15 #3
Rabbit
12,516 Expert Mod 8TB
Yeah, there's no reason why you need to do it through a cursor. What you can do instead is join the table to a subset of the table that only contains the Y records and use that to filter out the ones you don't want.
Mar 7 '15 #4
Thanks. As I stated earlier my requirement is not just to eliminate the records containing indicator 'Y' but also 'N' above the 'Y'. So how can I store only these records to a subset of the table?
Mar 7 '15 #5
Rabbit
12,516 Expert Mod 8TB
I understands what you're looking for, my suggestion remains the same as in my earlier post.
Mar 8 '15 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Rick Hughes | last post by:
I have a rather simple VB5 program to backup new/modified files to a CD. It dawned on me the other day that I have no way of knowing if the CD is any good. So I wrote some code to read every file...
6
by: Robin Cushman | last post by:
Hi all, I need some help -- I'm working with an A2K database, using DAO, and am trying to read records into a Crystal Report and then export it to a folder on our network as an Excel...
2
by: rivka.howley | last post by:
I wrote some code that creates a table with a date/time field at 15-minute intervals. Here's how I create and populate the table With tblDataTemp ..Fields.Append .CreateField("CT_ID", dbLong)...
15
by: shaqattack1992-newsgroups | last post by:
Hello Everyone, Let me explain my problem. I have included 2 dashes between each pair of records to make it easier to see what goes together. In reality, it is just a long list of results...
1
by: ungvichian | last post by:
So, right now I'm writing a program in VC++.Net with MFC, and one of the steps involves reading numeric values from a comma delimited file (like 4.56, 2.44, 3.453 etc.). The only methods I've been...
1
by: marfi95 | last post by:
I have a file that has it's rows terminated by CRLF's, so I can use peek/seek/readline to read the records. However, I need to read a record based on its record number in the file. For example, I...
4
by: Hagen Rehr | last post by:
Hello Newsgroup, the following Code reads 60.000 records from an Access Datatable: static void Main(string args) { String connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data...
2
ak1dnar
by: ak1dnar | last post by:
Hi all, I am getting this error in my ASP.net App, when reading some records which contains Null values for some of the columns. System.Data.SqlTypes.SqlNullValueException: Data is Null....
1
by: pvinod | last post by:
Hi, Consider a table have 10,00,000 records. What is the time difference between reading single record from the table and reading all the records from the table? which one will be faster? ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.