Insert same data with next holiday date

Hi All,
I have write a pl block where in i need to copy the existing records from the
table A to table A itself with date+1.
Say for eg. there is a situation were daily one record is inserted into table A
and there is a data column init but NO records for sat,sunday and holidays
I need to write a block to insert records for sat,sun and holiday in the table A
which rec? if rec is missing for say for eg date 04/May/2007 then I need to take
records from 03/May/2007 and insert a new records by copying all the rec from previous date with data column in A as 04/May/2007.
like wise there are lac of rec in table A and thousands of missing rec for sat,sun & holiday.
I am trying to do this by taking cursor and finding out the missing rec and insert it.
i have just started can any one of you help in this. by posting the best logic for this
Thanks,
AAK.

Hi1
pls try this --
SQL>
SQL> set serveroutput on
SQL>
SQL>
SQL> set lin 1000
SQL>
SQL> select * from emp_q;
     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO C PHONE
      7777 Avik       CLERK           7839 02-MAR-07       3456        263         30 M 12547896
      6666 prithwi    CLERK           7839 22-JUL-06       1234        248         30 M 14782563
      7639 Roni       CLERK           3434 17-DEC-80      12121                    50 F
      7499 ALLEN      SALESMAN        7469 20-FEB-81       1234        300         30 M
      7521 WARD       SALESMAN        7698 14-FEB-07       1234        500         10 F
      7566 JONES      MANAGER         7469 02-APR-81       1000                    10 F
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1234       1400         53 F
      7698 BLAKE      MANAGER         7839 01-MAY-81       1234                    40 M
      7782 CLARK      MANAGER         7839 09-JUN-81       1234                    20
      6194 Verona     CLERK           7839 30-APR-07       2365        125         30 F 12543698
      6698 Fereda     CLERK           7839 30-APR-07       2365        125         30 M 12543698
     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO C PHONE
      6903 Aliva      CLERK           7839 30-APR-07       2365        125         30 F 12543698
      7411 Naba       CLERK           7839 27-APR-07       1450        452         30   29631478
      7529 Indra      SALESMAN        7839 27-APR-07       5025        250         30 M 28963147
      7698 BLAKE      MANAGER         7839 01-MAY-81       1234                    40 M 23515485
      7782 CLARK      MANAGER         7839 09-JUN-81       1234                    20   23651489
      7788 SCOTT      ANALYST         7566 19-APR-87       1234                    40 F 25483698
      7839 KING       PRESIDENT       7839 17-NOV-81       1234                    40 F 23691436
      7844 TURNER     SALESMAN        7698 08-SEP-81       1234          0         30 F 23459687
      7876 ADAMS      CLERK           7788 23-MAY-87       1234                    10 M 23984297
      7900 BARRY      CLERK           7698 03-DEC-81       1234        500         10 F 25983147
      7902 FORD       ANALYST         7566 03-DEC-81       1234                    40 F 29541236
     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO C PHONE
      7934 MILLER     CLERK           7458 23-JAN-82       1234                    10 F 24893175
23 rows selected.
SQL>
SQL>
SQL> insert into emp_q
  2  select empno,ename,job,mgr,sysdate+1,sal,comm,deptno,code,phone
  3  from emp_q
  4  where empno = 7777;
