There are at least 3 errors in your code:
1. Where do you fetch cursor seg_high_low into?
You need code like this:
CURSOR seg_high_low is
select CONCATENATED_SEGMENTS_HIGH, CONCATENATED_SEGMENTS_LOW into
seg_high,
seg_low from TP1_EDW_SOR.EGL_CROSS_VLD_RULES where
trim(upper(COA_ID)) =
ncoa_id and INCL_EXCL_IND = 'E';
-- NOTE:
rec_high_low seg_high_low%ROWTYPE;
2. Using OPEN
OPEN seg_high_low;
-- Now you need to fetch the row before you can test for
-- NOTE:
FETCH seg_high_low INTO rec_high_low;
seg_high_low%FOUND
3. You cannot reference a cursor, you need to reference a record:
IF ((norg_seg < substr(rec_high_low.seg_low, 0, 3)) OR (norg_seg >
substr(rec_high_low.seg_high, 0, 3))) then
-- NOTE: rec_high_low
Other way to do the same is:
FOR rec_high_low IN seg_high_low LOOP
...
END LOOP;
More to read:
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/open_statement.htm#LNPLS01332
HTH
Thomas
On May 14, 6:30 am, Roopesh S <[email protected]> wrote:
> hi,
>
> Following is the cursor created
>
> CURSOR seg_high_low is
> select CONCATENATED_SEGMENTS_HIGH, CONCATENATED_SEGMENTS_LOW into seg_high,
> seg_low from TP1_EDW_SOR.EGL_CROSS_VLD_RULES where trim(upper(COA_ID)) =
> ncoa_id and INCL_EXCL_IND = 'E';
> OPEN seg_high_low;
> while(seg_high_low%FOUND)
>
> LOOP
> IF ((norg_seg < substr(seg_high_low.seg_low, 0, 3)) OR (norg_seg >
> substr(seg_high_low.seg_high, 0, 3))) then
> num := 1;
> ELSIF ((nnml_seg < substr(seg_high_low.seg_low, 4, 8)) OR (nnml_seg >
> substr(seg_high_low.seg_high, 4, 8))) then
> num := 2;
> ELSIF ((cntpr_seg < substr(seg_high_low.seg_low, 9, 12)) OR (cntpr_seg >
> substr(seg_high_low.seg_high, 9, 12))) then
> num := 3;
>
> when i run the code.. it says...
>
> PLS-00225: subprogram or cursor 'SEG_HIGH_LOW' reference is out
> of scope
>
> ANY IDEA.. whats wrong here....
>
> --
> Thanx'N'Regards
> Roope
>
> --
> You received this message because you are subscribed to the Google
> Groups "Oracle PL/SQL" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group
> athttp://groups.google.com/group/Oracle-PLSQL?hl=en
--
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en