Need to turn this PLSQL into a procedure

Hi All,
I have the following PLSQL which declares a cursor, then loops using the cursor variable. I'm new to creating procedures and packages and i'm having trouble turning this PLSQL into one of those. When i put my PLSQL code in a procedure it doesn't like the DECLARE statement or the CURSOR section. I'm not sure how to tweak it to get the syntax correct for a procedure. Can someone point me in the right direction?
Here is the PLSQL:
DECLARE
/* Output variables to hold the result of the query: */
groupid assignment_group.id%TYPE;
/* Cursor declaration: */
CURSOR Asset_Rank_HistoryCursor IS
select distinct id from assignment_group;
BEGIN
OPEN Asset_Rank_HistoryCursor;
LOOP
/* Retrieve each row of the result of the above query into PL/SQL variables: */
FETCH Asset_Rank_HistoryCursor INTO groupid;
/* If there are no more rows to fetch, exit the loop: */
EXIT WHEN Asset_Rank_HistoryCursor%NOTFOUND;
/* Insert the the new rows */
insert into ASSET_RANK_GROUPED (asset_id , dt, rank, score, ASSIGNMENT_GROUP_ID)
select asset_id, max_dt, rownum, score, groupid from (
SELECT <big nasty select statement>
END LOOP;
/* Free cursor used by the query. */
CLOSE Asset_Rank_HistoryCursor;
END;
How do i change my DECLARE and CURSOR statement so the procedure will create. Do i need to break it out into a function?

I figured it out... just had to play w/ the syntax. Had to make sure the BEGIN statement was AFTER the CURSOR declaration and had to make sure any variables are declared up top, didn't need a DECLARE section in procedure. I just put the groupid variable right after IS at the top of procedure creation statement.

Similar Messages

  • [F8]Need to turn this gallery into a slide show

    I have some code from a "how to" used to create a photo
    gallery. This gallery was meant to be used with buttons but, what I
    need is for the images to fade in and out automatically. Not sure
    what code would allow that to happen.
    Im using this type of gallery becuase I will have approx 300
    images to fade in and out. I plan on having four of these objects
    on the stage running at the same time.
    Here is the code I am working with:
    //Code written by sbeener (suprabeener)
    i wrote this code, but you can use and abuse it however you
    like.
    the methods are defined in the order which they occur to
    make it
    easier to understand.
    // variables ------------------------------------------
    // put the path to your pics here, include the slashes (ie.
    "pics/")
    // leave it blank if they're in the same directory
    this.pathToPics = "";
    // fill this array with your pics
    this.pArray = ["small8-05-1.jpg", "small8-05-2.jpg",
    "small8-05-3.jpg", "small8-05-4.jpg", "small8-05-5.jpg",
    "small8-05-6.jpg", "small8-05-7.jpg", "small8-05-8.jpg",
    "small8-05-9.jpg",
    "small8-05-10.jpg","small8-05-11.jpg","small12-22-05-12.jpg","small12-22-05-13.jpg","smal l12-22-05-14.jpg","small12-22-05-15.jpg","small12-22-05-16.jpg","small12-22-05-17.jpg","sm all12-22-05-18.jpg","smallCommonEntrance-19.jpg"];
    this.fadeSpeed = 50;
    this.pIndex = 0;
    // MovieClip methods ----------------------------------
    // d=direction; should 1 or -1 but can be any number
    //loads an image automatically when you run animation
    loadMovie(this.pathToPics+this.pArray[0], _root.photo);
    MovieClip.prototype.changePhoto = function(d) {
    // make sure pIndex falls within pArray.length
    this.pIndex = (this.pIndex+d)%this.pArray.length;
    if (this.pIndex<0) {
    this.pIndex += this.pArray.length;
    this.onEnterFrame = fadeOut;
    MovieClip.prototype.fadeOut = function() {
    if (this.photo._alpha>this.fadeSpeed) {
    this.photo._alpha -= this.fadeSpeed;
    } else {
    this.loadPhoto();
    MovieClip.prototype.loadPhoto = function() {
    // specify the movieclip to load images into
    var p = _root.photo;
    p._alpha = 0;
    p.loadMovie(this.pathToPics+this.pArray[this.pIndex]);
    this.onEnterFrame = loadMeter;
    MovieClip.prototype.loadMeter = function() {
    var i, l, t;
    l = this.photo.getBytesLoaded();
    t = this.photo.getBytesTotal();
    if (t>0 && t == l) {
    this.onEnterFrame = fadeIn;
    } else {
    trace(l/t);
    MovieClip.prototype.fadeIn = function() {
    if (this.photo._alpha<100-this.fadeSpeed) {
    this.photo._alpha += this.fadeSpeed;
    } else {
    this.photo._alpha = 100;
    this.onEnterFrame = null;
    // Actions -----------------------------------------
    // these aren't necessary, just an example implementation
    this.onKeyDown = function() {
    if (Key.getCode() == Key.LEFT) {
    this.changePhoto(-1);
    } else if (Key.getCode() == Key.RIGHT) {
    this.changePhoto(1);
    Key.addListener(this);

    I figured it out... just had to play w/ the syntax. Had to make sure the BEGIN statement was AFTER the CURSOR declaration and had to make sure any variables are declared up top, didn't need a DECLARE section in procedure. I just put the groupid variable right after IS at the top of procedure creation statement.

  • Need to turn this lastName_Name_01_07_1980.xml into  Name LastName 01.07.80

    Hi all
    I am using this code to trim a string and place it into a jMenu. Now I would like to change the out the way is looks to make it easier to view.
    Like this:
    Need to turn this file name lastName_FirstName_01_07_1980.xml into FirstName LastName 01.07.80
    is this posible to do ?
    can some me how ?
      private void addItem(JMenu menu, char a)
      File dir = new File("Epod Configuration/Orders To Upload");
            File[] files = dir.listFiles();
            for (int j=0; j < files.length; j++)
                    String trim = ""+files[j];
                    int ndx;
                    if ((ndx = trim.lastIndexOf('/')) != -1) trim = trim.substring(ndx+1);
                    if (trim.charAt(0) == a)
                      System.out.println(trim);
                            JMenuItem mi = new JMenuItem(trim);
                            menu.add(mi);
      }Thanks
    Craig

    thanks for that
    but how do I put the two codes together ??
    the file name also has .xml at the end what is the bet way of getting rid of that
    this is what I have try but doesn't work
    Please help
    private void addItem(JMenu menu, char a)
        File dir = new File("Epod Configuration/Orders To Upload");
        File[] files = dir.listFiles();
        for (int j=0; j < files.length; j++)
          String trim = ""+files[j];
          int ndx;
          if ((ndx = trim.lastIndexOf('/')) != -1) trim = trim.substring(ndx+1);
          if (trim.charAt(0) == a)
            System.out.println(trim);
            String s = "lastName_FirstName_01_07_1980";
            StringTokenizer st = new StringTokenizer(s, "_");
            String last = st.nextToken();
            String first = st.nextToken();
            String month = st.nextToken();
            String day = st.nextToken();
            String year = st.nextToken();
            System.out.println(first + ' ' + last + ' ' + month + '.' + day + '.' + year);
            JMenuItem mi = new JMenuItem(trim);
            menu.add(mi);
      }

  • What peripherals do you need to turn your iPhone into a conference room speakerphone?

    What peripherals do you need to turn your iPhone into a conference room speakerphone system?
    If you buy a separate conference mic and a speaker, can they somehow work together off the iPhone headphone jack like a huge set of group earphones?  What if you want to connect 2 mics and a speaker?
    Do you have to be very careful that they can all be attached somehow at the same time?
    Are there reasonably priced conference room speakerphone peripherals the work well together that you would recommend?
    Steve

    Why don't you contact Apple and find out?  Certainly if you can find your way around the internet to have been able to find this forum, you can certainly find the number for AppleCare.

  • How to turn this Java into something I can use in CF?

    Hi - Following on from a recent post about how to strip our special characters from a string before insertion to the db I have found this Java code - my question is, how can I turn this into something I can use with CF? I think I need to use the cfscipt tag but that's right on the boundaries of my knowledge base.. If anyone could please help I'd be ever so grateful - thank you!
    package net.htmlescape;
    * HtmlEscape in Java, which is compatible with utf-8
    * @author Ulrich Jensen, http://www.htmlescape.net
    * Feel free to get inspired, use or steal this code and use it in your
    * own projects.
    * License:
    * You have the right to use this code in your own project or publish it
    * on your own website.
    * If you are going to use this code, please include the author lines.
    * Use this code at your own risk. The author does not warrent or assume any
    * legal liability or responsibility for the accuracy, completeness or usefullness of
    * this program code.
    public class HtmlEscape {
      private static char[] hex={'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
       * Method for html escaping a String, for use in a textarea
       * @param original The String to escape
       * @return The escaped String
      public static String escapeTextArea(String original)
        return escapeSpecial(escapeTags(original));    
       * Normal escape function, for Html escaping Strings
       * @param original The original String
       * @return The escape String
      public static String escape(String original)
        return escapeSpecial(escapeBr(escapeTags(original)));
      public static String escapeTags(String original)
        if(original==null) return "";
        StringBuffer out=new StringBuffer("");
        char[] chars=original.toCharArray();
        for(int i=0;i<chars.length;i++)
          boolean found=true;
          switch(chars[i])
            case 60:out.append("&lt;"); break; //<
            case 62:out.append("&gt;"); break; //>
            case 34:out.append("&quot;"); break; //"
            default:found=false;break;
          if(!found) out.append(chars[i]);
        return out.toString();
      public static String escapeBr(String original)
        if(original==null) return "";
        StringBuffer out=new StringBuffer("");
        char[] chars=original.toCharArray();
        for(int i=0;i<chars.length;i++)
          boolean found=true;
          switch(chars[i])
            case '\n': out.append("<br/>"); break; //newline
            case '\r': break;
            default:found=false;break;
          if(!found) out.append(chars[i]);
        return out.toString();
      public static String escapeSpecial(String original)
        if(original==null) return "";
        StringBuffer out=new StringBuffer("");
        char[] chars=original.toCharArray();
        for(int i=0;i<chars.length;i++)
            boolean found=true;
          switch(chars[i]) {
            case 38:out.append("&amp;"); break; //&
            case 198:out.append("&AElig;"); break; //Æ
            case 193:out.append("&Aacute;"); break; //Á
            case 194:out.append("&Acirc;"); break; //Â
            case 192:out.append("&Agrave;"); break; //À
            case 197:out.append("&Aring;"); break; //Å
            case 195:out.append("&Atilde;"); break; //Ã
            case 196:out.append("&Auml;"); break; //Ä
            case 199:out.append("&Ccedil;"); break; //Ç
            case 208:out.append("&ETH;"); break; //Ð
            case 201:out.append("&Eacute;"); break; //É
            case 202:out.append("&Ecirc;"); break; //Ê
            case 200:out.append("&Egrave;"); break; //È
            case 203:out.append("&Euml;"); break; //Ë
            case 205:out.append("&Iacute;"); break; //Í
            case 206:out.append("&Icirc;"); break; //Î
            case 204:out.append("&Igrave;"); break; //Ì
            case 207:out.append("&Iuml;"); break; //Ï
            case 209:out.append("&Ntilde;"); break; //Ñ
            case 211:out.append("&Oacute;"); break; //Ó
            case 212:out.append("&Ocirc;"); break; //Ô
            case 210:out.append("&Ograve;"); break; //Ò
            case 216:out.append("&Oslash;"); break; //Ø
            case 213:out.append("&Otilde;"); break; //Õ
            case 214:out.append("&Ouml;"); break; //Ö
            case 222:out.append("&THORN;"); break; //Þ
            case 218:out.append("&Uacute;"); break; //Ú
            case 219:out.append("&Ucirc;"); break; //Û
            case 217:out.append("&Ugrave;"); break; //Ù
            case 220:out.append("&Uuml;"); break; //Ü
            case 221:out.append("&Yacute;"); break; //Ý
            case 225:out.append("&aacute;"); break; //á
            case 226:out.append("&acirc;"); break; //â
            case 230:out.append("&aelig;"); break; //æ
            case 224:out.append("&agrave;"); break; //à
            case 229:out.append("&aring;"); break; //å
            case 227:out.append("&atilde;"); break; //ã
            case 228:out.append("&auml;"); break; //ä
            case 231:out.append("&ccedil;"); break; //ç
            case 233:out.append("&eacute;"); break; //é
            case 234:out.append("&ecirc;"); break; //ê
            case 232:out.append("&egrave;"); break; //è
            case 240:out.append("&eth;"); break; //ð
            case 235:out.append("&euml;"); break; //ë
            case 237:out.append("&iacute;"); break; //í
            case 238:out.append("&icirc;"); break; //î
            case 236:out.append("&igrave;"); break; //ì
            case 239:out.append("&iuml;"); break; //ï
            case 241:out.append("&ntilde;"); break; //ñ
            case 243:out.append("&oacute;"); break; //ó
            case 244:out.append("&ocirc;"); break; //ô
            case 242:out.append("&ograve;"); break; //ò
            case 248:out.append("&oslash;"); break; //ø
            case 245:out.append("&otilde;"); break; //õ
            case 246:out.append("&ouml;"); break; //ö
            case 223:out.append("&szlig;"); break; //ß
            case 254:out.append("&thorn;"); break; //þ
            case 250:out.append("&uacute;"); break; //ú
            case 251:out.append("&ucirc;"); break; //û
            case 249:out.append("&ugrave;"); break; //ù
            case 252:out.append("&uuml;"); break; //ü
            case 253:out.append("&yacute;"); break; //ý
            case 255:out.append("&yuml;"); break; //ÿ
            case 162:out.append("&cent;"); break; //¢
            default:
              found=false;
              break;
          if(!found)
            if(chars[i]>127) {
              char c=chars[i];
              int a4=c%16;
              c=(char) (c/16);
              int a3=c%16;
              c=(char) (c/16);
              int a2=c%16;
              c=(char) (c/16);
              int a1=c%16;
              out.append("&#x"+hex[a1]+hex[a2]+hex[a3]+hex[a4]+";");    
            else
              out.append(chars[i]);
        return out.toString();

    hi Dan, thanks for asking
    I did this in the end..
    <cfscript>
      // function cleantext(string) {
      //   string = "<p>" & string;
      //   string = Replace(string, chr(13) & chr(10) & chr(13) & chr(10), "</p><p>", "all");
      //   string = Replace(string, chr(13) & chr(10), "<br />", "all");
      //   string = string & "</p>";
      //   return string;
    * HtmlEscape in Java, which is compatible with utf-8
    * @author Ulrich Jensen, http://www.htmlescape.net
    * Feel free to get inspired, use or steal this code and use it in your
    * own projects.
    * License:
    * You have the right to use this code in your own project or publish it
    * on your own website.
    * If you are going to use this code, please include the author lines.
    * Use this code at your own risk. The author does not warrent or assume any
    * legal liability or responsibility for the accuracy, completeness or usefullness of
    * this program code.
    function cleantext(string)  {
      private static char[] hex={'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
       * Method for html escaping a String, for use in a textarea
       * @param original The String to escape
       * @return The escaped String
      public static String escapeTextArea(String original)
        return escapeSpecial(escapeTags(original));   
       * Normal escape function, for Html escaping Strings
       * @param original The original String
       * @return The escape String
      public static String escape(String original)
        return escapeSpecial(escapeBr(escapeTags(original)));
      public static String escapeTags(String original)
        if(original==null) return "";
        StringBuffer out=new StringBuffer("");
        char[] chars=original.toCharArray();
        for(int i=0;i<chars.length;i++)
          boolean found=true;
          switch(chars[i])
            case 60:out.append("&lt;"); break; //<
            case 62:out.append("&gt;"); break; //>
            case 34:out.append("&quot;"); break; //"
            default:found=false;break;
          if(!found) out.append(chars[i]);
        return out.toString();
      public static String escapeBr(String original)
        if(original==null) return "";
        StringBuffer out=new StringBuffer("");
        char[] chars=original.toCharArray();
        for(int i=0;i<chars.length;i++)
          boolean found=true;
          switch(chars[i])
            case '\n': out.append("<br/>"); break; //newline
            case '\r': break;
            default:found=false;break;
          if(!found) out.append(chars[i]);
        return out.toString();
      public static String escapeSpecial(String original)
        if(original==null) return "";
        StringBuffer out=new StringBuffer("");
        char[] chars=original.toCharArray();
        for(int i=0;i<chars.length;i++)
            boolean found=true;
          switch(chars[i]) {
            case 38:out.append("&amp;"); break; //&
            case 198:out.append("&AElig;"); break; //Æ
            case 193:out.append("&Aacute;"); break; //Á
            case 194:out.append("&Acirc;"); break; //Â
            case 192:out.append("&Agrave;"); break; //À
            case 197:out.append("&Aring;"); break; //Å
            case 195:out.append("&Atilde;"); break; //Ã
            case 196:out.append("&Auml;"); break; //Ä
            case 199:out.append("&Ccedil;"); break; //Ç
            case 208:out.append("&ETH;"); break; //Ð
            case 201:out.append("&Eacute;"); break; //É
            case 202:out.append("&Ecirc;"); break; //Ê
            case 200:out.append("&Egrave;"); break; //È
            case 203:out.append("&Euml;"); break; //Ë
            case 205:out.append("&Iacute;"); break; //Í
            case 206:out.append("&Icirc;"); break; //Î
            case 204:out.append("&Igrave;"); break; //Ì
            case 207:out.append("&Iuml;"); break; //Ï
            case 209:out.append("&Ntilde;"); break; //Ñ
            case 211:out.append("&Oacute;"); break; //Ó
            case 212:out.append("&Ocirc;"); break; //Ô
            case 210:out.append("&Ograve;"); break; //Ò
            case 216:out.append("&Oslash;"); break; //Ø
            case 213:out.append("&Otilde;"); break; //Õ
            case 214:out.append("&Ouml;"); break; //Ö
            case 222:out.append("&THORN;"); break; //Þ
            case 218:out.append("&Uacute;"); break; //Ú
            case 219:out.append("&Ucirc;"); break; //Û
            case 217:out.append("&Ugrave;"); break; //Ù
            case 220:out.append("&Uuml;"); break; //Ü
            case 221:out.append("&Yacute;"); break; //Ý
            case 225:out.append("&aacute;"); break; //á
            case 226:out.append("&acirc;"); break; //â
            case 230:out.append("&aelig;"); break; //æ
            case 224:out.append("&agrave;"); break; //à
            case 229:out.append("&aring;"); break; //å
            case 227:out.append("&atilde;"); break; //ã
            case 228:out.append("&auml;"); break; //ä
            case 231:out.append("&ccedil;"); break; //ç
            case 233:out.append("&eacute;"); break; //é
            case 234:out.append("&ecirc;"); break; //ê
            case 232:out.append("&egrave;"); break; //è
            case 240:out.append("&eth;"); break; //ð
            case 235:out.append("&euml;"); break; //ë
            case 237:out.append("&iacute;"); break; //í
            case 238:out.append("&icirc;"); break; //î
            case 236:out.append("&igrave;"); break; //ì
            case 239:out.append("&iuml;"); break; //ï
            case 241:out.append("&ntilde;"); break; //ñ
            case 243:out.append("&oacute;"); break; //ó
            case 244:out.append("&ocirc;"); break; //ô
            case 242:out.append("&ograve;"); break; //ò
            case 248:out.append("&oslash;"); break; //ø
            case 245:out.append("&otilde;"); break; //õ
            case 246:out.append("&ouml;"); break; //ö
            case 223:out.append("&szlig;"); break; //ß
            case 254:out.append("&thorn;"); break; //þ
            case 250:out.append("&uacute;"); break; //ú
            case 251:out.append("&ucirc;"); break; //û
            case 249:out.append("&ugrave;"); break; //ù
            case 252:out.append("&uuml;"); break; //ü
            case 253:out.append("&yacute;"); break; //ý
            case 255:out.append("&yuml;"); break; //ÿ
            case 162:out.append("&cent;"); break; //¢
            default:
              found=false;
              break;
          if(!found)
            if(chars[i]>127) {
              char c=chars[i];
              int a4=c%16;
              c=(char) (c/16);
              int a3=c%16;
              c=(char) (c/16);
              int a2=c%16;
              c=(char) (c/16);
              int a1=c%16;
              out.append("&#x"+hex[a1]+hex[a2]+hex[a3]+hex[a4]+";");   
            else
              out.append(chars[i]);
        return out.toString();
    </cfscript>  
    <cfset cleanedtext = cleantext(dirtytext)>
    Although actually I also ended up changing my charset of my tables to utf8 (it was latin_swedish) and that seems to have solved the head issue (with special characters (bullet points i think it was) throwing an error when inserting them in the db)

  • Return Current month Data:Help needed in modifying this code of a Procedure

    Hello Folks i have this scenario where i need to modify this code so that it has to return data from the Current month First Day to the previous Day if its a daily report and previous month data if its a monthly report.
    I have no clue how to modify this code below. Currently the code is returning data for Monthly reports for the previous month. Does anyone have any idea how to modify so that the code meets the requirements of both daily and monthly reprts.
    BEGIN
    if v_lowdate is null or v_highdate is null then
    select to_number(to_char(sysdate, 'DD')) into v_cur_day from dual;
    if v_cur_day < 25 then
    -- this is for the previous month run
    Select Add_Months(trunc(sysdate, 'MONTH'), -1)
    INTO V_LOWDATE
    FROM DUAL;
    SELECT Last_Day(ADD_Months(Sysdate, -1)) INTO V_Highdate From Dual;
    else
    -- this is for the current month run
    Select trunc(sysdate, 'MONTH') INTO V_LOWDATE FROM DUAL;
    SELECT Last_Day(Sysdate) INTO V_Highdate From Dual;
    end if;
    end if;
    Thanks
    Edited by: user11961230 on Sep 30, 2009 8:34 PM

    Hi Frank, This is code till the "modifying Code" which we were working. I will post the code after the "modifying Code" in the next reply. Thanks
    CREATE OR REPLACE PROCEDURE "POPULATE_RECOVERY_ACTIVITYHN"(p_lowdate date,
    p_highdate date) IS
    v_lowdate date := p_lowdate;
    v_highdate date := p_highdate;
    v_error_code NUMBER(20);
    v_error_text VARCHAR2(300);
    v_recovery_id Recovery.Recovery_ID%type;
    v_loop_control Number(20);
    v_settlement_id recovery.settlement_id%type;
    V_Event_ID Event.Event_ID%Type;
    V_Event_Case_ID Event_Case.Event_Case_ID%Type;
    V_Recovery_Month Varchar2(100);
    V_Major_Company Major_Client.Major_Client_Name%Type;
    V_Company Client.Client_Name%Type;
    V_Client_Policy_Identifier Varchar2(100);
    V_Lan_ID Varchar2(10) := 'TROVERIS';
    V_Recovery_Account Client.Account_Number%Type;
    V_AccountA Number(2) := 0;
    V_AccountB Number(2) := 0;
    V_Unit Event_Client_Field.Client_Field_Data%Type;
    V_Market Event_Client_Field.Client_Field_Data%Type;
    V_case_open_date Event_case.Open_Date%type;
    V_Employer_Group_Code Employer_Group.Employer_Group_Code%Type;
    V_Unknown1 Number(2) := 0;
    V_Fee_Schedule_Code Event_Case.Fee_Schedule_Code%Type;
    V_Total_Fee_Percent Number(20, 2) := 0.00;
    V_Subrogation_Fee_Percent Number(20, 2) := 0.00;
    V_Unknown2 Number(2) := NULL;
    V_Unknown3 Number(2) := NULL;
    V_TOTAL_MEDICAL Number(20, 2) := 0.00;
    V_Recovery_Amount Number(20, 2) := 0.00;
    V_Total_Tax Number(20, 2) := 0.00;
    V_Administrative_Tax Number(20, 2) := 0.00;
    V_Total_NonCash_Fee Number(20, 2) := 0.00;
    V_Total_NonCash_Positive Number(20, 2) := 0.00;
    V_Total_NonCash_Negative Number(20, 2) := 0.00;
    V_Total_Recovery Number(20, 2) := 0.00;
    V_Total_NonCash_Fee_Positive Number(20, 2) := 0.00;
    V_Total_NonCash_Fee_Negative Number(20, 2) := 0.00;
    V_Total_Admin_Fee Number(20, 2) := 0.00;
    V_Total_Fee Number(20, 2) := 0.00;
    V_Total_NonCash_Tax_Positive Number(20, 2) := 0.00;
    V_Total_NonCash_Tax_Negative Number(20, 2) := 0.00;
    report_type                  Varchar2(2);
    v_gl_num client.gl_num%type; -- *002*
    v_net_billable client.net_billable%type; -- *003*
    vevent_id event.event_id%type; -- *006*
    v_prev_event event.event_id%type; -- *006*
    v_prev_case event_case.event_case_id%type; -- *006*
    v_tot_recovery recovery.amount%type; -- *006*
    v_rec_amount recovery.amount%type; -- *006*
    v_prev_rec_amt recovery.amount%type; -- *006*
    v_prev_rec_month recovery_activity.recovery_month%type; -- *006*
    v_tot_fee recovery_activity.total_fee%type; --*006*
    v_mth_rev unbundled_recoveries.monthly_revenue%type; -- *006*
    v_diff number(18, 2); -- *006*
    v_nc_count number := 0; -- *006*
    v_c_count number := 0; -- *006*
    v_nc_tot recovery.amount%type; -- *006*
    v_used_rev recovery_activity.total_fee%type; -- *006*
    v_use_mth_rev unbundled_recoveries.monthly_revenue%type := 0; -- *006*
    v_use_nc_mth_rev unbundled_recoveries.monthly_revenue%type := 0; -- *006*
    v_prev_netbill client.net_billable%type; -- *006*
    v_event_type event.event_type_code%type;
    v_date_typed event.date_typed%type;
    v_acc_client_id client.acc_client_id%Type;
    v_Recovery_Revenue_GL_Num client.recovery_revenue_gl_num%Type;
    v_Funds_Due_GL_num client.funds_due_gl_num%Type;
    v_lob Varchar2(20);
    v_nc_recovery_id recovery.recovery_id%Type;
    /*Changed the Client_Policy_Identifier to concatenate the Retlation to insured code instead of the description
    which was exceeding the column size in the table. SWL 09/03/02. Checked with the Design Doc.*/
    CURSOR RECOVERY_INFO IS
    SELECT Event.Event_ID,
    Event_Case.Event_Case_ID,
    TO_CHAR(Recovery.Recovery_Date, 'FMMONTHYYYY') As Recovery_Month,
    Major_Client.Major_Client_Name AS Major_Company,
    -- Client.Client_Name AS Company,
    -- nvl(client.legacy_client_id,'DC')||'-'||substr(Client.Client_Name,1,55) AS Company, -- SWL 04/01/04 52653
    substr(nvl(client.legacy_client_id,
    decode(client.client_id, 1, 'DC', client.client_code)) || '-' ||
    Client.Client_Name,
    1,
    60) AS Company,
    Event.Client_Policy_Identifier ||
    Event_Case.Relation_To_Insured_code as Client_Policy_Identifier,
    Client.Account_Number as Recovery_Account,
    Employer_Group.Employer_Group_Code,
    Event_Case.Fee_Schedule_Code,
    Recovery_ID,
    Event_case.Open_Date,
    '(' || recovery.recovery_transaction_internal || ')' ||
    l.recovery_transaction_descripti, --fml 110276
    recovery.settlement_id,
    trim(client.gl_num), -- *002*
    nvl(trim(client.net_billable), 'N'), -- *003*
    recovery.amount, -- *006*,
    event.event_type_code,
    event.date_typed,
    recovery_id,
    Client.ACC_CLIENT_ID,
    Recovery_Revenue_GL_Num,
    Funds_Due_GL_num
    FROM Recovery,
    Settlement,
    Event_Case,
    Event,
    Employer_Group,
    Client,
    Major_Client,
    recovery_transaction_lookup l
    Where to_date(Recovery.Recovery_Date, 'DD-MON-RR') between
    TO_DATE(v_lowdate, 'DD-MON-RR') and
    TO_DATE(v_highdate, 'DD-MON-RR')
    AND Settlement.Settlement_id = Recovery.Settlement_id
    AND Settlement.Event_Case_ID = Event_Case.Event_Case_id
    AND Event_Case.Event_ID = Event.Event_ID
    AND Event.Employer_Group_ID = Employer_Group.Employer_Group_ID(+)
    AND Event.Client_ID = Client.Client_ID
    AND Client.Major_Client_id = Major_Client.Major_Client_ID(+)
    and recovery.settlement_id not in
    (select settlement_id
    from recovery
    where to_date(Recovery.Recovery_Date, 'DD-MON-RR') between
    TO_DATE(v_lowdate, 'DD-MON-RR') and
    TO_DATE(v_highdate, 'DD-MON-RR')
    AND recovery_transaction_internal in
    ('05', '50', '52', '51'))
    --001
    and    client.invoice_flag = 'N'            *005* commenting
    -- SWL 05/03/05 #71231
    and event.event_id in
    (select event_id
    from event_end_user eeu
    where eeu.active_flag = 'Y'
    and eeu.owner_flag = 'Y'
    and eeu.end_user_id in
    (select end_user_id
    from end_user
    where end_user.research_internal_user = 'Y'))
    and recovery.recovery_transaction_internal =
    l.recovery_transaction_internal --fml 110276
    order by event.event_id, recovery.amount; -- *006*
    -- SWL 05/03/05 #71231
    -- end of 001
    -- SWL 11/10/03 # 52743
    -- *006*
    CURSOR get_recovery(vevent_id event.event_id%type) IS
    SELECT sum(r.amount)
    FROM Recovery r
    Where to_date(r.Recovery_Date, 'DD-MON-RR') between
    TO_DATE(v_lowdate, 'DD-MON-RR') and
    TO_DATE(v_highdate, 'DD-MON-RR')
    and r.event_id = vevent_id
    and r.settlement_id not in
    (select settlement_id
    from recovery
    where to_date(Recovery.Recovery_Date, 'DD-MON-RR') between
    TO_DATE(v_lowdate, 'DD-MON-RR') and
    TO_DATE(v_highdate, 'DD-MON-RR')
    AND recovery_transaction_internal in
    ('05', '50', '52', '51'))
    and r.event_id in
    (select event_id
    from event_end_user eeu
    where eeu.active_flag = 'Y'
    and eeu.owner_flag = 'Y'
    and eeu.end_user_id in
    (select end_user_id
    from end_user
    where end_user.research_internal_user = 'Y'));
    CURSOR RECOVERY_INFO_NC IS
    SELECT distinct Event.Event_ID,
    Event_Case.Event_Case_ID,
    TO_CHAR(Recovery.Recovery_Date, 'FMMONTHYYYY') As Recovery_Month,
    Major_Client.Major_Client_Name AS Major_Company,
    -- Client.Client_Name AS Company,
    -- nvl(client.legacy_client_id,'DC')||'-'||substr(Client.Client_Name,1,55) AS Company, /* SWL 04/01/04 52653 */
    substr(nvl(client.legacy_client_id,
    decode(client.client_id,
    1,
    'DC',
    client.client_code)) || '-' ||
    Client.Client_Name,
    1,
    60) AS Company,
    Event.Client_Policy_Identifier ||
    Event_Case.Relation_To_Insured_code as Client_Policy_Identifier,
    Client.Account_Number as Recovery_Account,
    Employer_Group.Employer_Group_Code,
    Event_Case.Fee_Schedule_Code,
    '(' || recovery.recovery_transaction_internal || ')' ||
    l.recovery_transaction_descripti, --fml 110276
    recovery.settlement_id,
    trim(client.gl_num), -- *002*
    nvl(trim(client.net_billable), 'N'), -- *003*
    recovery.amount,-- *006*
    recovery.recovery_id,
    event.event_type_code,
    event.date_typed,
    Client.ACC_CLIENT_ID,
    Recovery_Revenue_GL_Num,
    Funds_Due_GL_num
    FROM Recovery,
    Settlement,
    Event_Case,
    Event,
    Employer_Group,
    Client,
    Major_Client,
    recovery_transaction_lookup l
    Where to_date(Recovery.Recovery_Date, 'DD-MON-RR') between
    TO_DATE(v_lowdate, 'DD-MON-RR') and
    TO_DATE(v_highdate, 'DD-MON-RR')
    AND Settlement.Settlement_id = Recovery.Settlement_id
    AND Settlement.Event_Case_ID = Event_Case.Event_Case_id
    AND Event_Case.Event_ID = Event.Event_ID
    AND Event.Employer_Group_ID = Employer_Group.Employer_Group_ID(+)
    AND Event.Client_ID = Client.Client_ID
    AND Client.Major_Client_id = Major_Client.Major_Client_ID(+)
    and recovery.settlement_id in
    (select settlement_id
    from recovery
    where to_date(Recovery.Recovery_Date, 'DD-MON-RR') between
    TO_DATE(v_lowdate, 'DD-MON-RR') and
    TO_DATE(v_highdate, 'DD-MON-RR')
    --001
    AND recovery.recovery_transaction_internal in
    ('05', '50', '52', '51')
    and    client.invoice_flag = 'N'   *005* commenting
    /* SWL 05/03/05 #71231 */
    and event.event_id in
    (select event_id
    from event_end_user eeu
    where eeu.active_flag = 'Y'
    and eeu.owner_flag = 'Y'
    and eeu.end_user_id in
    (select end_user_id
    from end_user
    where end_user.research_internal_user = 'Y'))
    and recovery.recovery_transaction_internal =
    l.recovery_transaction_internal --fml 110276
    order by event.event_id, recovery.amount; -- *006*
    /* SWL 05/03/05 #71231 */
    --end of 001
    -- *006*
    CURSOR get_recovery_nc(vevent_id event.event_id%type) IS
    SELECT sum(r.amount)
    FROM Recovery r
    Where to_date(r.Recovery_Date, 'DD-MON-RR') between
    TO_DATE(v_lowdate, 'DD-MON-RR') and
    TO_DATE(v_highdate, 'DD-MON-RR')
    AND r.event_id = vevent_id
    and r.settlement_id in
    (select settlement_id
    from recovery
    where to_date(Recovery.Recovery_Date, 'DD-MON-RR') between
    TO_DATE(v_lowdate, 'DD-MON-RR') and
    TO_DATE(v_highdate, 'DD-MON-RR'))
    AND recovery_transaction_internal in ('05', '50', '52', '51')
    and r.event_id in
    (select event_id
    from event_end_user eeu
    where eeu.active_flag = 'Y'
    and eeu.owner_flag = 'Y'
    and eeu.end_user_id in
    (select end_user_id
    from end_user
    where end_user.research_internal_user = 'Y'));
    CURSOR Recovery_Totals_Nc IS
    Select Recovery_Detail.Recovery_Id, /* SWL 07/01/04 59016 */
    max(NVL(Recovery_Detail.Fees_Percent, 0) +
    NVL(Recovery_Detail.Admin_Percent, 0)) as Total_Fee_Percent,
    max(NVL(Recovery_Detail.Fees_Percent, 0)) as Subrogation_Fee_Percent,
    max(NVL(Recovery.Amount, 0)) as Recovery_Amount, /* SWL 04/01/04 52653 */
    Sum(NVL(Recovery_detail.Fees, 0) + NVL(Recovery_Detail.Admin, 0)) as Total_Fee,
    Sum(NVL(Recovery_Detail.Fees_Taxes, 0) +
    NVL(Recovery_Detail.Admin_Taxes, 0)) as Total_Tax,
    Sum(NVL(Recovery_Detail.Admin_Taxes, 0)) as Administrative_tax,
    Sum(NVL(Recovery_Detail.Admin, 0)) as Total_Admin_Fee,
    sum(recovery.retained_by_client) as Non_cash_fee, --fml 110276
    sum(recovery.allocation_check_amount) as cash --fml 110276
    From Settlement, Recovery, Recovery_Detail
    Where Recovery.settlement_id = v_settlement_id
    And recovery.recovery_id = v_recovery_id
    And Settlement.Settlement_id = Recovery.Settlement_id
    And Recovery.Recovery_id = Recovery_detail.Recovery_id(+)
    and to_date(Recovery.Recovery_Date, 'DD-MON-RR') between
    TO_DATE(v_lowdate, 'DD-MON-RR') and
    TO_DATE(v_highdate, 'DD-MON-RR') /*SWL 12/03/04 */
    -- Group by Recovery_Detail.Fees_Percent; /* SWL 04/01/04 52653 */
    Group by Recovery_Detail.recovery_id;
    v_cash_recovery recovery_activity.cash_recovery%type;
    CURSOR Recovery_Totals_Positive_Nc IS
    -- Select Sum(Recovery.Amount) as Total_NonCash_Positive, /* SWL 04/01/04 52653 */
    Select max(Recovery.Amount) as Total_NonCash_Positive,
    Sum(NVL(Recovery_Detail.Fees_Taxes, 0) +
    NVL(Recovery_Detail.Admin_Taxes, 0)) as Total_NonCash_Tax_Positive
    From Settlement, Recovery, Recovery_detail
    Where Recovery.settlement_id = v_settlement_id
    And Settlement.Settlement_id = Recovery.Settlement_id
    and recovery.recovery_id = v_recovery_id /* SWL 07/01/04 59016 */
    And Recovery.Amount >= 0
    And Recovery.Recovery_id = Recovery_detail.Recovery_id(+)
    And Recovery.Recovery_Transaction_Internal in
    ('05', '50', '52', '51')
    -- Group by Recovery_Detail.Fees_Percent; /* SWL 04/01/04 52653 */
    Group by Recovery_Detail.recovery_id;
    CURSOR Recovery_Totals_Negative_Nc IS
    -- Select Sum(Recovery.Amount) as Total_NonCash_Negative, /* SWL 04/01/04 52653 */
    Select max(Recovery.Amount) as Total_NonCash_Negative,
    Sum(NVL(Recovery_Detail.Fees_Taxes, 0) +
    NVL(Recovery_Detail.Admin_Taxes, 0)) as Total_NonCash_Tax_Negative
    From Settlement, Recovery, Recovery_Detail
    Where Recovery.settlement_id = v_settlement_id
    And Settlement.Settlement_id = Recovery.Settlement_id
    and recovery.recovery_id = v_recovery_id /* SWL 07/01/04 59016 */
    And Recovery.Amount < 0
    And Recovery.Recovery_id = Recovery_detail.Recovery_id(+)
    And Recovery.Recovery_Transaction_Internal in
    ('05', '50', '52', '51')
    Group by Recovery_Detail.recovery_id;
    -- Group by Recovery_Detail.Fees_Percent; /* SWL 04/01/04 52653 */
    /* SWL 11/10/03 # 52743 */
    CURSOR Event_Client_Unit IS
    Select e.Client_Field_Data as Unit
    From Event_Client_Field e, recovery r
    Where r.Event_ID = e.Event_ID
    AND r.Recovery_ID = V_Recovery_ID
    AND e.Client_Field_Name = 'UNIT';
    CURSOR Bill_totals IS
    Select mv_billdetail_case_sum.sum_paid as TOTAL_MEDICAL
    From mv_billdetail_case_sum
    where mv_billdetail_case_sum.event_id = V_Event_ID;
    CURSOR NonCash_Fee IS
    Select NVL(Sum(Recovery.Amount), 0) as Total_NonCash_Fee
    From Settlement, Recovery
    Where Recovery.Recovery_ID = V_Recovery_ID
    And Settlement.Settlement_id = Recovery.Settlement_id
    And Recovery.
    Recovery_Transaction_Internal in ('05', '50', '52', '51');
    /* SWL 04/01/04 52653 */
    CURSOR Recovery_Totals IS
    Select round(avg(NVL(Recovery_Detail.Fees_Percent, 0) +
    NVL(Recovery_Detail.Admin_Percent, 0)),
    2) as Total_Fee_Percent,
    round(avg(NVL(Recovery_Detail.Fees_Percent, 0)), 2) as Subrogation_Fee_Percent,
    max(NVL(Recovery.Amount, 0)) as Recovery_Amount,
    Sum(NVL(Recovery_detail.Fees, 0) + NVL(Recovery_Detail.Admin, 0)) as Total_Fee,
    Sum(NVL(Recovery_Detail.Fees_Taxes, 0) +
    NVL(Recovery_Detail.Admin_Taxes, 0)) as Total_Tax,
    Sum(NVL(Recovery_Detail.Admin_Taxes, 0)) as Administrative_tax,
    Sum(NVL(Recovery_Detail.Admin, 0)) as Total_Admin_Fee
    From Settlement, Recovery, Recovery_Detail
    Where Recovery.Recovery_ID = V_Recovery_ID
    And Settlement.Settlement_id = Recovery.Settlement_id
    And Recovery.Recovery_id = Recovery_detail.Recovery_id(+)
    Group by Recovery_Detail.recovery_id;
    CURSOR Recovery_Totals_Positive IS
    /* Select Sum(Recovery.Amount) as Total_NonCash_Positive,
    Sum(NVL(Recovery_Detail.Fees_Taxes,0)+ NVL(Recovery_Detail.Admin_Taxes,0)) as Total_NonCash_Tax_Positive
    */ /* SWL 04/01/04 52653 */
    Select max(Recovery.Amount) as Total_NonCash_Positive,
    Sum(NVL(Recovery_Detail.Fees_Taxes, 0) +
    NVL(Recovery_Detail.Admin_Taxes, 0)) as Total_NonCash_Tax_Positive
    From Settlement, Recovery, Recovery_detail
    Where Recovery.Recovery_ID = V_Recovery_ID
    And Settlement.Settlement_id = Recovery.Settlement_id
    And Recovery.Amount >= 0
    And Recovery.Recovery_id = Recovery_detail.Recovery_id(+)
    And Recovery.Recovery_Transaction_Internal in ('04', '17', '15') /*SWL 10/05/04 #63919*/--*009* added 15
    Group by Recovery_Detail.recovery_id;
    -- Group by Recovery_Detail.Fees_Percent; /* SWL 04/01/04 52653 */
    CURSOR Recovery_NonFEE_Positive IS
    Select Sum(NVL(Recovery_Detail.Fees, 0) + NVL(Recovery_Detail.Admin, 0)) as Total_NonCash_Fee_Positive
    From Settlement, Recovery, Recovery_detail
    Where Recovery.Recovery_ID = V_Recovery_ID
    And Settlement.Settlement_id = Recovery.Settlement_id
    And Recovery.Amount >= 0
    And Recovery.Recovery_id = Recovery_detail.Recovery_id(+)
    And Recovery.Recovery_Transaction_Internal in
    ('05', '50', '52', '51')
    Group by Recovery_Detail.recovery_id;
    -- Group by Recovery_Detail.Fees_Percent; /* SWL 04/01/04 52653 */
    CURSOR Recovery_Totals_Negative IS
    /* Select Sum(Recovery.Amount) as Total_NonCash_Negative,*/ /* SWL 04/01/04 52653 */
    Select max(Recovery.Amount) as Total_NonCash_Negative,
    Sum(NVL(Recovery_Detail.Fees_Taxes, 0) +
    NVL(Recovery_Detail.Admin_Taxes, 0)) as Total_NonCash_Tax_Negative
    From Settlement, Recovery, Recovery_Detail
    Where Recovery.Recovery_ID = V_Recovery_ID
    And Settlement.Settlement_id = Recovery.Settlement_id
    And Recovery.Amount < 0
    And Recovery.Recovery_id = Recovery_detail.Recovery_id(+)
    And Recovery.Recovery_Transaction_Internal in ('04', '17', '15') /*SWL 10/05/04 #63919*/--*009* added 15
    Group by Recovery_Detail.recovery_id;
    -- Group by Recovery_Detail.Fees_Percent; /* SWL 04/01/04 52653 */
    CURSOR Recovery_NonFEE_Negative IS
    Select Sum(NVL(Recovery_Detail.Fees, 0) + NVL(Recovery_Detail.Admin, 0)) as Total_NonCash_Fee_Negative
    From Settlement, Recovery, Recovery_Detail
    Where Recovery.Recovery_ID = V_Recovery_ID
    And Settlement.Settlement_id = Recovery.Settlement_id
    And Recovery.Amount < 0
    And Recovery.Recovery_id = Recovery_detail.Recovery_id(+)
    And Recovery.Recovery_Transaction_Internal in
    ('05', '50', '52', '51')
    Group by Recovery_Detail.recovery_id;
    -- Group by Recovery_Detail.Fees_Percent; /* SWL 04/01/04 52653 */
    --This is a generic cursor which will be used to control the number of rows inserted into the recovery_activity table
    --There has to be 1 row inserted into the recovery_activity table for each detail record in the recovery_detail table.
    --However, if no recovery_detail record exists there will be only 1 insert into the recovery_activity table.
    CURSOR Control_Detail_Loop
    IS
    Select 1
    FROM Recovery,
    Recovery_Detail
    Where Recovery.Recovery_ID = Recovery_Detail.Recovery_ID(+)
    And Recovery.Recovery_ID = V_Recovery_ID;
    /* SWL 04/01/04 Commented since the only time there were more entries in rd for a recovery is when there is a split fees */
    /* accounting does not want this to be displayed in detail. They need this aggregated as a single fee entry so the recovery */
    /* activity table will now have a single entry corresponding to each recovery in the recovery table. (#52653) */
    CURSOR Control_Detail_Loop IS
    Select 1 FROM Recovery where Recovery.Recovery_ID = V_Recovery_ID;
    /* DJ 10/25/04 # 64633 start*/
    CURSOR Event_Client_Market IS
    Select e.Client_Field_Data as Market
    From Event_Client_Field e, recovery r
    Where r.Event_ID = e.Event_ID
    AND r.Recovery_ID = V_Recovery_ID
    AND e.Client_Field_Name = 'MARKET';
    /* DJ 10/25/04 # 64633 end*/
    v_cur_day integer := 0;
    -----dj
    v_vendor_fee_wh number;
    v_total_vendor_fee_wh number;
    v_rec_itc recovery_activity.recovery_transaction_internal%type;
    --v_settlement_id settlement.settlement_id%type;
    --*004* start
    function unbundled_fee(pevent_id event.event_id%type,
    plowdate date,
    phighdate date) return number is
    -- function variables
    v_fee number(18, 2) := 0;
    v_month_revenue unbundled_recoveries.monthly_revenue%type := 0;
    v_cum_revenue unbundled_recoveries.cum_revenue%type := 0;
    v_contract_fee_per unbundled_recoveries.contractual_fee_per%type := 0;
    v_prev_cum_revenue unbundled_recoveries.cum_revenue%type := 0;
    v_cum_ub_rec unbundled_recoveries.cum_ub_recoveries%type := 0;
    v_cum_inv_paid unbundled_recoveries.cum_inv_paid%type := 0;
    v_month_rec unbundled_recoveries.monthly_recoveries%type := 0;
    v_cum_rec unbundled_recoveries.cum_recoveries%type := 0;
    v_event_id event.event_id%type;
    begin
    --v_month_rec and v_cum_inv_paid
    begin
    select event_id,
    (select sum(r.amount)
    from recovery r
    where r.event_id = e.event_id
    and trunc(r.recovery_date) between plowdate and phighdate) as monthly_recoveries,
    -- *006* added cum_rec
    (select nvl(sum(r.amount), 0)
    from recovery r
    where r.event_id = e.event_id
    and trunc(r.recovery_date) <= trunc(phighdate)) as cum_recoveries,
    (select sum(decode(nvl(ex.client_invoice_closed, 'N'),
    'N',
    ex.paid_amount,
    ex.client_invoice_received))
    from expense ex
    where ex.event_id = e.event_id
    and upper(ex.status) = 'PAID'
    and trunc(ex.check_date) <= phighdate
    and trim(ex.orig_client_invoice_date) is not null
    and nvl(ex.client_invoice_dispute, 'Y') = 'N') as cum_invoiced_paid
    into v_event_id, v_month_rec, v_cum_rec, v_cum_inv_paid
    from event e
    where e.event_id = pevent_id;
    exception
    when no_data_found then
    v_event_id := 0;
    v_month_rec := 0;
    v_cum_rec := 0;
    v_cum_inv_paid := 0;
    when others then
    v_event_id := 0;
    v_month_rec := 0;
    v_cum_rec := 0;
    v_cum_inv_paid := 0;
    end;
    -- *007* start
    -- if event previously written to table, get values from table
    begin
    select nvl(ub.cum_revenue, 0)
    into v_prev_cum_revenue
    from unbundled_recoveries ub
    where ub.event_id = pevent_id
    and ub.month_id =
    (select max(a.month_id)
    from unbundled_recoveries a
    where a.event_id = pevent_id
    and a.month_id < to_char(v_lowdate, 'YYYYMM'));
    exception
    when no_data_found then
    v_prev_cum_revenue := 0;
    when others then
    v_prev_cum_revenue := 0;
    end;
    -- *007* end
    --v_contract_fee_per
    begin
    select nvl(max(rd.fees_percent), 0)
    into v_contract_fee_per
    from recovery_detail rd
    where rd.recovery_id in
    (select r.recovery_id
    from recovery r,
    (select a.event_id, max(amount) as amount
    from recovery a
    where a.event_id = pevent_id
    and trunc(a.recovery_date) between plowdate and
    phighdate
    group by a.event_id) max_r
    where r.event_id = max_r.event_id
    and trunc(r.recovery_date) between plowdate and phighdate
    and r.amount = max_r.amount);
    exception
    when no_data_found then
    v_contract_fee_per := 0;
    when others then
    v_contract_fee_per := 0;
    end;
    v_cum_ub_rec := nvl(v_cum_rec, 0) - nvl(v_cum_inv_paid, 0);
    if ((nvl(v_cum_ub_rec, 0) > 0) and (nvl(v_month_rec, 0) <> 0)) then
    -- latest cumulative unbundled recoveries > 0
    v_cum_revenue := round(((v_contract_fee_per / 100) * v_cum_ub_rec),
    2);
    v_month_revenue := v_cum_revenue - v_prev_cum_revenue;
    end if;
    v_fee := v_month_revenue;
    return v_fee;
    exception
    when others then
    raise_application_error(-20106,
    substr('populate_recovery_activity.undebundled_fee: ' ||
    Sqlcode || Sqlerrm,
    1,
    500));
    return v_fee;
    end;

  • How do you reach an Adobe salesperson on the phone. Before I turn this company into our States Attornye I would like to talk with them about my cancellation of a product.

    How do I reach an Adobe salesperson on the phone? Before I turn this company in to my States Attorney for the way they handle cancellations and make customers go round and round.

    Sorry to hear it didn't go well.
    Adobe Creative Cloud, desktop, and consumer products:
    800-585-0774
    Monday–Friday
    5am–7pm (Pacific Time)
    If you are put on hold and you are given a callback option, take it.
    It's not that they don't want to talk to you, but even the two people ahead of you can take up an hour.
    Gene
    Disclaimer: I am a volunteer, and MVP that does get some perks for helping out in the fforums, but I am not a employee of Adobe.

  • I need help getting this video into itunes and on my ipod.

    i don't know if this is possible...
    the band the films have a new music video "black shoes" on their website. www.the-films.com i got it on my computer and it plays as a movie in quicktime, but i can't figure out how to get it into itunes and on my ipod, if that's possible. i tried to open it in imovie and i couldn't get that to work either. any help would be awesome. thanks.

    To get it into iTunes go to file-->add to library and find the file.
    Try opening quicktime and open the file. Does it play there? It has to be able to play in QT otherwise iTunes will not accept it.
    btabz

  • I have an ASUS p550C with pinch zoom on the track pad that is driving me nuts. I need to turn this off!

    pinch zoom needs to go away on this laptop running windows 7

    You can set involved <b>browser.gesture</b> prefs to an empty string on the <b>about:config</b> page.
    You can open the <b>about:config</b> page via the location/address bar.
    You can accept the warning and click "I'll be careful" to continue.
    *http://kb.mozillazine.org/about:config

  • How can I turn this output into a variable

    I have a script to query all the servers in AD
    Import-Module active*
    $rtn = $null
    Get-ADComputer -Filter {operatingsystem -like "*server*"} |
    ForEach-Object {
    $rtn = Test-Connection -CN $_.dnshostname -Count 1 -BufferSize 16 -Quiet
    IF($rtn -match 'True') {write-host -ForegroundColor green $_.dnshostname}
    I want to make the output a variable
    Easy way would be:
    $Servers = Get-ADComputer -Filter {operatingsystem -like "*server*"}
    Problem is this would waist time waiting for queries against disabled/powered off machines to error out
    I don't know how to use if statements in variables

    Hi,
    You can do something like this:
    $aliveServers = @()
    Get-ADComputer -Filter "OperatingSystem -like '*Server*'" | ForEach {
    If (Test-Connection -ComputerName $_.Name -Count 1 -Quiet) {
    $aliveServers += $_
    $aliveServers | Sort Name
    Don't retire TechNet! -
    (Don't give up yet - 12,950+ strong and growing)

  • HT2240 I am trying to export my Avid Media Composer trailer to Quick Time. It is not letting me do so. I have a PC with Windows 7 Pro on it. I am needing to turn the trailer into a QT movie so that my instructor can grade it.

    I could use some help is trying to convert my Avid Media Composer Trailer into a QT movie. Everytime I try I get a error message and Avid stops working and the trailer is never exported to QT.

    I would suggest you contact Avid for advice.

  • Turn Windows Phone into a video streaming server (not client)?

    I want to stream video from a Windows Phone 8/8.1 device but I'm not sure where to start.  I have done extensive web searching for C# examples or libraries to do this but everything I have found so far covers using the phone as a
    client, not as a source.
    I'm guessing I need to turn the phone into an RTSP server? If not, what is the correct technique or starting point for doing this?  Main concerns are that the streaming be smooth and with minimal lag, since the Windows Phone (camera) is mounted on a robot
    for remote navigation.  Too much lag or video performance problems and navigation will be impossible.  Any libraries or samples that show how to do this are greatly appreciated.
    -- roschler

    Hi Roschler,
    Per my understanding, it is not support in public API. If you need this feature, you can vote it on UserVoice.
    https://wpdev.uservoice.com/forums/110705-dev-platform.
    If you are OEM developer, you can use your own channel to check if there is such API.
    Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to turn a silhouette into an outline?

    I need to create a line drawing of the outline of a chair. I tried following the various Illustrator tutorials to take the image of a chair and create a silhouette. However, I can't figure out how to take this silhouette and get just the outline of it. The Illustrator Image Trace tool doesn't seem to have an option to just save the outline.
    Is there an easy way in Illustrator or Photoshop to turn this silhouette into an outline image that I can save as a file? I will print the outline in a very light opacity so that the lines are barely visible for hand rendering. I don't want to use the pen tool to outline the silhouette because my hand is too shaky to do a good job.
    THank you for any advice...

    Thank you Monika and Steve for suggesting to ungroup and then use the direct selection to edit it, and to change the fill to zero and the stroke to a very thin line.
    It turned out that the outline was very wavy/crooked, since image trace outlined the pixels somewhat haphazardly. So the final solution was complicated because I had to learn how to use direct select and edit anchor points to straighten out the lines.
    I guess it would have been easier to use a light box and just trace the image by hand. oh well. I learned alot about Illustrator.
    Thank you again for your helpfulness!

  • Turning ipod touch into a hotspot

    I have a ipod touch 5th generation.  Can I turn this device into a hotspot where other devices can connect to the internet through my ipod touch?

    No, this is only a feature of the iPhone and cellular iPad, because they can connect to cellular networks, whereas other devices may not be able to. However, they can connect to Wi-Fi just as easily as your iPod touch can so there is no need for a hotspot on the iPod.

  • How to split this string into 4 sections to a max 35 characters

    Hello,
    Does anyone have an idea how I can acheive this please.
    I have this string
    Expense_Inv_8- ExpenseInv_7- Exp001- Expense_Inv_6- Expense_Inv_5- Expense_Inv_4- Expense_Inv_3- Expense_Inv_2- Expense_inv1
    and I need to display them in sections seperated by ';' as explained below
    Section 1 Section 2 Section 3 Section 4
    Expense_Inv_8- ExpenseInv_7- Exp001;Expense_Inv_6- Expense_Inv_5;Expense_Inv_4- Expense_Inv_3;Expense_Inv_2;
    need to split this string into 4 sections seperated by ';' and each section should be of no more than 35 characters, if null should end ;;;
    Section 1, 35 Character ended by;
    Section 2, broken off after Expense_Inv_5 because Expense_Inv_4 will take it over 35 chracters)
    Section 3, should only take Expense_Inv_4- Expense_Inv_3, because adding Expense_Inv_2 will take it over 35
    characters, each record in the string is seperated by '-'
    Section 4, dispays the reminder of the string
    regards
    Ade

    Hi,
    Welcome to the forum!
    Whenever you ask a question, it helps if you post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) and the results you want from that data.
    I think I understand the problemk well enough to attempt a solution, but if the query below isn't right, please post that information.
    WITH     cntr     AS
         SELECT     LEVEL     AS n
         FROM     dual
         CONNECT BY     LEVEL     <= ( SELECT  MAX (LENGTH (txt))
                             FROM    table_x
    ,     got_best_path     AS
         SELECT     id
         ,     txt
         ,     MAX ( SYS_CONNECT_BY_PATH ( TO_CHAR (c.n, '99')
                      ) AS best_path
         FROM     cntr     c
         JOIN     table_x     x     ON     c.n <= LENGTH (x.txt)
         START WITH     c.n     = 1
         CONNECT BY     c.n - PRIOR c.n     BETWEEN  1
                                 AND      :section_length
              AND     x.id          = PRIOR     x.id
              AND     SUBSTR ( x.txt
                                 , c.n
                                 , 1
                                 )     = '-'
         AND     LEVEL          <= :section_cnt
         GROUP BY  id
         ,            txt
    ,     got_pos     AS
         SELECT     id
         ,     REPLACE ( txt
                   ) || ';'                         AS txt
         ,     best_path
         ,     TO_NUMBER (REGEXP_SUBSTR (best_path, '[0-9]+', 1, 2))     AS pos_2
         ,     TO_NUMBER (REGEXP_SUBSTR (best_path, '[0-9]+', 1, 3))     AS pos_3
         ,     TO_NUMBER (REGEXP_SUBSTR (best_path, '[0-9]+', 1, 4))     AS pos_4
         FROM     got_best_path
    SELECT  id
    ,     SUBSTR (txt,     1    , NVL ( pos_2         , :section_length))     AS section_1
    ,     SUBSTR (txt, pos_2 + 1, NVL ((pos_3 - pos_2), :section_length))     AS section_2
    ,     SUBSTR (txt, pos_3 + 1, NVL ((pos_4 - pos_3), :section_length))     AS section_3
    ,     SUBSTR (txt, pos_4 + 1,                        :section_length )     AS section_4
    FROM     got_pos
    ;As written, this requires SQL*Plus 9 (or higher). You can have multiple versions or SQL*Plus on the same client, if you really need to keep the older version.
    :section_length is the maximum length of each section (35, as you stated the problem).
    :section_cnt is the number of sections. In the query above, this is 4. If you change it, you not only have to change the bind variable, but you have to change the hard-coded SELECT clauses of the main query and the last sub-query (that is, got_pos).
    MODEL or PL/SQL would probably be better ways to solve this problem.

Maybe you are looking for

  • Converted videos do not show up on itunes when others do.

    I have tried 3 different converters to convert music videos and most convert fine. Bu tothers I convert and the file shows that it has converted but when I download fiels to ipod they do not show up in the videos. I have tried Videora PQDVD ipod conv

  • IF_SWF_IFS_WORKITEM_EXIT: How to find out recipient of forwarded Workitem

    Hello everybody, I am developping a workflow application with an external status monitoring, i.e. for each workitem I must write the current status as well as the person or organizational unit who is reponsible for the workitem to an external Z-table

  • Embedding YouTube videos in iWeb 08 -

    Is this possible? Can you point me in the right direction if it can be done on iWeb 1.1.2? Thanks!

  • 802.1x authetication with dynamic Vlan assignment by a radius server

    Hi At school I want to start using 802.1x authentication with dynamic Vlan assignment by a Windows Server 2012R2 Radius server. When a student logs in, I want it to be placed in the "Students" Vlan, when a Administrative employee logs in, I want it t

  • Iphoto '09 os x10.6.x screensaver

    I'm running OS X10.6.8 on an Intel Mini and have iPhoto '09 installed. An attempt to integrate an iPhoto album into Screensaver (Sys. Prefs) fails. I don't see iPhoto displayed, only the default apple offerings. Clicking the "+" to select a folder ha