1 row created.
SQL>
SQL>
SQL> commit;
Commit complete.
SQL>
SQL> select * from emp_q;
     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO C PHONE
      7777 Avik       CLERK           7839 02-MAR-07       3456        263         30 M 12547896
      6666 prithwi    CLERK           7839 22-JUL-06       1234        248         30 M 14782563
      7639 Roni       CLERK           3434 17-DEC-80      12121                    50 F
      7499 ALLEN      SALESMAN        7469 20-FEB-81       1234        300         30 M
      7521 WARD       SALESMAN        7698 14-FEB-07       1234        500         10 F
      7566 JONES      MANAGER         7469 02-APR-81       1000                    10 F
      7654 MARTIN     SALESMAN        7698 28-SEP-81       1234       1400         53 F
      7698 BLAKE      MANAGER         7839 01-MAY-81       1234                    40 M
      7782 CLARK      MANAGER         7839 09-JUN-81       1234                    20
      6194 Verona     CLERK           7839 30-APR-07       2365        125         30 F 12543698
      6698 Fereda     CLERK           7839 30-APR-07       2365        125         30 M 12543698
     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO C PHONE
      6903 Aliva      CLERK           7839 30-APR-07       2365        125         30 F 12543698
      7411 Naba       CLERK           7839 27-APR-07       1450        452         30   29631478
      7529 Indra      SALESMAN        7839 27-APR-07       5025        250         30 M 28963147
      7698 BLAKE      MANAGER         7839 01-MAY-81       1234                    40 M 23515485
      7782 CLARK      MANAGER         7839 09-JUN-81       1234                    20   23651489
      7788 SCOTT      ANALYST         7566 19-APR-87       1234                    40 F 25483698
      7839 KING       PRESIDENT       7839 17-NOV-81       1234                    40 F 23691436
      7844 TURNER     SALESMAN        7698 08-SEP-81       1234          0         30 F 23459687
      7876 ADAMS      CLERK           7788 23-MAY-87       1234                    10 M 23984297
      7900 BARRY      CLERK           7698 03-DEC-81       1234        500         10 F 25983147
      7902 FORD       ANALYST         7566 03-DEC-81       1234                    40 F 29541236
     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO C PHONE
      7934 MILLER     CLERK           7458 23-JAN-82       1234                    10 F 24893175
      7777 Avik       CLERK           7839 04-MAY-07       3456        263         30 M 12547896
24 rows selected.
SQL> Regards.
Satyaki De.

