Changing date but saving time

I have some code where I copy records from one partition to another partition the table has the
followin partition.
PARTITION BY RANGE (CREATE_DATE)
I would like to change the date to a new value for the destination record but keep the time.
Here is my code, can somebody provide an example of how I can do this
CREATE OR REPLACE PROCEDURE C0HARPA.mtas_req_feat_copy_part
(p_create_date in DATE, p_create_date1 in DATE)
IS
--  desc mtas.mtas_req_feat;
-- REQUEST_SEQ  NUMBER                           NOT NULL,
-- MTAS_SYSTEM  VARCHAR2(15 BYTE)                NOT NULL,
-- FEATURE      VARCHAR2(64 BYTE)                NOT NULL,
-- FLAG         VARCHAR2(16 BYTE),
-- CREATE_DATE  DATE
TYPE myarray IS TABLE OF mtas.mtas_req_feat%ROWTYPE;
l_data myarray;
myREQUEST_SEQ mtas.mtas_req_feat.request_seq%TYPE;
CURSOR r IS
SELECT * FROM mtas.mtas_req_feat r
WHERE r.create_date >= p_create_date
AND r.create_date < p_create_date + interval '1' day;
l_start number default dbms_utility.get_time;
rows_processed number :=0;
BEGIN
  -- To prevent ORA-20000: ORU-10027: buffer overflow, limit of 2000 bytes
  DBMS_OUTPUT.ENABLE (buffer_size => NULL);
  select max(REQUEST_SEQ) into myREQUEST_SEQ from mtas.mtas_req_feat;
  DBMS_OUTPUT.PUT_LINE('High Value REQUEST_SEQ is '||myREQUEST_SEQ);
  OPEN r;
  LOOP
    FETCH r BULK COLLECT INTO l_data LIMIT 10000;
    FOR j IN 1 .. l_data.COUNT
    LOOP
      l_data(j).create_date := p_create_date1 || (NEED TIME FROM SOURCE RECORD);
      myREQUEST_SEQ := myREQUEST_SEQ +1;
      l_data(j).request_seq := myREQUEST_SEQ;
      INSERT INTO c0harpa.mtas_req_feat VALUES l_data(j);
      rows_processed := rows_processed+1;
    END LOOP;
    FORALL i IN 1..l_data.COUNT
      INSERT INTO c0harpa.mtas_req_feat VALUES l_data(i);
    COMMIT;
    EXIT WHEN r%NOTFOUND;
  END LOOP;
  COMMIT;
  dbms_output.put_line
     (round((dbms_utility.get_time-l_start)/100, 2) ||' Seconds...' || rows_processed || ' Rows Processed' );
  CLOSE r;
END mtas_req_feat_copy_part;
I am calling like this:
sqlplus / <<EOT >> $LOG 2>&1
set serveroutput on
SET PAGESIZE 0
SET FEEDBACK OFF
SET VERIFY OFF;
set heading off;
set line 200
exec C0HARPA.mtas_request_copy_part ( to_date( '2011-09-01', 'YYYY-MM-DD' ),
                                                           to_date( '2011-09-02', 'YYYY-MM-DD' ))
exit;
EOTThanks to all who answer

