[IMP] Need help with PL/SQL

Status
Not open for further replies.

raksrules

Youngling
This query may seem to be simple for some but i am not able to get how to achieve this. The scene is that i have a Lines table (say tab_lines) having 70 to 80 columns(approx). Now in this table i have a few columns starting at col8 to col65 (these are actual column names). Now my problem is that i need to look at the values in each of these columns (i.e. 8 to 65) for a value and do processing accordingly. This has to be done for each row in the table.

In gist, in need to check the value of each of the columns from col8 to col65 for each row in the tab_lines table. How do i do the looping to achieve this ? I have a rough idea that it will be nested loops wherein i will make a cursor that will select all the rows from the tab_lines table and open this cursor in a FOR loop. But after this i dont know how to loop through each of the columns (i.e. col8 to col65) in this row.

Please help me in this.
 

victor_rambo

हॉर्न ओके प्लीज़
If you can tell us how you want to process the fields, we can help you better. As of now,I really didn't get what you want. I understood that in a row, not all columns will contain data, but I don't get what you mean by 'processing' the data.
 
OP
raksrules

raksrules

Youngling
Sorry for the confusion. I will try to explain in a better way.

I have a lines table tab_lines which has 70 - 80 cols

The table structure is some what like this

Header_Id number;
Line_Id number;
col8 number;
col9 number;
.......
col65 number;

Now i want to loop through all the columns (col8 to col65) in the table tab_lines for each of the row. Its something like this

For each row in tab_lines loop

Loop through col 8 to col65
<insert data into some xyz table> --this is processing
end loop

end loop


So effectively on the basis of each value that i retrieve i need to insert data in a particular table. This is what i meant by processing. And i need to select the data for each of the cols (8 to 65) for each of the row. I mean for a single row there will be 57 times looping (65-8) and i will need to insert 57 rows in table xyz for each row in tab_lines
 

victor_rambo

हॉर्न ओके प्लीज़
ok, so basically, you want to perform INSERT queries on the table, correct? and you want to INSERT data into each of the col8 to col65 in loops?

Where will you be entering the values from? A CSV file, tab delimited text file, HTML table? or something other?
 
OP
raksrules

raksrules

Youngling
No No, I need to add some data (the values for which i have retrieved already) in a diff table xyz depending on the values of col8 to col65 ) of the table tab_lines. Insertion wont happen on the tab_lines table but in some other table xyz
 
Status
Not open for further replies.
Top Bottom