This discussion is archived
9 Replies Latest reply: Jan 15, 2013 10:08 AM by fac586 RSS

Condition Loop (If , case or When)

Lucy Discover Newbie
Currently Being Moderated
I have to write a Process where
Like some thing Below . I get error when using "or" .. is there any other way I can handle this Situation ?
if lower(V_AG_ORG)  not like lower(:P17_AG_ORG )     

or  lower(V_AG_DNUM)      not  like lower(:P17_AG_DNUM)      
or  lower(V_DTSUPVREJ)    not  like lower(:P17_DTSUPREJ)       
or  lower(V_AG_DNUM_SUPP) not  like lower(:P17_AG_DNUM_SUPP) 
or  lower(V_CSS_FIRM_NUM) not  like lower(:P17_FIRM_NUM)     
or  to_date(V_SERVTO)     not  like to_date(:P17_SERVTO)     
or  to_date(V_SERVFROM)   not  Like to_date(:P17_SERVFROM)   
 then

proc_snapshot(:P17_perf_eval_rtng_id);

end if;
procedure snapshot inserts records into another table when there is an Update to the Items on the Page.

Edited by: Lucy Discover on Jan 15, 2013 12:37 PM
  • 1. Re: Condition Loop (If , case or When)
    fac586 Guru
    Currently Being Moderated
    >

    <tt>if</tt> and <tt>case</tt> are branches, not loops.
    I have to write a Process where
    Where what?
    Like some thing Below . I get error when using "or"
    When you get an error it is of infinite utility to anyone trying to help you if you actually say what the error is...
    is there any other way I can handle this Situation ?
    Probably. However as we don't know what it does or what is wrong with it it's difficult to make any further comment at this juncture.
  • 2. Re: Condition Loop (If , case or When)
    evrm Pro
    Currently Being Moderated
    Hi,

    it's most likely that the error is caused by the fact that in your code you are depending on an implicit date conversion.
    If you know what the date format is, eg 'DD-MM-YYYY', use the correct format mask like:
    if lower(V_AG_ORG)  not like lower(:P17_AG_ORG )     
     
    or  lower(V_AG_DNUM)      not  like lower(:P17_AG_DNUM)      
    or  lower(V_DTSUPVREJ)    not  like lower(:P17_DTSUPREJ)       
    or  lower(V_AG_DNUM_SUPP) not  like lower(:P17_AG_DNUM_SUPP) 
    or  lower(V_CSS_FIRM_NUM) not  like lower(:P17_FIRM_NUM)     
    or  to_date(V_SERVTO, 'DD-MM-YYYY')     not  like to_date(:P17_SERVTO, 'DD-MM-YYYY')     
    or  to_date(V_SERVFROM, 'DD-MM-YYYY')   not  Like to_date(:P17_SERVFROM, 'DD-MM-YYYY')   
     then
     
    proc_snapshot(:P17_perf_eval_rtng_id);
     
    end if;
    regards,
    Erik-jan
  • 3. Re: Condition Loop (If , case or When)
    Lucy Discover Newbie
    Currently Being Moderated
    FAc,

    This is a Pl/SQl process where I have to check if any Items are getting updated by the User. If the Items is getting Updated I have to call the procedure to take a snapsho of the Records . The Procedure runs fine successfully inserts the records.

    I am just not sure to write the condition on how to check if any of the item on the Page is getting updated. I got to run this procedure even of one Item gets Updated.

    The procedure runs fine if I comment out the Or parts like below .
    if lower(V_AG_ORG)  not like lower(:P17_AG_ORG )     
    
    -- or  lower(V_AG_DNUM)      not  like lower(:P17_AG_DNUM)      
    -- or  lower(V_DTSUPVREJ)    not  like lower(:P17_DTSUPREJ)       
    -- or  lower(V_AG_DNUM_SUPP) not  like lower(:P17_AG_DNUM_SUPP) 
    -- or  lower(V_CSS_FIRM_NUM) not  like lower(:P17_FIRM_NUM)     
    -- or  to_date(V_SERVTO)     not  like to_date(:P17_SERVTO)     
    -- or  to_date(V_SERVFROM)   not  Like to_date(:P17_SERVFROM)   
     then
    
    proc_snapshot(:P17_perf_eval_rtng_id);
    
    end if;
    
    end;
  • 4. Re: Condition Loop (If , case or When)
    TexasApexDeveloper Guru
    Currently Being Moderated
    Why not just have a flag on the page that gets set when ANY of these items are updated? Then you can just to see if the flag is set and do your process? Using NOT LIKE with OR is not the best approach..

    Thank you,

    Tony Miller
    Ruckersville, VA
  • 5. Re: Condition Loop (If , case or When)
    Lucy Discover Newbie
    Currently Being Moderated
    EVRM , you seem to be right. The date conversion seems to be causing the issues.
  • 6. Re: Condition Loop (If , case or When)
    fac586 Guru
    Currently Being Moderated
    <font size=6>WHAT IS THE ERROR MESSAGE?</font>
  • 7. Re: Condition Loop (If , case or When)
    Lucy Discover Newbie
    Currently Being Moderated
    Tony,
    the users want to see who made the changes . So we need to capture the Record before the user changes it and keep it for their Review from Different Report.
  • 8. Re: Condition Loop (If , case or When)
    Lucy Discover Newbie
    Currently Being Moderated
    The Error does not show . The Process gets compiled and saved. Its when Trying to save the page that I get Error. It looks like to_date conversion seems to cause the Issue. Taking it off does successfully run the procedure. Not sure if its right approach to check with to_date conversion on the Items.
  • 9. Re: Condition Loop (If , case or When)
    fac586 Guru
    Currently Being Moderated
    Lucy Discover wrote:
    The Error does not show . The Process gets compiled and saved. Its when Trying to save the page that I get Error.
    That would be the error we're interested in.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points