Newbie Trouble Figuring Out Compile Error in Procedure

I'm inexperienced at PL/SQL programming and I've been reading through the 10gR2 PL/SQL user's guide trying to figure out what's wrong with my procedure but I'm not having any luck. I would appreciate your help.
I wanted a procedure that I could use on small tables (which are not partitioned by date) that I could use to delete rows older than days_old days old. I wanted it to be generic so I didn't want to have to hard code the table name (table_name), table's primary key (primary_key) or the name of the column in table_name that I wanted to match dates against. Here's what I came up with:
CREATE OR REPLACE PROCEDURE delete_old_rows (table_name VARCHAR2, primary_key VARCHAR2, date_col_name VARCHAR2, days_old NUMBER) AS
v_sql VARCHAR2(256);
CURSOR rows_to_delete IS
SELECT primary_key FROM table_name WHERE date_col_name < trunc(SYSDATE) - days_old;
BEGIN
FOR del_rows in rows_to_delete
LOOP
SELECT 'DELETE FROM table_name WHERE date_col_name = del_rows.date_col_name' INTO v_sql FROM dual;
DBMS_OUTPUT.PUT_LINE(v_sql);
-- EXECUTE IMMEDIATE v_sql;
END LOOP;
END;
SHOW ERRORS;
The compiler seems to be okay with my use of primary_key, date_col_name, and days_old as variables but when I start using the table_name variable I get a "SQL Statement Ignored" error on the SELECT in the CURSOR and a "table or view does not exist" error on the same statement.
So, it compiles okay without using the table_name variable but it does no compile okay when I start using it.
And yes, I know the EXECUTE IMMEDIATE is commented out -- I'm still developing it.
Thank you

Currently your cursor is referring to a table called "table_name" with a column called "date_col_name". To build a dynamic cursor using the table_name etc parameter values you are going to need dynamic sql, e.g:
OPEN c_rows_to_delete FOR
    'SELECT primary_key FROM ' || table_name || ' WHERE ' || date_col_name || ' < trunc(SYSDATE)';where c_rows_to_delete is declared as a SYS_REFCURSOR. You can't use a Cursor FOR loop on ref cursors.
Also PL/SQL has a handy assignment operator ":=" so you don't need to SELECT INTO FROM DUAL.
Generally dynamic code is something to be used as a last resort.