840386 wrote:
I have some code where I copy records from one partition to another partition the table has the
followin partition.
PARTITION BY RANGE (CREATE_DATE)
I would like to change the date to a new value for the destination record but keep the time.
Here is my code, can somebody provide an example of how I can do this
CREATE OR REPLACE PROCEDURE C0HARPA.mtas_req_feat_copy_part
(p_create_date in DATE, p_create_date1 in DATE)
IS
--  desc mtas.mtas_req_feat;
-- REQUEST_SEQ  NUMBER                           NOT NULL,
-- MTAS_SYSTEM  VARCHAR2(15 BYTE)                NOT NULL,
-- FEATURE      VARCHAR2(64 BYTE)                NOT NULL,
-- FLAG         VARCHAR2(16 BYTE),
-- CREATE_DATE  DATE
TYPE myarray IS TABLE OF mtas.mtas_req_feat%ROWTYPE;
l_data myarray;
myREQUEST_SEQ mtas.mtas_req_feat.request_seq%TYPE;
CURSOR r IS
SELECT * FROM mtas.mtas_req_feat r
WHERE r.create_date >= p_create_date
AND r.create_date < p_create_date + interval '1' day;
l_start number default dbms_utility.get_time;
rows_processed number :=0;
BEGIN
-- To prevent ORA-20000: ORU-10027: buffer overflow, limit of 2000 bytes
DBMS_OUTPUT.ENABLE (buffer_size => NULL);
select max(REQUEST_SEQ) into myREQUEST_SEQ from mtas.mtas_req_feat;
DBMS_OUTPUT.PUT_LINE('High Value REQUEST_SEQ is '||myREQUEST_SEQ);
OPEN r;
LOOP
FETCH r BULK COLLECT INTO l_data LIMIT 10000;
FOR j IN 1 .. l_data.COUNT
LOOP
l_data(j).create_date := p_create_date1 || (NEED TIME FROM SOURCE RECORD);
myREQUEST_SEQ := myREQUEST_SEQ +1;
l_data(j).request_seq := myREQUEST_SEQ;
INSERT INTO c0harpa.mtas_req_feat VALUES l_data(j);
rows_processed := rows_processed+1;
END LOOP;
FORALL i IN 1..l_data.COUNT
INSERT INTO c0harpa.mtas_req_feat VALUES l_data(i);
COMMIT;
EXIT WHEN r%NOTFOUND;
END LOOP;
COMMIT;
dbms_output.put_line
(round((dbms_utility.get_time-l_start)/100, 2) ||' Seconds...' || rows_processed || ' Rows Processed' );
CLOSE r;
END mtas_req_feat_copy_part;
I am calling like this:
sqlplus / <<EOT >> $LOG 2>&1
set serveroutput on
SET PAGESIZE 0
SET FEEDBACK OFF
SET VERIFY OFF;
set heading off;
set line 200
exec C0HARPA.mtas_request_copy_part ( to_date( '2011-09-01', 'YYYY-MM-DD' ),
to_date( '2011-09-02', 'YYYY-MM-DD' ))
exit;
EOTThanks to all who answersince we don't have your tables or data, we can't run or improve posted code.
to_date( '2011-09-02', 'YYYY-MM-DD' ))time component for DATE above will be all zeros (00:00:00)

