How to manage values of 'special' time with the charger

Hi all

I want to import data from Google Transit in a DB Oracle (version 11).
My goal is to import the arrival_time and departure_time as a TIMESTAMP type attributes
The file to be imported has the following structure:

trip_id arrival_time departure_time, stop_id, stop_sequence, stop_headsign, pickup_type, drop_off_type, shape_dist_traveled
3307886, 06:33:00, 06:33:00, 6606, 4,.
3307886, 06: 34:50, 06: 34:50, 6596, 5.
3307886, 06: 36:09, 06: 36:09, 6611, 6,.
3307886, 06: 37:00, 06: 37:00, 6604, 7,.
3307886, 06: 37:42, 06: 37:42, 6601, 8.
3307886, 06: 38:24, 06: 38:24, 6612, 9,.
...........................
* 3348800, 24: 47:03: 24: 47:03, 3031, 61, *.
* 3348800, 24: 48:00: 24: 48:00, 4823, 62, *.

The problem is that "BOLD" marked lines have a time value greater than 24, and this is not possible with the charger.

In this case in the imported value the day must be incremented by 1 and time must begin with previousHours % 24.
for example

+ 3307886, 06:33:00,-> 3307886,'1970-01-01-06: 33:00 ',... +.
+ 3348800: 24: 47:03-> 3348800,'1970-01-02-00: 47:03',... +.

Thank you very much

is there a way to do this with sql loader? If so, is there a way to say that for the charger?

Thanks a lot for your help

was soon Markus

Published by: markusin on January 20, 2010 12:26 AM

Published by: markusin on January 20, 2010 12:26 AM

Hello Markus.
If you download files from the server that depends on the database, using external tables is an excellent choice. If you download files from a server that is remote from the database, external tables is not an option and you need to use SQL * Loader.

In both cases, you can create a function to be used for the processing of these data.

Your command file may look like this (untested)

LOAD DATA
APPEND
INTO TABLE target_table
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
(  trip_id
 , arrival_time         "CONVERT_TIME(:arrival_time)"
 , departure_time       "CONVERT_TIME(:departure_time)"
 , stop_id
 , stop_sequence
 , stop_headsign
 , pickup_type
 , drop_off_type
 , shape_dist_traveled
)

Your function might look like this

CREATE OR REPLACE FUNCTION  convert_time
  (p_time_string  VARCHAR2)
  RETURN  TIMESTAMP
IS
  r_timestamp            TIMESTAMP;
  v_day_increment        PLS_INTEGER  := 0;
  v_hour_part            VARCHAR2(2);
  v_rest_of_time_string  VARCHAR2(6);
BEGIN
  v_hour_part           := SUBSTR(p_time_string, 1, 2);
  v_rest_of_time_string := SUBSTR(p_time_string, 3, 6);
  IF  v_hour_part = '24'
  THEN
    v_day_increment := 1;
    v_hour_part     := '00';
  END IF;
  r_timestamp := TO_TIMESTAMP(v_hour_part||v_rest_of_time_string, 'HH24:MI:SS') + v_day_increment;
  RETURN  r_timestamp;
END;
/

During testing, I found that the current month and year will be used for the timestamp instead of Jan 1970.

Hope this helps,
Luke

Please check the answer as helpful or response, if it is so. If this is not the case, further clarification.
Try to always provide create table and table insert to help members of the forum to help you.

Tags: Database