Similar Messages

  • My old phone broke and I am having trouble figuring out how to restore my contacts on my "new" phone (LG ENV2 Black)...

    My old phone broke and I am having trouble figuring out how to restore my contacts on my "new" phone (LG ENV2 Black).  Apparently the phone is so old that I am unable to install Backup Assistant on it, which sucks.  I have all my old contacts saved on my computer as a CSV and also another copy on a micro SD as VCF.  I have tried moving the CSV from my computer to my ENV2 via both Bluetooth and USB cable, but had no luck with either of those.  I also tried to pop the micro SD into the ENV2, and although I can load all my old pictures/videos/etc. from the micro SD, I do not seem to be able to restore the contacts from card.  I know there has to be some way to manually transfer these files; the contacts are still on my old phone as well; but I was unable to use the transfer wizard for that because my old phonedoesn't seem to be supported by that (Pantech Jester 2)

    Google a program called bitpim, that might do what you want.  Never used it but it's been talked about on the forums.  Other than that you might have to input them manually.  Mary

  • Having trouble figuring out how to forward text messages.  Can someone tell me how to do that?  Where the forward button.  You used to be able to hit forward and put radio button on all the messages.  The screen looks blank to me.

    In the new iOS7, Having trouble figuring out how to forward text messages.  Can someone tell me how to do that?  Where the forward button.  You used to be able to hit forward and put radio button on all the messages.  The screen looks blank to me.

    In the new iOS7, Having trouble figuring out how to forward text messages.  Can someone tell me how to do that?  Where the forward button.  You used to be able to hit forward and put radio button on all the messages.  The screen looks blank to me.

  • Having trouble figuring out how to save the original photo after I've cropped it - i.e. I want to create a headshot of my husband from a photo of the two of us, but I also want to keep the original. Seems very basic, but can't seem to figure it out. Any h

    Having trouble figuring out how to save the original photo after I've cropped it - i.e. I want to create a headshot of my husband from a photo of the two of us, but I also want to keep the original. Seems very basic, but can't seem to figure it out. Any help would be great!

    Use File >> Save As
    Choose a different file name so as not to overwrite the original and don't save any changes when closing the original.

  • Cant figure out what error in my car wash tunnels

    I made a vi to practice the car wash CLD sample question. And labview says there is missing assignment in every one of my 10 tunnels. But I checked, there is an enum array going into every one of 10 the tunnels. Where did the error come from? 
    I cant figure it out!   My tunnels look exactly like the one in the CLD sample answer attached.
    Solved!
    Go to Solution.
    Attachments:
    Car Wash LV86.zip ‏73 KB
    sunflower car wash 100.zip ‏44 KB

    Hi,
    Just move that Enum tunnel upward which you are indicating in RED arrow. You can find a unwired tunnel.Just delete that. Since it has been overlapped you are not able to see.
    Thats it.All your error will vanish.

  • Can't figure out my errors

    // Rectangle.java                                              
    public class Rectangle
        private double width;
        private double length;
        private double area;
        private double perimeter;
        public void double setWidth(x)     **********
            width = (x > 0.0 && x < 20.0)w ?: 1;
        public void double setLength(y)
            length = (y > 0.0 && y < 20.0)y ?: 1;
        public double getWidth()
        return width;
        public double getLength()
            return length;
        public double cArea()
            area = length * width;
            return area;
        public double cPerimeter()
            perimeter = (2 * length) + (2 * width);
            return perimeter;
    }       ^^^^^^^^^^at ********** I am getting <identifer> expected
    and at ^^^^^^^^^^ I am getting '(' expected
    please help!
    Message was edited by:
    Green_Ops
    Message was edited by:
    Green_Ops
    null

    ok, I have made some changes to the code, which is all I've been doing for the past couple days trying to figure this out.
    I made all the changes that you guys pointed out. But I'm still getting the same errors, in the same places. And what I don't understand, is that I have the same code declaring another method, (setLength), and that one doesn't have the error. ???
    // Rectangle.java                                               Phillip Barrios
    public class Rectangle
        private double width;
        private double length;
        private double area;
        private double perimeter;
        public void double setWidth(double x)
            width = (x > 0.0 && x < 20.0)x ?: 1;
        public void double setLength(double y)
            length = (y > 0.0 && y < 20.0)y ?: 1;
        public double getWidth()
        return width;
        public double getLength()
            return length;
        public double cArea()
            area = length * width;
            return area;
        public double cPerimeter()
            perimeter = (2 * length) + (2 * width);
            return perimeter;
    }

  • Can't figure out this error...

    The assignment is to create a program that uses a class to store information about DVDs and then diplay the information.
    One error is "cannot find symbol, symbol: constructor Dvd(), location: class Dvd, Dvd mydvd = new Dvd();
    The other error is "cannot find symbol, symbol method calculateValue(), location class DvdTest, System.out.println("The value in inventory is $", calculateValue() );
    Here's my code:
    {code// EmployeeInfo class created by Michelle Groves
    // Last edited April12 09
    public class DvdTest
       public static void main(String args [])
    Dvd mydvd = new Dvd();
    Dvd[] prodArray = new Dvd[2]; // creat an array
    prodArray[0] = new Dvd( 231562, 7.49, 2, "Cars" );
    prodArray[1] = new Dvd( 231562, 7.49, 2, "Toy Story" );
    // Displays first element's info
    System.out.println("The stock number is " + prodArray[0].getstockedDvds());
    System.out.println("Priced at " + prodArray[0].getdvdPrice());
    System.out.println("Inventory contains " + prodArray[0].getstockedDvds());
    System.out.println("The title is " + prodArray[0].getdvdName());
    // Displays second element's info
    System.out.println("The stock number is " + prodArray[1].getstockedDvds());
    System.out.println("Priced at " + prodArray[1].getdvdPrice());
    System.out.println("Inventory contains " + prodArray[1].getstockedDvds());
    System.out.println("The title is " + prodArray[1].getdvdName());
    System.out.println("The value in inventory is $", calculateValue() );
    } //end main
    } // end class
    class Dvd
    private int dvdNumber; // DVD Product Number
    private double dvdPrice; // price of DVD
    private double stockedDvds; // number of units in stock
    private String dvdName; // name of DVD
    public Dvd( int dvdNumber, double dvdPrice, double stockedDvds,
    String dvdName ) // constructor for dvd
    dvdNumber = 0;
    dvdPrice = 0.0;
    stockedDvds = 0.0;
    dvdName = "";
    } // end constructor
    // method to set DVD number
    public void setdvdNumber( int dvdNumber )
    dvdNumber = dvdNumber; // store DVD number
    } // end method setdvdNumber
    // method to retrieve DVD number
    public double getdvdNumber()
    return dvdNumber;
    } // end method getdvdNumber
    // method to set DVD price
    public void setdvdPrice( double dvdPrice )
    dvdPrice = dvdPrice;
    } // end method setdvdPrice
    // method to retrieve DVD price
    public double getdvdPrice()
    return dvdPrice;
    } // end method getdvdPrice
    // method to set stocked number of DVDs
    public void setstockedDvds( double stockedDvds )
    stockedDvds = stockedDvds;
    } // end method setstockedDvds
    // method to retrieve stocked number of DVDs
    public double getstockedDvds()
    return stockedDvds;
    } // end method getstockedDvds
    // method to set DVD Name
    public void setdvdName( String dvdName )
    dvdName = dvdName;
    } // end method setdvdName
    // method to retrieve DVD name
    public String getdvdName()
    return dvdName;
    } // end method getstockedDvds
    // method to calculate pay for week
    public double calculateValue()
    return dvdPrice * stockedDvds;
    } // end method total
    } // end class

    Here's my code a little more readable:
    // EmployeeInfo class created by Michelle Groves
    // Last edited April12 09
    public class DvdTest
    public static void main(String args [])
    Dvd mydvd = new Dvd();
    Dvd[] prodArray = new Dvd[2]; // creat an array
    prodArray[0] = new Dvd( 231562, 7.49, 2, "Cars" );
    prodArray[1] = new Dvd( 231562, 7.49, 2, "Toy Story" );
    // Displays first element's info
    System.out.println("The stock number is " + prodArray[0].getstockedDvds());
    System.out.println("Priced at " + prodArray[0].getdvdPrice());
    System.out.println("Inventory contains " + prodArray[0].getstockedDvds());
    System.out.println("The title is " + prodArray[0].getdvdName());
    // Displays second element's info
    System.out.println("The stock number is " + prodArray[1].getstockedDvds());
    System.out.println("Priced at " + prodArray[1].getdvdPrice());
    System.out.println("Inventory contains " + prodArray[1].getstockedDvds());
    System.out.println("The title is " + prodArray[1].getdvdName());
    System.out.println("The value in inventory is $", calculateValue() );
    } //end main
    } // end class
    class Dvd
    private int dvdNumber; // DVD Product Number
    private double dvdPrice; // price of DVD
    private double stockedDvds; // number of units in stock
    private String dvdName; // name of DVD
    public Dvd( int dvdNumber, double dvdPrice, double stockedDvds,
    String dvdName ) // constructor for dvd
    dvdNumber = 0;
    dvdPrice = 0.0;
    stockedDvds = 0.0;
    dvdName = "";
    } // end constructor
    // method to set DVD number
    public void setdvdNumber( int dvdNumber )
    dvdNumber = dvdNumber; // store DVD number
    } // end method setdvdNumber
    // method to retrieve DVD number
    public double getdvdNumber()
    return dvdNumber;
    } // end method getdvdNumber
    // method to set DVD price
    public void setdvdPrice( double dvdPrice )
    dvdPrice = dvdPrice;
    } // end method setdvdPrice
    // method to retrieve DVD price
    public double getdvdPrice()
    return dvdPrice;
    } // end method getdvdPrice
    // method to set stocked number of DVDs
    public void setstockedDvds( double stockedDvds )
    stockedDvds = stockedDvds;
    } // end method setstockedDvds
    // method to retrieve stocked number of DVDs
    public double getstockedDvds()
    return stockedDvds;
    } // end method getstockedDvds
    // method to set DVD Name
    public void setdvdName( String dvdName )
    dvdName = dvdName;
    } // end method setdvdName
    // method to retrieve DVD name
    public String getdvdName()
    return dvdName;
    } // end method getstockedDvds
    // method to calculate pay for week
    public double calculateValue()
    return dvdPrice * stockedDvds;
    } // end method total
    } // end class

  • Cant figure out the error

    public void datfileout()
    try
    BufferedWriter outstream = new BufferedWriter(new FileWriter("character.txt"));//declares variable that reads in from file
    for(int x=0;x<holdinfo.size();x++)
    outstream.write((String)holdinfo.get(x));//writes names to file
    outstream.newLine();//starts a new line
    outstream.close(); //closes file
    catch (Exception e)
    System.err.println("Caught exception " + e.toString());//checks for an error
    this is what i have attempted to put in an applet but it seems just to freeze every time i go in this method what should i do?

    Your code works for me :
    * Applet_Test.java
    import java.io.*;
    import java.util.*;
    import javax.swing.*;
    public class Applet_Test extends JApplet {
        public void init() {
            datfileout();
            System.out.println("Applet_Test is OK");
        ArrayList holdinfo = new ArrayList();{
            holdinfo.add("Test 1");
            holdinfo.add("Test 2");
            holdinfo.add("Test 3");
        public void datfileout() {
            try {
                BufferedWriter outstream = new BufferedWriter(new FileWriter("character.txt"));
                for(int x=0;x<holdinfo.size();x++) {
                    outstream.write((String)holdinfo.get(x));//writes names to file
                    outstream.newLine();//starts a new line
                outstream.close(); //closes file
            } catch (Exception e) {
                System.err.println("Caught exception " + e.toString());//checks for an error
    }

  • Please figure out the error

    hi all,
    heres a problem I can't it out can any one help me.
    Its not printing the WieldValue5
    the String here it should ignore "SXGI", "F"'s, and "E" and it should print ControlID1
    WieldType1
    WieldValue1
    ControlID5
    WieldType5
    WieldValue5
    its not printing "WieldValue5"
    public class Example {
         public static void main(String[] args) throws Exception {
              String strReq = "SXGIDFControlID1FWieldType1FWieldValue1F" +
                                   "ControlID2FWieldType2FWieldValue2F" +
                                   "ControlID3FWieldType3FWieldValue3F" +
                                   "ControlID4FWieldType4FWieldValue4F" +
                                   "ControlID5FWieldType5FWieldValue5E";
              int iIndexF = strReq.indexOf("F");
              String strTemp = strReq.substring(iIndexF + 1);
              int iIndexE = -1;
              while(-1 != iIndexF) {
                   iIndexF = strTemp.indexOf("F");
                   if(-1 == iIndexF) {
                        throw new Exception("Error in ControlID");
                        String strControlID = strTemp.substring(0, iIndexF);
                        System.out.println(strControlID);
                   int iIndexFieldType = strTemp.indexOf("F", iIndexF + 1);
                   if(-1 == iIndexFieldType) {
                        throw new Exception("Error in FieldType");
                        String strFieldType = strTemp.substring(iIndexF + 1, iIndexFieldType);
                        System.out.println(strFieldType);
                   int iIndexFieldValue = strTemp.indexOf("F", iIndexFieldType + 1);
                   String strFieldValue;
                   if(-1 == iIndexFieldValue) {
                        throw new Exception("Error in FieldValue");
                   strFieldValue = strTemp.substring(iIndexFieldType + 1, iIndexFieldValue);
                   System.out.println(strFieldValue);
                   iIndexF = iIndexFieldValue;
                   if(-1 == iIndexF) {
                        iIndexE = strTemp.indexOf("E", iIndexFieldType + 1);
                        if(-1 == iIndexE) {
                             throw new Exception("Error in FieldValue");
                        strFieldValue = strTemp.substring(iIndexFieldType + 1, iIndexE);
                        System.out.println(strFieldValue);
                        iIndexFieldType = iIndexE;
                   strTemp = strTemp.substring(iIndexFieldValue + 1);
                   System.out.println(strTemp);
    }null
    null

    Based on the information you've provided, here's a stripped down version:
        String strReq = "SXGIDFControlID1FWieldType1FWieldValue1F" +
                        "ControlID2FWieldType2FWieldValue2F" +
                        "ControlID3FWieldType3FWieldValue3F" +
                        "ControlID4FWieldType4FWieldValue4F" +
                        "ControlID5FWieldType5FWieldValue5E";
        int    beg   = 0, end   = 0;
        while ( true ) {
          beg = strReq.indexOf("F",beg);
          end = strReq.indexOf("F",beg+1);
          if (beg != -1) {
            if ( end == -1) {
              end = strReq.indexOf("E",beg+1);
              if ( end == -1)
                end = strReq.length();
            System.out.println(strReq.substring(beg+1,end));
          else
            break;
          beg = end;
        }

  • Compilation error in procedure

    P_start_date and p_end_date is input to the procedure
    it is giving execution error.
    v_sql := 'SELECT
         as_no ,
         l_no ,
         dtc_no ,
         reg_date ,
         card_no ,
         last_name ,
         no_mail ,
         no_call      
    FROM registration@' ||p_db_link || ' a
    WHERE a.first_name IS NOT NULL
    AND a.datestamp = (SELECT max(b.datestamp) FROM registration@' ||p_db_link || ' b
    WHERE a.card_no = b.card_no)
    AND TO_DATE(a.reg_date,''dd-mon-yy'') BETWEEN ' || p_start_date || ' AND ' || p_end_date ;
    ========= Here is the sql while executing...
    SELECT
    as_no ,
    l_no ,
    dtc_no
    reg_date ,
    card_no ,
    last_name
    first_name ,
    zip_code ,
    start_weight
    goal_weight ,
    mbrship_status ,
    weeks_completed ,
    height
    previous_wt ,
    previous_date ,
    datestamp ,
    notes
    modified_date ,
    old_style_reg_no ,
    lifetime_no
    miss_you_sent ,
    miss_you_datestamp ,
    address ,
    city
    state ,
    phone ,
    phone_type ,
    email
    memo ,
    sex ,
    birth_date
    age_range ,
    no_mail ,
    no_call
    FROM
    registration@link_champ a
    WHERE a.first_name IS NOT NULL
    AND a.datestamp =
    (SELECT max(b.datestamp) FROM registration@link_champ b
    WHERE a.card_no = b.card_no)
    AND TO_DATE(a.reg_date,'dd-mon-yy') BETWEEN
    10-MAR-06 AND 11-MAR-06
    ErrorORA-00904: "MAR": invalid identifier
    ORA-Error in fetching the cursor values
    PL/SQL procedure successfully completed.

    they are date type
    I modifed the query and it is working fine now, but it is still taking lots of time...
    Here is what i changed the procedure....
    I have used the bulk collect here, but still there is no big performance improvement..
    CREATE OR REPLACE PACKAGE BODY pkg_merge_member_info IS
    PROCEDURE p_merge_member_info(p_db_link in VARCHAR2, p_start_date in date, p_end_date in date) IS
    generic_cv sys_refcursor;
    generic_cv2 sys_refcursor;
    generic_cv3 sys_refcursor;
    v_rcw_card_no varchar2(20);
    v_pmi_inactive_date date;
    v_pmi_inactive_reason varchar2(50);
    v_ccw_last_meeting date;
    type     tbl_as_no           is table of      NUMBER(8)     INDEX BY BINARY_INTEGER;
    type     tbl_l_no           is table of      NUMBER(8)     INDEX BY BINARY_INTEGER;
    type     tbl_dtc_no           is table of      NUMBER(8)     INDEX BY BINARY_INTEGER;
    type     tbl_reg_date           is table of      DATE     INDEX BY BINARY_INTEGER;
    type     tbl_card_no           is table of      VARCHAR2(20)     INDEX BY BINARY_INTEGER;
    type     tbl_last_name           is table of      VARCHAR2(32)     INDEX BY BINARY_INTEGER;
    type     tbl_first_name           is table of      VARCHAR2(32)     INDEX BY BINARY_INTEGER;
    type     tbl_zip_code           is table of      CHAR(5)     INDEX BY BINARY_INTEGER;
    type     tbl_start_weight           is table of      NUMBER(8,2)     INDEX BY BINARY_INTEGER;
    type     tbl_goal_weight           is table of      NUMBER(8,2)     INDEX BY BINARY_INTEGER;
    type     tbl_mbrship_status           is table of      VARCHAR2(32)     INDEX BY BINARY_INTEGER;
    type     tbl_weeks_completed           is table of      NUMBER(8)     INDEX BY BINARY_INTEGER;
    type     tbl_height           is table of      NUMBER(8,2)     INDEX BY BINARY_INTEGER;
    type     tbl_previous_wt           is table of      NUMBER(8,2)     INDEX BY BINARY_INTEGER;
    type     tbl_previous_date           is table of      DATE     INDEX BY BINARY_INTEGER;
    type     tbl_datestamp           is table of      DATE     INDEX BY BINARY_INTEGER;
    type     tbl_notes           is table of      VARCHAR2(128)     INDEX BY BINARY_INTEGER;
    type     tbl_modified_date           is table of      DATE     INDEX BY BINARY_INTEGER;
    type     tbl_old_style_reg_no           is table of      VARCHAR2(32)     INDEX BY BINARY_INTEGER;
    type     tbl_lifetime_no           is table of      VARCHAR2(32)     INDEX BY BINARY_INTEGER;
    type     tbl_miss_you_sent           is table of      CHAR(1)     INDEX BY BINARY_INTEGER;
    type     tbl_miss_you_datestamp           is table of      DATE     INDEX BY BINARY_INTEGER;
    type     tbl_address           is table of      VARCHAR2(64)     INDEX BY BINARY_INTEGER;
    type     tbl_city           is table of      VARCHAR2(32)     INDEX BY BINARY_INTEGER;
    type     tbl_state           is table of      CHAR(2)     INDEX BY BINARY_INTEGER;
    type     tbl_phone           is table of      VARCHAR2(16)     INDEX BY BINARY_INTEGER;
    type     tbl_phone_type           is table of      VARCHAR2(4)     INDEX BY BINARY_INTEGER;
    type     tbl_email           is table of      VARCHAR2(64)     INDEX BY BINARY_INTEGER;
    type     tbl_memo           is table of      VARCHAR2(192)     INDEX BY BINARY_INTEGER;
    type     tbl_sex           is table of      CHAR(1)     INDEX BY BINARY_INTEGER;
    type     tbl_birth_date           is table of      DATE     INDEX BY BINARY_INTEGER;
    type     tbl_age_range           is table of      VARCHAR2(8)     INDEX BY BINARY_INTEGER;
    type     tbl_no_mail           is table of      CHAR(1)     INDEX BY BINARY_INTEGER;
    type     tbl_no_call           is table of      CHAR(1)      INDEX BY BINARY_INTEGER;
    v_AS_NO tbl_as_no      ;
    v_L_NO tbl_l_no      ;
    v_DTC_NO tbl_dtc_no      ;
    v_REG_DATE tbl_reg_date      ;
    v_CARD_NO tbl_card_no      ;
    v_LAST_NAME tbl_last_name      ;
    v_FIRST_NAME tbl_first_name      ;
    v_ZIP_CODE tbl_zip_code ;      
    v_START_WEIGHT tbl_start_weight ;      
    v_GOAL_WEIGHT tbl_goal_weight ;     
    v_MBRSHIP_STATUS tbl_mbrship_status ;     
    v_WEEKS_COMPLETED tbl_weeks_completed ;     
    v_HEIGHT tbl_height ;     
    v_PREVIOUS_WT tbl_previous_wt ;     
    v_PREVIOUS_DATE tbl_previous_date ;     
    v_DATESTAMP tbl_datestamp ;     
    v_NOTES tbl_notes ;     
    v_MODIFIED_DATE tbl_modified_date ;     
    v_OLD_STYLE_REG_NO tbl_old_style_reg_no ;     
    v_LIFETIME_NO tbl_lifetime_no ;     
    v_MISS_YOU_SENT tbl_miss_you_sent ;     
    v_MISS_YOU_DATESTAMP tbl_miss_you_datestamp ;     
    v_ADDRESS tbl_address ;     
    v_CITY tbl_city ;     
    v_STATE tbl_state ;     
    v_PHONE tbl_phone ;     
    v_PHONE_TYPE tbl_phone_type ;     
    v_EMAIL tbl_email ;     
    v_MEMO tbl_memo ;     
    v_SEX tbl_sex ;     
    v_BIRTH_DATE tbl_birth_date ;     
    v_AGE_RANGE tbl_age_range ;     
    v_NO_MAIL tbl_no_mail ;     
    v_NO_CALL tbl_no_call ;     
    o_error_Text VARCHAR2(1000);
    v_sql_err VARCHAR2(4000);
    tname VARCHAR2(32);
    o_status VARCHAR2(10);
    --v_schema_name                              VARCHAR2(100):=p_schema_name||'.';
    v_last_upd_by VARCHAR2(20) :='Apollo Data Refresh';
    v_created_by VARCHAR2(20) :='Apollo Data Refresh';
    v_user_check_id NUMBER(10);
    v_hire_date DATE;
    v_fjc_no VARCHAR2(1);
    v_sql VARCHAR2(4000);
    v_emp_check NUMBER(1) := 0;
    v_user_id NUMBER(10);
    v_state_id NUMBER(10);
    v_ejc_date_last_worked      DATE;
    v_member_id NUMBER(10);
    v_MEMBER_TYPE_ID NUMBER(10);
    BEGIN
    v_sql := 'SELECT
         as_no ,
         l_no ,
         dtc_no ,
         reg_date ,
         card_no ,
         last_name ,
         first_name ,
         zip_code ,
         start_weight ,
         goal_weight ,
         mbrship_status ,
         weeks_completed ,
         height ,
         previous_wt ,
         previous_date ,
         datestamp ,
         notes ,
         modified_date ,
         old_style_reg_no ,
         lifetime_no ,
         miss_you_sent ,
         miss_you_datestamp ,
         address ,
         city ,
         state ,
         phone ,
         phone_type ,
         email ,
         memo ,
         sex ,
         birth_date ,
         age_range ,
         no_mail ,
         no_call      
    FROM registration@' ||p_db_link || ' a
    WHERE a.first_name IS NOT NULL
    AND a.datestamp = (SELECT max(b.datestamp) FROM registration@' ||p_db_link || ' b
    WHERE a.card_no = b.card_no)
    AND TO_DATE(a.reg_date,''dd-mon-yy'') BETWEEN ''' || p_start_date || ''' and ''' || p_end_date ||'''' ;
    --AND  TO_DATE(a.reg_date,''dd-mon-yy'') BETWEEN   p_start_date and p_end_date  ' ;
    --USING  p_start_date, p_end_date    ;
    o_Error_Text := 'ORA-Error in fetching the cursor values ';
    tname:= NULL;
    dbms_output.put_line(v_sql);
    execute immediate v_sql bulk collect into
         v_as_no ,
         v_l_no ,
         v_dtc_no ,
         v_reg_date ,
         v_card_no ,
         v_last_name ,      
         v_first_name ,
         v_zip_code ,
         v_start_weight ,
         v_goal_weight ,
         v_mbrship_status ,
         v_weeks_completed ,
         v_height ,
         v_previous_wt ,
         v_previous_date ,
         v_datestamp ,
         v_notes ,
         v_modified_date ,
         v_old_style_reg_no ,
         v_lifetime_no ,
         v_miss_you_sent ,
         v_miss_you_datestamp ,
         v_address ,
         v_city ,
         v_state ,
         v_phone ,
         v_phone_type ,
         v_email ,
         v_memo ,
         v_sex ,
         v_birth_date ,
         v_age_range ,
         v_no_mail ,
         v_no_call ;
    FOR i IN v_card_no.FIRST..v_card_no.LAST
    LOOP
    o_Error_Text := 'ORA-Error in getting member id for the card no';
    tname:= 'members';
         SELECT count(1) INTO v_emp_check
         FROM members
         WHERE champ_code=v_CARD_NO(i);
    IF v_emp_check = 0 THEN
    o_Error_Text := 'ORA-Error in executing sequence seq_user_id';
    tname:= NULL;
    SELECT user_id_seq.nextval INTO v_user_id FROM dual;
    o_Error_Text := 'ORA-Error in INSERTing to users table';
    tname:= 'Users';
         INSERT INTO users
         ( user_id ,
              user_type_id ,
              first_name ,
              last_name ,
              mid_name ,
              gender ,
              date_of_birth ,
              notes ,
              site_id ,
              created_date ,
              created_by ,
              last_upd_date ,
              last_upd_by
         VALUES
         ( v_user_id ,
              2 , -- Member type
              v_first_name(i),
              v_last_name(i) ,
              null , -- mid name
              v_sex(i) , -- gender
              v_birth_date(i) ,
              v_notes(i) ,
              1 , -- site id
              pkg_utilities.fn_sysdate(1) , -- Created Dt
              v_created_by , -- Created by
              pkg_utilities.fn_sysdate(1) , -- Modified Dt
              v_last_upd_by -- Modified by
    end if;
    dbms_output.put_line(i);
    end loop;
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('Error' ||sqlerrm);
    DBMS_OUTPUT.PUT_LINE(o_error_text);
    v_sql_err :=SQLERRM;
    ROLLBACK;
    pkg_champ_message_log.champ_message_log ('pkg_merge_employee_info.p_merge_employee_info', tname, null,'Apollo', v_sql_err,'Error',o_Error_Text,O_STATUS);
    end;
    END PKG_MERGE_member_INFO;
    /

  • Newbie needs help on compiling error

    I'm reading java 2 programming for dummies, but can't get this example working. I get an error on line 4, but when I remove 'public' from in front of 'class', Iexplore tells me I need a public constructor. I also get errors on line 94 and 98 where the compilator says that the java.awt.Component has been deprecated. I have no clue what that means..
    Please help me! I'm stuck...
    Here is my code:
    /*line 0*/
    import java.applet.Applet;
    import java.awt.*;
    public class PixApplet extends Applet{
         public void init() {
              Rectgl r = new Rectgl(10,5,Color.red);
              Square s = new Square(10,Color.blue);
              Circle c = new Circle(20,Color.yellow);
              Square s2 = new Square(40,Color.green);
              add(r);
              add(s);
              add(c);
              add(s2);
              add(new PixLabel(r));
              add(new PixLabel(s));
              add(new PixLabel(c));
              add(new PixLabel(s2));
    /*Rectgl*/
    class Rectgl extends Pix {
         /*Constructor*/
         public Rectgl(int width, int height, Color c) {
              myDimension.width = width;
              myDimension.height = height;
              setColor(c);
         /*Draw shape*/
         public void Paint(Graphics g) {
              g.fillRect(0,0,myDimension.width,myDimension.height);
         /*Return area*/
         public double getArea() {
              return (myDimension.width * myDimension.height);
         /*Return perimeter */
         public double getPerimeter() {
              return (myDimension.width + myDimension.height) * 2;
         /*Return kind of shape*/
         public String getKind() {
              return "Rectangle";
    /*Square*/
    class Square extends Rectgl {
         /*Constructor*/
         public Square(int side,Color c) {
              super(side,side,c);
         /*Return kind of shape*/
         public String getKind() {
              return "Square";
    abstract class Pix extends Canvas {
         Dimension myDimension = new Dimension();
         /*Constructor*/
         public void Pix() {
         /*Set object's forground color*/
         public void setColor(Color c) {
              setForeground(c);
         public void paint(Graphics g) {
         public double getArea() {
              return 0;
         public double getPerimeter() {
              return 0;
         public String getKind() {
              return "unknown shape";
    /*line 93*/
         public Dimension preferredSize() {
              return myDimension;
    /*line 97*/
         public Dimension minimumSize() {
              return myDimension;
    class Circle extends Pix {
         private int myRadius;
         /*Constructor*/
         public Circle(int radius, Color c) {
              myRadius = radius;
              setColor(c);
              myDimension.height = myDimension.width = 2 * radius;
         /*Draw shape*/
         public void paint(Graphics g) {
              g.fillArc(0,0,(2 * myRadius),(2 * myRadius),0,360);
         /*Return area*/
         public double getArea() {
              return (Math.PI * (myRadius * myRadius));
         /*Return perimeter*/
         public double getPerimeter() {
              return 2 * Math.PI * myRadius;
         /*Return kind of shape*/
         public String getKind() {
              return "Circle";
    class PixLabel extends TextArea {
         /*Constructor*/
         public PixLabel(Pix s) {
              super( "I am a " + s.getKind() + "\nMy perimeter is " + Double.toString(s.getPerimeter()) + "\nMy area is " + Double.toString(s.getArea()),3,15,SCROLLBARS_NONE);
    }

    OK. You do not need to worry too much about the deprecated messages. They are only warnings and will not stop the program compiling.
    What is the name of the java file that your code is in. It should be PixApplet.java
    How are you compiling it, something like
    javac *.java or javac PixApplet.java
    What is the error you get when you try to compile

  • Itunes has changed the way it stores files over the years and now i am having trouble figuring out which files are where so I can back them up

    Hi
    I have backed up itunes by copying my itunes file to an external hard drive. I try to keep my large media files (like TV shows) in a separate folder so that I can keep my hard drive on my macbook from filling up.  Problem is, apple has changed the way Itunes is organized and backs up over the years.  Now I am having a hard time keeping straight what is where.  When I go to support, it has different instructions for the various versions of itunes. I  am using version 10 now but it seems like I can't see all my files within the itunes music or media folder.  I want to get everything in one place so that I can easily back up, regardless of which version of itunes I am running at the time.
    I have selected to let itunes organize my files.  It keeps all the files I have purchased in one place apparently, but items I have imported don't seem to always be there.
    How can I best sort this out?

    I have, but if I don't have that particular external hard drive connected when my time machine backup hard drive is connected, then I don't think it is all backed up together.  It is getting too complicated to get out all this equipment every time I want to buy some music. 

  • I am having trouble figuring out how to get a date to show on a report

    Hi,
    I have a query with a structure on both my rows and columns.
    In my columns, I have my key figures and on them are period/year restrictions.  For example, the first column is the current fiscal period/year - 1 period, the next column is the current fiscal period/year - 13 periods (so I can compare this year to last year)
    On my rows, I have a structure that is listing sales where on each line, I am restricting by groups of accounts.
    What I need on my report is a header stating what the time period of the report is for.  That is, the restriction of the current fiscal period/year -1 that is being placed on the first column also needs to be up in the page heading.
    This is going to be hard to explain but here goes.  My columns are reporting key figures constrained by time.
    <page header>
    REPORT: XXXXXX
    REPORTING FOR: Per/Yer  (Which is equal to the date restriction that is on the first KF column, that is curr yr/period - 1 period)
    <report body>
    SALES GROUP /  RPT MONTH  /  LY
    Mens  /  amount (restricted to curr year/period - 1)  /  amount (restricted to curr year/period - 13)
    Womens  /  amount (-1)  /  amount (-13)
    Childrens  /  amount (-1)  /  amount (-13)
    I tired adding it to my row structure but since my KFs are constrained by per/year, I can not drop per/year onto my rows.
    I tried to add a column showing time but BEx wants me to add a key figure (since the columns have key figures in them) so that does not work either.
    How can I get the value of "current period/year - 1 period" to be part of the data (not a label) in the query so that I can put it into a header on my report.
    Thanks for your help!

    Hi,
    Click on Query Property,
    In General tab of Query Property, select New variable at Discreption.
    Give Discription and technical name. Select Processing type Replacement path. select Reference Characteristic year/period. In replacement path tab, Select variiable with-  Variable and Select your variable(which will give you previous fiscal year/ period- already exist or you have to create to get previous fiscal year period) and select Replace with - Label. Assign this variable in your query discreption

  • Need help with my batch code, cant seem to figure out the errors.

    Hello all, so as part of my job I have to check a list of shared drives on random servers throughout the world to make sure they are not open. I am trying to make a batch file to check them all at once instead of mapping to each one individually. It would
    save a lot of time. So far I got this code with the help of a member of
    reddit:
    @echo off
    :: Ensure Extensions are enabled to avoid silent failure
    setlocal EnableExtensions DisableDelayedExpansion
    set "Input-Server-List=H:\Desktop\serverlist.txt"
    set "Open-Share-List=H:\Desktop\open_shares.txt"
    set "Locked-Share-List=H:\Desktop\locked_shares.txt"
    :: Create empty files
    copy nul "%Open-Share-List%" 1>nul
    copy nul "%Locked-Share-List%" 1>nul
    :: Test the shares to see if they're online or not
    for /f "usebackq delims=" %%S in ("%Input-Server-List%") do @(
    pushd "%%~S" 2>nul && (
    popd
    1>> "%Open-Share-List%" echo %%~S
    echo ONLINE -- %%S
    ) || (
    1>> "%Locked-Share-List%" echo %%~S
    echo OFFLINE - %%S
    echo Testing Complete! Results have been logged to File.
    :: Open files in default program (typically notepad.exe)
    explorer "%Open-Share-List%"
    explorer "%Locked-Share-List%"
    :: End of script
    endlocal
    timeout -1 /nobreak
    exit /b
    But there are a few (approx 4) servers that are coming up as online/accessible in the list that are actually closed/appropriately locked down. I have no idea why.. all the rest are working as they should. Any help would be much appreciated. Any questions
    let me know. Once again, I would really really appreciate some help.

    Here's a tester:
    Get-Content .\shareList.txt | ForEach {
    $share = $_
    If (Test-Path -Path $share) {
    $found = $true
    } Else {
    $found = $false
    try {
    $null = Get-ChildItem -Path $share -ErrorAction Stop
    $connect = $true
    } catch {
    $connect = $false
    $props = @{
    Share = $share
    Found = $found
    Connect = $connect
    New-Object PsObject -Property $props
    } | Select Share,Found,Connect |
    Sort Connect,Share |
    Export-Csv .\shareListCheck.csv -NoTypeInformation
    As the others have pointed out though, this won't really give you any solid information.
    Don't retire TechNet! -
    (Don't give up yet - 13,085+ strong and growing)

  • Trying to figure out this error

    I have a Flex website that I created and I'm getting the
    following error when I try to call to my ColdFusion RemoteObjects:
    [RPC Fault faultString="Send failed"
    faultCode="Client.Error.MessageSend"
    faultDetail="Channel.Connect.Failed error
    NetConnection.Call.Failed: HTTP: Failed: url: '
    http://reevespro.com/flex2gateway/'"
    I haven't a clue where or to fix. And I have no idea why it's
    trying to call flex2gateway, the directory doesn't exist. Anyone
    have a clue?
    Thanks

    Hi,
    If you are using the ColdFusion adapter for BlazeDS/LCDS,
    please open remoting-config.xml and see which channel your Remoting
    destination is using. In services-config.xml, you should be able to
    find channel used above configured. You should be modifying the end
    point URL of the channel.
    Hope this helps.

Maybe you are looking for