|
-
I have 2 tables,
EMP(empno, phone, dept, sal, hire_date, q_val1, qval2, qval3)
EMP_COLS(col_name, col_id)
Table EMP_COLS col_name field contains all of the column names in EMP.
I need to grab the first col_name from EMP_COLS and then loop thru every record in the corresponding column in EMP and if there is a value != 0 or != to null then copy that value and empno(from that row) and the column name into at datawarehouse table. Then do the same thing for all of the rest of the columns in the table. I was thinking of the following but im not sure if I can reference GetColsCurs in the 2nd cursor. Also I have no idea how I would then do the loop. Any help would be GREATLY appreciated!!!
Thanks,
SM
CURSOR GetColsCurs IS
SELECT COL_NAME
FROM EMP_COLS;
GetColsCursRec GetColsCurs%TYPE;
CURSOR GetDataCurs IS
SELECT GetColsCurs, EMP_NO
FROM EMP
Where GetColsCurs != '0'
AND Where GetColsCurs IS NOT NULL;
GetDataCursRec GetDataCurs%Rowtype;
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|