Similar Messages

  • Difference between real Hijri Date with Oracle Hijri date

    Dear ALL,
    I will appreciate if any one please let me the solution for this problem. In my application I show the Date in Hijri using the NLS setting. but the issue that "i face a deference between the real hijri date with oracle hijri date"
    Assume that the real hijri date on 18-SEP-2012 was 02/11/1433 in hijri but in oracle was 03/11/1433
    when I execute the following query it shows me "1433/11/03", but the actual Hijri date is "1433/11/02"
    select to_char(to_date('20120918','YYYYMMDD'),'YYYY/MM/DD', 'NLS_calendar='''||'ARABIC hijrah') FROM DUAL;
    IFTIKHAR

    Hi,
    It works correctly for me, too:
    SELECT  TO_CHAR ( TO_DATE ('20120918', 'YYYYMMDD')
              , 'YYYY/MM/DD'
              , 'NLS_calendar=''ARABIC hijrah'''
              )      AS h_date
    FROM    dual;Output:
    H_DATE                                                                         
    1433/11/02                                                                      I tried it on Oracle versions
    9.2.0.6.0
    10.1.0.2.0
    10.2.0.3.0
    11.1.0.6.0
    11.2.0.1.0
    and got the same results every time. What version of Oracle are you using? What other software (front end, OS, ...)?
    If it's consistently giving you the results for the day after the day wanted, then subtract 1 day before calling TO_CHAR. I know this is not a solution, just a work-around until you find and fix the real problem.

  • Use of "with master data & with out master data" at DTP update level

    Hello experts,
    In DTP, I check "with out master data". When I try to send corresponding transactional data, It is showing SID related error. Can anybody suggest what is the use of "with master data & with out master data" at DTP level.
    Thanks in advance,
    Zakir.

    HI
    HI in DTP level If you set this indicator, the system terminates the update of the request if no values are available for a data record.
    Load the relevant master data before you load the transaction data.
    If you set this indicator, the system terminates activation if master data is missing and produces an error message.
    If you do not set this indicator, the system generates any missing SID values during activation.
    In DataStore maintenance, if you do not set the SIDs Generation upon Activation indicator, the No Update without Master Data indicator in the DTP has no effect.
    thx
    vijju

  • Same Batch with different expiry dates

    Dear all,
    My vendor produced the same batch Y28 at an interval of 3 days eg 10/10/2008 , 11/10/2008, 12/10/2008 with an expiry date of 1year.
    He sent in the batch Y28 to me with the following expiry date 10/10/2009, 11/10/2009 and 12/10/2009.
    During GR, I need to enter the expiry date. However, I realised that the Batch Master for the same batch can only have 1 expiry date. I end up with the latest expiry date of 12/10/2009.
    Could anyone advise on how the above scenario sould be handled?
    Can I maintain 3 different expiry date for the same batch?
    Is it a norm that the same batch can have different expiry date?
    Thank you

    You should create a separate batch per day, if you really think that the exact date of expiry matters for a material that has a shelf life of one year.

  • How to Compare date with Current system date in XSLT mapping.

    Hello Experts
    In a XSLT mapping program, I hava a filed, ZZOB which is giving some date.
    which I need to compare with the current date.
    Condition-
    ZZOB is greater than current date or ZZOBLIG = NULL
    Then go further statements.
    how can i campare with the current date?
    Please help.
    Thanks
    Balaprasad

    This example may help:
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    version="1.0">
    <xsl:param name="currentDate"/>
        <xsl:variable name="firstDate" select="concat(substring($currentDate, 1,4),substring($currentDate, 6,2),substring($currentDate, 9,2))"/>
        <xsl:template match="/">
            <xsl:apply-templates select="//item"/>
        </xsl:template>
        <xsl:template match="item">
            <xsl:variable name="secondDate" select="concat(substring(submissionDeadline, 1,4),substring(submissionDeadline, 6,2),substring(submissionDeadline, 9,2))"/>
            <xsl:choose>
            <xsl:when test="$firstDate &gt; $secondDate">
                <xsl:call-template name="late"/>
                </xsl:when>
                <xsl:when test="$firstDate &lt; $secondDate">
                    <xsl:call-template name="ontime"/>
                </xsl:when>
                <xsl:when test="$firstDate = $secondDate">
                    <xsl:call-template name="same"/>
                </xsl:when>
                <xsl:otherwise>Monkeys<br /></xsl:otherwise>
            </xsl:choose>
        </xsl:template>
        <xsl:template name="ontime">
            This is on time
        </xsl:template>
        <xsl:template name="late">
            This is late
        </xsl:template>
        <xsl:template name="same">
            This is on time
        </xsl:template>
    </xsl:stylesheet>

  • How to compare date with thr current date

    Hi,
    I have an inout string which is in date format(dd/mm/yyyy hh:mm:ss) .
    what i need to do is comparing this date string with the current date. if my input string is less than current date , then display error message..
    how to do this?
    regards

    Excellent suggestions from all of you people!
    finally i got the solution
    code is:
    import java.util.*;
    import java.text.*;
    public class TestDate {
      public static void main(String args[]){
        TestDate a = new TestDate();
      TestDate() {
        String DATE_FORMAT = "dd/MM/yyyy hh:mm:ss";
         Date today = new Date();
         Date myDate=null;
        java.text.SimpleDateFormat sdf =
             new java.text.SimpleDateFormat(DATE_FORMAT);
         try{
         myDate = sdf.parse("01/06/2006 00:00:00");
         }catch(Exception e) {System.out.println(e);}
        Calendar c1 = Calendar.getInstance();
        Calendar c2 = Calendar.getInstance();
        c1.setTime(today);
        c2.setTime(myDate1);
        System.out.print(sdf.format(today));
        System.out.print(sdf.format(c1.getTime()));
        if (c1.before(c2)) {
           System.out.print(" is before ");
        if (c1.after(c2)) {
           System.out.print(" is after ");    
        if (c1.equals(c2)) {
           System.out.print(" same as ");    
    System.out.print(sdf.format(c2.getTime()));
      }

  • How to get the exact day date with the another date field?

    Hi,
    Please help me how to get the specific day of the week's date with the help of another date field.
    Actually , one field(week_day) has 1,2,3,4,5,6,7 here 1--MON,2-- TUE like that.
    another field has the date. based on that date, we have to go to that particular week and need to pick up the date by the above week_day. It should be in that week itself.
    Thanks in advance!!
    Regards,
    Vissu...
    Edited by: vissu on Oct 29, 2010 3:07 AM

    Hi,
    Something like this
    SELECT TRUNC(<DATE_COLUMN>,'DAY')+<WEEK_NO_COLUMN> FROM <YOUR_TABLE>;for the particular week of the date
    SELECT TRUNC(SYSDATE,'DAY')+<WEEK_NO_COLUMN> FROM <YOUR_TABLE>;for the current week
    cheers
    VT

  • UDF to compare the dates with the input date

    Hi,
    Help me in writing an UDF to compare the input date with start date and end date.
    I had written following UDF, but it is not working. we are on XI 3.0
    try {
                SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
                Date sd = df.parse(StartDate);
                Date id = df.parse(InputDate);
                Date ed = df.parse(EndDate);
                if ((sd.before(id) || (sd.equals(id))) && (ed.after(id)) || (ed.equals(id))) {
              return true;               
    else{
                    return false;
            }     catch (Exception e){
           e.printStackTrace();
    Thanks
    Srinivas

    Hello Srinivas,
    did you import this two classes in your UDF ?  java.text.* and java.util.*
    In case you did but the program is still not working I just wrote a code without imports. See if this might help. I have tested this with all type of data please test again from your end. I have assumed that if three dates are equal the function return true. I am not sure whether you wanted to exclude the boundary dates. In case you want to exclude those dates just replace '<=' with '<' symbol. The code could have been smarter but in short time I thought this might help.
    public class DateRange {
      static boolean compareDate(String startDate,String inputDate,String endDate)
              int j,k,l;
              String s[],i[],e[];          
              s=startDate.split("-", 3);
              i=inputDate.split("-", 3);
              e=endDate.split("-", 3);
              j=s[0].compareTo(i[0]);
              k=i[0].compareTo(e[0]);
              l=s[0].compareTo(e[0]);
              if(l>0|| j>0 || k>0)
                   return false;
              if(j<=0 && k<0)
                   return true;
              j=s[1].compareTo(i[1]);
              k=i[1].compareTo(e[1]);
              l=s[1].compareTo(e[1]);
              if(l>0|| j>0 || k>0)
                   return false;
              if(j<=0 && k<0)
                   return true;
              j=s[2].compareTo(i[2]);
              k=i[2].compareTo(e[2]);
              l=s[2].compareTo(e[2]);
              if(l>0|| j>0 || k>0)
                   return false;
              if(j<=0 && k<=0) 
                   return true;
                return false;
         public static void main(String[] args) {
              String startDate="1992-04-03";
              String inputDate="1992-02-03";
              String endDate="1992-02-03";
              System.out.println(compareDate(startDate,inputDate,endDate));
    Plese let me know if this works.
    regards
    Anupam

  • How many channels can I write in a same file with the Write Data Module (Dasylab 12.00.00) ?

    I would like to write data from a large number of channel (up to 128) in a same file. Using the write data module, I have up to 16 channels only ! The only solution I found is to save data in 8 different files... Is there any solution to solve this problem ? I use DASYLAB V.12.00.00. Thank you
    Solved!
    Go to Solution.

    Please see this knowledge base article describing how to do it.
    http://kb.mccdaq.com/KnowledgebaseArticle50372.aspx?Keywords=multiplex
    - cj
    Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.

  • How to over-write iCal data with iPhone calendar data?

    As of tonight, my iPhone 4's calendar will not merge to my iMac.  The Mac with push to the phone, but not the other way around.  I know for a fact that the "correct" calendar is the one on the iPhone (lucky this week I know that!), so I'd like a way to over-write the computer version with the iPhone.
    So, problems to solve:
    (1) Tell me how to reset the sync history in the newest version of iTunes
    OR
    (2) Tell me how to over-write data as described above (and pray it works the next time bi-directionally)
    OR
    (3) Point me to a fix for the original non-sync problem that I haven't discovered yet.
    Your help is GREATLY appreciated as I've spent WAY more time on this than intended already.  1 minute sync --> 4 hour issue.
    Thanks!
    [iPhone 4 with 5.1 and Calendar; iMac with 10.6.8 and iCal 4.0.4]

    Greetings,
    Basics:
    Turn iPhone and computer off and on and try again.
    Ensure date and time on iPhone and computer are the same and try again.
    More troubleshooting:
    1.) Backup all your data:
    Backup your iPhone: http://support.apple.com/kb/HT1414
    Backup your computer Addressbook: http://docs.info.apple.com/article.html?path=AddressBook/4.0/en/ad961.html
    Backup your computer iCal: http://support.apple.com/kb/HT2966
    2.) Reset the computer's sync services and then restart the computer: http://support.apple.com/kb/TS1627
    3.) Plug in the iPhone and attempt a sync.
    If that does not resolve the issue let me know and I'll give you a different route.
    Hope that helps.

  • Over write the existing master data with new master data.

    hi friends,
    we have 2 sources for master data text like source A and source B to load the master data text and as per requirement we have to stop load from source A. But if you check the master data target still the old records are existed (from Source A), if i try to delete those records as you know it is not allowing...and more over if we want to delet the mastr data we have delete the transaction data.
    In Mycase i don't want to delet the Transaction data and i need to over write the existing master data i.e Request A with Rquest B.
    Is there any solution for this issue.
    Thanks in advance,
    Sruthi.

    For overwriting the text from source B you have to have transformations from source B to your text datasource of your characteristic. Then you map the text coming from source B to the text for the characteristic.
    If it comes form source B the key for that characteristic with text, it will overwrite the text existed for that characteristic to the same key.
    For example you have 0employee and have a text datasource in source A which has employee_id and employee_name. In the Bw you have mapped in your transfer rules the employee_id to the employee_id and the employee_name to the employee_name. So for example you have extracted from source A the record:
    employee_id   employee_name
    0001               xpto
    If you have a same datasource of text coming from source B, if you do the same mapping in transfer rules in BW coming from source B, and you bring for example the record:
    employee_id   employee_name
    0001               zzzz
    You'll overwrite the old value of xpto to the new value zzzz
    Diogo.

  • Pl/sql to extract data  with form: extract data is a text file

    Hi dear all,
    to be straightforward here is the problem: we currenlty developing with oracle tools :" Developer Suite 10g version 10.1.2.0.2" an interface .
    Using oracle forms, we would like to program a command button that will be in charge of pooling the data from the database and offer the client to save it on his desktop. The extracted data should be a one single flat text file having a one single continuous row. and the data extracted are from a 10 g database( one table having one column(varchar2(240); and 192 rows );
    attached with this mail is ou current script link with the command " when-button-pressed"
    PROCEDURE EXTRACTION_FICHIER_FIC_BDF IS
    n_bouton number;
    LF$File CLIENT_TEXT_IO.FILE_TYPE;
    LC$Name Varchar2(100) ;
    LC$Fic Varchar2(100) ;
    LN$Lines Pls_integer := 0 ;
    LC$Line Varchar2(4000) ;
    -- cursor --
    Cursor C_CUR Is
    SELECT ENREGISTREMENT_BDF
    FROM ops$admO7.fic_bdf
    ORDER BY 1;
    BEGIN
    LC$Name := 'd:\AA1217.bdf';
    LC$Fic := WEBUTIL_FILE.FILE_SAVE_DIALOG
    'd:\',
    LC$Name,
    'Choisir l''emplacement du fichier à sauvegarder'
    If LC$Fic is null Then
    Return ;
    End if ;
    -- Open the file --
    Begin
    LF$File := CLIENT_TEXT_IO.FOPEN( LC$Fic, 'W');
    Exception
    when others then
    message( 'OPEN FILE ERROR ' || LC$Fic );
    raise form_trigger_failure;
    End ;
    -- Write the lines --
    For Cur In C_CUR Loop
    LC$Line := Cur.ENREGISTREMENT_BDF;
    CLIENT_TEXT_IO.PUT_LINE( LF$File, LC$Line ) ;
    LN$Lines := C_CUR%ROWCOUNT ;
    End loop ;
    -- Close the file --
    CLIENT_TEXT_IO.FCLOSE( LF$File ) ;
    set_alert_property('AL_MESSAGE',alert_message_text,'Export terminé avec succès');
    n_bouton :=show_alert('AL_MESSAGE');
    synchronize ;
    Exception
    When form_trigger_failure Then
    CLIENT_TEXT_IO.FCLOSE( LF$File ) ;
    Raise ;
    END;
    thanks if advance !!!!!

    Hello,
    what's your problem with this? You posted a lot of useful information like version infos and code (Hint: when you post code you can do this with the tags so it gets formated), but I cannot see what exactly is failing or behaving unexpected, so you might share that too ;)
    cheers                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to compare sales of 2 dates with only one date is given?

    I am having a requirement such that the user wants to see the particular company Y2D sales of this year and previous year, and only one variable selection is given (today's date). How can i design the report to see this year sales and last year sales in separate columns?

    Hi ,
    You have to create two RKFs.
    In the first RKF , you have to create a customer exit variable on your date and that too it should be interval . Using the CMOD code , populate this interval from the 1st day of this year till the date user is entering .
    In the second RKF , you have to create a customer exit variable on your date and that too it should be interval . Using the CMOD code, you have to populate the interval from the 1st day of the previous year till the same date as entered by user but it should be of last year .
    You have to write the above 2 codes in I_STEP = 2 mode .
    Hope the above reply was helpful.
    Kind Regards,
    Ashutosh Singh

  • Select multiple date with interval in date-navigator

    Hi,
    Is it possible to have a multiple date selection with interval in a date-navigator. When yes, how?
    Richard Middelburg

    Look at the below thread:
    Re: Date Navigator Challenge
    Raja T

  • How do I replace someone elses IPAD data with MY ipad data (effectively borrowing someone else's for a work trip)

    Borrowing a co-workers ipad for a biz trip. (Mine was just stolen!) Need to wipe his data and re-synch with mine. How do I do that?

    Tap on his id in Settings > Store to log out of it, then remove his content via Settings > General > Reset > Erase All Content And Settings, you can then log in with your account via Settings > Store and sync your content from your computer.
    Has he copied his purchases off via File > Transfer Purchases when connected to his computer's iTunes and made a backup of his content so that he can copy it back on when you give it back to him ?

Maybe you are looking for

  • Webdisp startup error

    Hi,       when we are trying to restart webdispatcher i am getting below error: ERROR => CTrcOpen: fopen dev_webdisp trc file: "dev_webdisp", trc level: 1, release: "700" sysno 77 sid systemid 370 (Solaris on SPARCV9 CPU) relno 7000 patchlevel 0 patc

  • ALV Refresh Editable ALV

    Hi Friends, I am having one editable ALV. I have one quanity field in which i want to change the values. I am using FM REUSE_ALV_GRID_DISPLAY. When i change the values, the changed values in the ALV are not getting reflected in the internal table and

  • No previews and now crashing...

    I recently upgraded Aperture and now have version 1.5.3 on Mac OSX 10.4.9. However, I no longer have previews for most of my images and, when Aperture is trying to generate previews, the application keeps crashing. Has anyone else experienced this is

  • How to connect to ms sql server analysis server

    I am interested to learn how to use the sql server olap technology --can any one help? and also i need how to connect to the analysis server and get data from the cubes. is there a demo available...possibly a demo application as well? or site that sh

  • Can the iphone task an email to a appointment in the calendar?

    I want to create appointments out of certain emails? Is there a native tool or addon software that will allow me to create appointments directly from emails?