Similar Questions

  • How to manage too many objects correspond with the exception of the primary key

    Greetings,

    IM using JDeveloper 11.1.2.4.0 and im trying to manage the "too many objects match the primary key' exception.

    I try to add a try catch in bean when I run the validation operation, but he didn't catch it.

    then I add a plug on the setter, but he ignores the value and try to insert a null on my primary key.

    I want just to handle this exception and display an appropriate message that it is a duplicate primary key

    (and of course do not try to continue the validation operation if there are duplicate key)

    Thanks in advance.

    You can find samples for error messages personalized here:

    http://www.adftutorials.com/ADF-custom-error-handler-to-display-custom-message-to-user.html

    http://smconsultants.in/2013/07/ADF-BC-error-messages-customization.html

  • kindly tell how to use the unique value of a table with the index 0

    kindly tell how to use the unique value of a table with the index 0

    Hi
     
    Yep, use Index Array as Gerd says. Also, using the context help ( + h) and looking through the array palette will help you get an understanding of what each VI does.
     
    This is fundamental LabVIEW stuff, perhaps you'd be better spending some time going through the basics.
     
    -CC
  • How to read 4 similar channels at the same time with the MCC

    Hello

    with the mcc libraries and a card PCi-6034 classic (by calculation of the measure), I want to read 4 analog channels at the same time. I have a "scope" with 4 channels.  How to read 4 channels at the same time with the mcc?

    MF

    Hello MF.

    Thank you for using OR support.  I guess you try to program in LabVIEW.  Where exactly did you get the MCC library of?

  • I made a new music video for a song, and the music is not in time with the film, how I put in time?

    I made a new music video for a song, and the music is not in time with the film, how I put in time?
    Oh and I'm using WIndows Movie Maker. One.

    Please repost in Windows Live Solution Center.
    Forum on Windows Live Movie maker:
    http://windowslivehelp.com/forums.aspx?ProductID=5

  • See the time with the date in the cell?

    How do you not see time with the date in a cell? I tried all the settings I can find but without success.

    Using the numbers from version 3.6.2 (2577) - OS: El Cap 10.11.6

    I don't want to see that 12:00:00 AM

    Hi Russ,

    Inspector to format > cell, the parameters as shown below:

    Kind regards

    Barry

  • How save you bookmarks in a folder with the keyboard?

    Since getting used to better organize my favorites, I have folders of bookmarks that are up to three levels deep.

    How do I save a bookmark to a specific folder without having to use the mouse or click "choose...". » ?

    It would be nice if there was a way to type just, with suggestions of future record.
    That is, I would be able to hit Ctrl + D, type the name, press tab and type Classes\303\HW to have bookmark to this folder. Right now I can only favorite for files recently used with the keyboard.

    I know that this can be done with the mouse, but I'm looking for a way fast with the keyboard, possible with a plugin of some sort.

    The closest I can you would:

    Ctrl+d, Tab, Tab, spacebar
    

    At this point you can use wildcards to accelerate up to specific files, arrow on the right to open, etc. Maybe:

    cl, right, 30, right, h
    

    At this time, with the correct destination folder selected, you need twice Tab or SHIFT + Tab twice before Enter will present the dialog box. Not pretty.

    Maybe there's an add-on which makes the process easy. Over the years, there are many related extensions, but I have not tried (or heard of) those that seem relevant to your request. I think it is worth looking at the site of modules in the Favorites category.

  • How can we do a single element with the content of two clips

    How can we do a single element with the content of two clips

    You try to get a picture of image? In other words, that contained two visible clips at the same time? If you are, change the substantive item to you main plot and another tie on top using an edit connect to the battery. Select the top item. Activate the transform tool and resize and reposition the clamp if necessary.

    Russ

  • I get a message says "the site is unavailable at this time" with the error code [0 x 80070424].

    Original title: error code [0 x 80070424]

    My security alerts continues to tell me that the automatic updates are disabled. I check in the Security Center, and they are in position "on", but it won't download updates. When I go to the Microsoft website to update directly, I get a message says "the site is unavailable at this time" with the error code [0 x 80070424]. Microsoft doesn't even have it classified as a potential error code. I checked the status of the Fund Manager and it is set to "Auto" and it is started, but does not resolve the issue.

    Hello

    You did changes to the computer before this problem?

    Try the troubleshooting provided in the article below steps and check if it helps.

    Error message when you use Microsoft Update or Windows Update Web sites to install updates: 0 x 80070424
    http://support.Microsoft.com/kb/968002

  • How to create a file name variable with the County and the date?

    Objective: Create a file name variable with the County and the date

    Error: get a lot of error. Do you know how to change my code?

    Question: how to create a file name variable with the County and the date?

    Mini code:

    std::string * rawfilepath;
    std::string * rawfilename;

    rawfilepath = "./shared/documents/";
    RawFileName = rawfilepath + 'rawlog -' + 0 + '-.txt ';
    QFile file (rawfilename);
    If (file.exists ()) {}
    rawfilenamecount ++;
    RawFileName = "./shared/documents/rawlog-" + rawfilenamecount + "-.txt ';
    }

    Thank you for your attention,

    Thank tzander reminding me the idea. Method of cascades is not good for me because all of the kernel code is written by Native. If I change the channel to QString, I need to change a lot of codes.

    Solution is below.

    While (access (rawfilename, F_OK)! = - 1) {}
    rawfilenamecount ++;
    sprintf (format, RawFileName, rawfilenamecount);
    fprintf (stderr, "file exists");
    }

    Rawlog = fopen (rawfilename, "w"); Save the file in a specific path.
    fprintf (rawlog, "System Time (ms)" "");

  • Using Vista Home Premium 64 x. In Windows Explorer how to group by name to display with the simple letters like A, B, C, D, etc. instead of A - H, P, Q - Z?

    Original title: group Windows Explorer by name

    Using Vista Home Premium 64 x.  In Windows Explorer how to group by name to display with the simple letters like A, B, C, D, etc. instead of A - H, P, Q - Z?  In XP, it could be sorted by simple letter, which makes it easier in a folder with many files.  Thanks in advance.

    Hi kmcmi,

     

    Welcome to Microsoft Answers Forums.

    Well this feature is not available in Windows Vista.

    It only works on Windows XP.

    I've added a useful link

    Behavior and change folder views

    http://windowshelp.Microsoft.com/Windows/en-us/help/3a3bfe59-5268-4FB3-81c5-7972c28939cd1033.mspx

    Hope this information is useful.

    Let me know if it worked.

    All the best!

    Thanks and greetings

    Halima S - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • How to fax multiple pages at once with the HP 6500 has more

    How to fax multiple pages at once with the HP 6500 has more.

    I don't know why I can't do this, it sends do not ask if you need to scan another page.

    Your device contains a document feeder, the sending of several pages of the Scanner glass is not supported.

    Simply place the pages face up on top of the document feeder and send the fax, as shown below:

    http://support.HP.com/us-en/document/c02299537

  • How to remove a specific email inbox with the client application code?

    Hello

    How to remove a specific email inbox with the client application code?  Please suggest useful links.

    Advanced thanks.

    Concerning

    Sunil.G

    Your question is a bit broad, so it is difficult to give you details.

    First of all, you must have the ID of the original message. Usually, you get either by hanging the message when he came into the Inbox (by implementing FolderListener), or by retrieving a list of mail of enamel "Store".

    Once you have this message ID, you call Folder.deleteMessage ().

    Here, there is a laboratory of Developer:

    http://NA.BlackBerry.com/eng/developers/resources/Labs/listeningforemail.jsp

    Moreover, classes to look in the API of reference:

    Store

    Folder

    FolderEvent

    FolderListener

    Session

    ServiceConfiguration

    Message (message RIM, not the J2ME)

  • How to create a user local administrator with the user root on the CV

    As says the tile, how to create a user local administrator with the user root on VCS-Express. I lost the password and cannot log in as an admin user, but I can't seem to log as long as user root.

    Once connect you with the root account, type in "tsh", from there, you can create the accounts of local administrators with 'xCommand AdminAccountAdd.  See the reference section of command of the VCS Administrator's Guide, starting on pg 517.

    If your VCS is a virtual machine, you can change the password of admin with vSphere, or if it is a hardware appliance, you can use the serial port, see pg 312 of the Administrator's guide.

  • How to create a my Signature (signature with the tablet of manufacturing) Action?

    How to create a my Signature (signature with the tablet of manufacturing) Action?

    I use PSCS6?

    I have no problem making an action of signature if I pick a font and then type in my name,

    but to make a real action of my signature seems impossible.

    Hello

    There is a very cool technique to do by your signature in a Photoshop brush.  Once this is a brush, you can change the size and place the signature everywhere where you want.

    Google "Photoshop brush signature" or something similar and you will see a lot of tutorials.  Try this one:

    Photoshop reference guide | Creating a custom brush Signature | Peachpit

    Basically, you sign your signature on a blank piece of paper, then you scan in a JPG or TIFF file, then you open that file in PS to create a brush.

    I hope this helps.

    John

Maybe you are looking for