Similar Messages

  • [solved] Changing date but not time

    Hello,
    I already searched the web but all examples how to change date involved changing time as well.
    date -s "7 April 2008 20:42:45"
    date -s "7 April 2008 20:42:45"
    I need a script that does the follow.
    1. Save the current date
    2. Change the date to a defined one (but not the time because that conflicts with NTP)
    3. Start a program
    4. Wait for the program to be closed to restore the original date saved in 1.
    How would you write such a script in Bash without changing the time?
    Last edited by orschiro (2013-04-07 21:22:52)

    Thanks for your replies. I did not know that time and date are inevitably connected to each other and that changing date does always mean changing time as well.
    @Trilby,
    I indeed want to circumvent a trial-period. I am working on a Linux compatibility version of Prezi Desktop which is no longer provided in an official version. Many people contacted me with issues they are facing that I cannot testify as I do not have a 'Pro' account for which one has to pay. I generally pay for software but in this special case I do not want to pay for an account realising that in fact I cannot use the software due to compatibility issues.
    As such, I already tried libfaketime but I failed to get it working with Adobe AIR 32bit on my 64bit system. I am aware that I am doing something that I ought not to do but I am not willed to pay for broken software.
    @moetunes
    [orschiro@thinkpad ~]$ date -s '7 April 2008'
    date: cannot set date: Operation not permitted
    Mo 7. Apr 00:00:00 CEST 2008
    You see, date -s would reset the time to 00:00 which is not what I was looking for. I want to save my current time to restore it again after closing the program.

  • I am trying to download UCbrowser which is fine on my iPhone 5C but unable to download on my iPad2, It shows on cloud but I couldn't download, I tried to change date but still no go, It says "you've already purchased this so this will be downloaded now"

    I am trying to download UCbrowser which is fine on my iPhone 5C but unable to download on my iPad2, It shows on cloud but I couldn't download, I tried to change date but still no go, It says "you've already purchased this so this will be downloaded now" but never downloads

    Close the App Store app, reset your iPad and then try again.
    To close the App Store, drag the app up from the multitasking display. Double tap the home button and you will see apps lined up going left to right across the screen. Swipe to get to the app that you want to close and then swipe "up" on the app preview thumbnail to close it.
    Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider if it appears on the screen - let go of the buttons. Let the iPad start up.

  • The last update failed on my window 7 pc, resulting in me having to try it manually download and install, this also failed leaving my I tunes not working, I tried restore back to a safer date, but every time it tried to update it failed. eventually i

    The last update failed on
    my window 7 home prermium pc, resulting in me having to try it manually download and install,
    this also failed leaving my I tunes not working, I tried restore back to a
    safer date, but every time it tried to update it failed. eventually it told me
    to delete and reinstall, this fails due to the apple mobile device service
    failing to start, and asking me if I have sufficient privileges to start system
    service, I have tried all suggestions on iTunes page, ie delete everything to
    do with apple, and start as administrator, nothing works, help please

    I too have tried the latest iTunes (12.1.1.4) in Win7. I did a search for latent drivers as you noted but found none. I am glad it worked for you - I'm still no-joy at this point. I'm able to install AMDS over and over again, without issue - it just doesn't start then iTunes launch fails with Error 7. I have to manually remove it.
    I am able to connect my iPhone via USB cable and access my photo storage on the phone. I am just not able to install iTunes anymore. I have attempted resolution to this issue for almost two months now. Until that time, I was content with what was installed. It was only when the proverbial update box appeared that I attempted to 'update' my iTunes. WHAT A MISTAKE putting blind faith into an Apple request to update. I SUGGEST NOT TO UPDATE YOUR ITUNES IF IT IS RUNNING PROPERLY!
    I realize now, once again I might add, my reliance on software provided by others. It's like anything else, I shouldn't rely on just one method for anything. Time to search for a more pleasant alternative than Apple. Truly, when it worked, it was good at its job, but now that I am wasting time I am looking seriously at upgrading to another type of smartphone and media management software. Way too much trouble for anything as simple as this should be. I wonder, is this a result of another feud with Microsoft?

  • Selecting records from multiple dates but specific time

    Hi:
    I've to select records of multiple dates but the time should be 00:00:00 to 06:00:00 (i.e. 12 AM - 6 AM)
    For date part this can be done:
    WHERE
    START_TIME BETWEEN TO_DATE('04-01-2012', 'MM-DD-YYYY') AND TO_DATE('04-05-2012', 'MM-DD-YYYY')
    But how can I fix the time mentioed above.
    Please let me know.
    Thanks/Tanvir

    WHERE
    START_TIME BETWEEN TO_DATE('04-01-2012', 'MM-DD-YYYY') AND TO_DATE('04-05-2012', 'MM-DD-YYYY')
    and start_time - trunc(start_time) between 0 and 6/24start_time - trunc(start_time) will give you the fraction of a day. So 6/24 means 06:00.
    (When you use to_char(trunc(sysdate,'hh'),'hh24') between 0 and 6 you will also retrieve records with start_time 06:01 for example. So this would not meet your requirements as far as I understood.)
    Edited by: hm on 10.04.2012 01:26

  • Help: Changing city but wrong time shows up!

    My Nano syncs up the time and date when I connects to my computer...but when I try to change the city the time adjust to that city time. Is there a way to set my home city time?
    Thanks
    Derek
    Toronto

    Hello Derek,
    First step, is your time zone setting correct? My Mac says you should be in the EDT zone.

  • Changing date and/or time of photos

    I often change the time of individual iPhoto pictures to change their order in the photo Library.
    I change the date and or time in the information section. I have iPhoto sort the photos by date.
    I just imported about 1200 photos from a DVD and want to change the order of some of them, but when I change the time, the new time stays there, but the photo either does not move or moves to the incorrect place. I have closed and reopened iPhoto and even restarted the computer.
    I would appreciate any help or suggestions.
    Thanks in advance.

    Try using the Photo menu ==> batch change date and time (if the photos either do not have a data and time or they are not in the date time sequence you want or the adjust date and time (if you want to add a constant amount to all photos selected keeping them in the same date/time sequence but with a different date and time - and select the change the original option
    LN

  • Is there any way to sort photos not just by date but by time as well in iPhoto?

    I have a general know-how of iPhoto (View change by date, create events, etc.) I recently came back from a family trip and I was sort of designated as the family organiser of the photos from the event. So in my event I have three sets of photos (One from each camera imported) they organised by date just fine the problem is that they are in three sets. The best way I can explain this that each grouping of pictures for the day is itself in the proper chronological order for the camera that took it. It's the fact that the they aren't intertwined with each other i.e. in my event I have three sets of photos going from morning to night morning to night morning to night for the one day, so I was wondering if there was any way to get iPhoto to sort the three together as one or to look at just the time the photos was taken?   (Note this is iPhoto '09 or 8.1.2)

    Sorry but can you please br more clear?
    Assuming that the view menu sort events is set to either assenting or descending and you are looking in events then the photos should be intermixed by time
    You and make a smart album with camera = [each of the cameras] and select the photos and using the adjust time and date command to correct the time fir tosses Otis
    LN

  • Editing date but not time

    I am trying to alter the date on a batch of photos but leave the time taken the same. Using batch change won't allow me to achieve desired results

    Do not use batch change - use adjust date and time - just above batch change
    LN

  • I have managed to sync my iPhone 4 to my btyahoo calendar with caldav.  All entries appear on the phone calendar on the correct date, but the time given is always 5 hours later than the (correct) time on the computer. How can I rectify this?

    Why do the times for each event or appointment appear on the phone calendar exactly 5 hours later than the correct times entered into the Yahoo calendar on my P.C?  Is there a way of rectifying this, either on the Yahoo calendar site, or on the iPhone?

    You got the new iphone?????   I have same problem.  I transferred audiobooks to device to find no audiobooks on device (despite it being in iTunes as if it was).  Have you found a solution?????   I even tried to change import settings on format transfer but hasn't worked. 

  • When downloading/uploading any file with Firefox, Finder shows date but not time

    On my iMac, as I either upload or download a file using Firefox after installing Lion, the Finder window that opens for me to tell it where to either download the file to or upload it from, shows dates of all the existing docs there, but not the time. How can I make it show the time as well?

    I have found the problem.
    A download manager had been installed for a specific website and it was butting in all the time. Even after removing it with 'Add or remove software' it still had its hooks into the system and it was impossible to download anything as it now would not run.
    Had to do an XP 'System restore' before I could get rid of it.
    The offending program was MD_setup.exe size 3,045KB from the themediadownloader.com

  • Can photos have date, but not time?

    Though I've got a digital camera, in many ways I still prefer the "real" camera - however, I've now taken to getting all the films I have developed scanned & would like to merge them into relevant events.
    I can generally work out the date that something happened; but less sure about the time! I'm taking it, though, that it has to have the time in there somewhere?

    No - just use the data and a standard arbitrary time for unknown time - like midnight for example - or midnight for night photos and noon for daylight photos
    LN

  • Wrong date but good time!

    Hi,
    I got a small but annoying problem.
    I set "automaticly set date and time" and I have good time (I mean hour) but wrong date.. I know I can set it by myself, but if its automatic it should be ok, but it isnt. Where is the problem? Something with phone or maybe with network?

    Unless it's confirmed officially that your phone is defective, then you can ask for a replacement. Or you have to live with you. However you can trade it for a new one if you don't care the price drop.

  • Date, but no time

    I formatted a cell to display date and time, but when I select "Insert Date & Time" from the menu, only the date displays correctly. The time stays at 00:00.
    Also, is there a keyboard shortcut to insert Date and Time?

    "Insert Date and Time" is a dual purpose menu item. It initially inserts the 'date only' with the time part set of 00:00:00, as it would be if you typed a date into the cell.
    To add the current time value, double click the cell immediately after inserting the date, then choose the last item on the pop-up menu in the dialogue that opens. Close the dialogue and carry on.
    No keyboard shortcut is provided for Insert Date and Time, but you can define one yourself using the Keyboard Shortcuts pane in System preferences > Keyboard and Mouse. You'll still need to double-click and choose to include the time, though.
    Regards,
    Barry

  • Changing fps but not time

    OK, i have to do a project that has to be done SOON, so the
    faster the response, the better.
    Is there any way for me to make the fps larger but keep the
    time the same? e.g.: a 30 second clip at 10 fps, but changing it to
    30 fps while still maintaining 30 seconds

    not that easily, you can change your fps whenever you want
    but then you need to move all the keyframes as well.

Maybe you are looking for

  • I have photos in Adobe Photoshop Album Starter edition 3.0. How can I burn these to a CD?

    I have photos in Adobe Photoshop Album Edition 3.0.  How can I burn these to a CD?

  • Asset history sheet (S_ALR_87011990) is not working ok

    Hello,      I have problems with the asset history sheet (S_ALR_87011990) because it doesen't shows the right amount for the totals. I chose the "Lisst assets or group totals only" check mark and the totals amounts for one asset class are not equal w

  • EXCEL to Mail

    Hi Experts,                  I am doing a Scenario which involves sending an Excel file to Mail ie .csv to mail In my scenario i have a EXCEL file as Id     FisrtName     LastName     Salary 1         A                   B                3 2        

  • Updated to 2014-now preview files won't load

    I render all my files, close Ppro and when I re-open the project, I get the red bars and have to re-render everything. Clearly I can't continue on this way and my research on this forum hasn't turned up an answer although I see that others have had t

  • Can't open ipad project in iMovie '09

    I've been working latley on a project in iMovie on my iPad. And now i want to do the final cuts on my MacBook with the iMovie '09 that came with it. But, iMovie '09 dosen't seem to support the format that the iPad projects is in. Why? And what can i