Simple (probably) sqlldr question

I’m new to sqlldr, am having a problem, and would appreciate some help.
This is probably a easy problem for someone who is experienced.
The input data file looks has year and month of birth in the second position. For instance,
15|198101|4|20040204|20040204
means the person was born in 1981, in January.
The table I want to load wants person’s age in years, which goes into field 7.
A crude way of calculating the person’s age would be 2011 – 1981,
So I tried
     col7      POSITION(4:7)     EXPRESSION ”2011 – TO_NUMBER( SUBSTR(:col7,1,4),9 )“
For instance,
INTO TABLE TABLE1
     col1     POSITION(1:2)      CHAR,
     col2               CONSTANT 0,
     col3               CONSTANT "30-SEP-11",
     col4     POSITION(11:11) INTEGER EXTERNAL,
     col5     POSITION(13:20) "TO_DATE(:col5,'yyyymmdd')",
     col6     POSITION(22:29) "TO_DATE(:col6,'yyyymmdd')",
     col7      POSITION(4:7)     EXPRESSION ”2011 – TO_NUMBER( SUBSTR(:col7,1,4),9 )“
But that didn’t work. I tried various variations but they didn't work either.
Can anyone suggest the proper code?
Also, a more refined way would take the month into consideration, so that a person born
in Sept 1991 would today be 20 but one born in Dec 1991 would still be 19.
Can anyone suggest the proper code for that?
Thanks.

Hello user6071447.
I'm not sure what error you are getting, but here is an example of calculating age while loading using sqlldr with the sample data that you provided:LOAD DATA
APPEND
INTO TABLE test_table
age_in_years POSITION(4:9) "FLOOR(MONTHS_BETWEEN(SYSDATE, TO_DATE(:age_in_years, 'YYYYMM')) / 12)"
)If your looking for a little less accuracy, you can remove the month from the equation.
Hope this helps,
Luke
Please mark the answer as helpful or answered if it is so. If not, provide additional details.
Always try to provide actual or sample statements and the full text of errors along with error code to help the forum members help you better.

Similar Messages

  • Simple (probably dumb) question about Mail --

    After I read a message, how do I go the next message without closing the current message box and going back to Inbox? That is, is it possible to read a message then go to the next one, then the next one, etc. without going back to the Inbox?
    Thanks for any help.
    Sunil

    you can read a message from the message list, by reading in the preview pane. if you do not have the preview pane set on your main window, go to the bottom of the window, you will notice a line with a dot at the middle, drag that dot to the middle of the window or a little higher and drop it. you should now have your main window divided in two, with the upper part showing the message list, and the lower part showing the text of the email you have selected in the message list.
    hope this helps

  • Probably stupid question but I am new to Mac's.  Somehow my picture is at the right top of my out going emails and I don't know how to delete it.  Help!!

    Probably astupid question but I am new to Mac's.  Somehow my picture is gotten placed at the top right of all my out going mail and I don't know how to delete it.  Help!!

    This may help:
    http://www.maclife.com/article/how_can_i_remove_my_photo_from_messages_in_apple_ mail

  • Simple X-fi Question, Please Help

    !Simple X-fi Question, Please HelpL I've been looking for an external sound card that is similar to the 2002 Creative Extigy and think I may found it in the Creative X-Fi. I have some questions about the X-fi though. Can the X-fi:
    1. Input sound from an optical port
    2. Output that sound to 5. surround- Front, surround, center/sub
    3. Is the X-Fi stand-alone, external, and powered by a USB or a wall outlet (you do not need a computer hooked up to it)
    Basically I want to connect a TosLink optical cable from my Xbox to the X-Fi. That will deli'ver the sound to the X-Fi. Then I want that sound to go to a 5. headset that is connected to the X-fi via 5. front, surround, and center/sub wires. The X-Fi has to be stand-alone and cannot be connected to a PC to do this.
    Thank you for your help.

    The connector must match, and the connector polarity (plus and minus voltage) must match.  Sorry, I don't know if the positive voltage goes on the inside of the connector or the outside.    Any wattage of 12 or more should be adequate.
    Message Edited by toomanydonuts on 01-10-2008 01:29 AM

  • Hello. i have a 57 min mts video that i'd like to cut into several short videos. simple, probably. how do i separate this video into sections?

    hello. i have a 57 min mts video that i'd like to cut into several short videos. simple, probably. how do i separate this video into sections?

    Press F1 and type in Subclips.

  • Simple Crop tool question... how do I save the crop section?

    Hi,
    I have a very simple crop tool question. I'm a photoshop girl usually... so Illustrator is new to me. When I select the crop section I want... how do I save it?... if I select another tool in the tool panel, the crop section disappears and I can't get it back when I re-select Crop tool. If I select Save as... it saves the whole document...and not just my crop section.
    Like I said, simple question...but I just don't know the secret to the Illustrator crop tool.
    Thanks!
    Yzza

    Either press the Tab key or F key.

  • A Simpler, More Direct Question About Merge Joins

    This thread is related to Merge Joins Should Be Faster and Merge Join but asks a simpler, more direct question:
    Why does merge sort join choose to sort data that is already sorted? Here are some Explain query plans to illustrate my point.
    SQL> EXPLAIN PLAN FOR
      2  SELECT * FROM spoTriples ORDER BY s;
    PLAN_TABLE_OUTPUT
    |   0 | SELECT STATEMENT |              |   998K|    35M|  5311   (1)| 00:01:04|
    |   1 |  INDEX FULL SCAN | PKSPOTRIPLES |   998K|    35M|  5311   (1)| 00:01:04|
    ---------------------------------------------------------------------------------Notice that the plan does not involve a SORT operation. This is because spoTriples is an Index-Organized Table on the primary key index of (s,p,o), which contains all of the columns in the table. This means the table is already sorted on s, which is the column in the ORDER BY clause. The optimizer is taking advantage of the fact that the table is already sorted, which it should.
    Now look at this plan:
    SQL> EXPLAIN PLAN FOR
      2  SELECT /*+ USE_MERGE(t1 t2) */ t1.s, t2.s
      3  FROM spoTriples t1, spoTriples t2
      4  WHERE t1.s = t2.s;
    Explained.
    PLAN_TABLE_OUTPUT
    |   0 | SELECT STATEMENT       |              |    11M|   297M|       | 13019 (6)| 00:02:37 |
    |   1 |  MERGE JOIN            |              |    11M|   297M|       | 13019 (6)| 00:02:37 |
    |   2 |   SORT JOIN            |              |   998K|    12M|    38M|  6389 (4)| 00:01:17 |
    |   3 |    INDEX FAST FULL SCAN| PKSPOTRIPLES |   998K|    12M|       |  1460 (3)| 00:00:18 |
    |*  4 |   SORT JOIN            |              |   998K|    12M|    38M|  6389 (4)| 00:01:17 |
    |   5 |    INDEX FAST FULL SCAN| PKSPOTRIPLES |   998K|    12M|       |  1460 (3)| 00:00:18 |
    Predicate Information (identified by operation id):
       4 - access("T1"."S"="T2"."S")
           filter("T1"."S"="T2"."S")I'm doing a self join on the column by which the table is sorted. I'm using a hint to force a merge join, but despite the data already being sorted, the optimizer insists on sorting each instance of spoTriples before doing the merge join. The sort should be unnecessary for the same reason that it is unnecessary in the case with the ORDER BY above.
    Is there anyway to make Oracle be aware of and take advantage of the fact that it doesn't have to sort this data before merge joining it?

    Licensing questions are best addressed by visiting the Oracle store, or contacting a salesrep in your area
    But I doubt you can redistribute the product if you aren't licensed yourself.
    Question 3 and 4 have obvious answers
    3: Even if you could this is illegal
    4: if tnsping is not included in the client, tnsping is not included in the client, and there will be no replacement.
    Tnsping only establishes whether a listener is running and shouldn't be called from an application
    Sybrand Bakker
    Senior Oracle DBA

  • 2 (Probably Simple) Accordion Widget Questions

    Hello!
    I am a video guy who tries to dive into this web design stuff
    once in a long while. Usually i can figure most stuff out by
    reading forums and stuff but this stuff if probably to obvious for
    anyone but myself to post about...
    1)When I click on the accordion spry widget on my site it is
    surrounded by a selection box (i.e. a dotted line)
    how do I get rid of this?
    2) I am unclear of how to apply effects to widgets...I have
    the SpryEffects.js file and would like to ease the animation of my
    accordion but don't know how and where to link my main page's code
    to the effect file. Where does the code for this go and in which
    file?
    Thanks,
    Steven

    Hi Steven,
    That dotted outline is the browser's focus ring that tells
    user an element on the page has keyboard focus. You can either use
    CSS to change the color so it blends with your background, or if
    you don't need keyboard navigation on your accordion, simply remove
    the tabindex attribute on the accordion's top-level div.
    For transitions, look here for an example:
    http://labs.adobe.com/technologies/spry/samples/accordion/AccordionSample.html#SettingTheT ransition
    --== Kin ==--

  • Probably a simple keyboard event question...

    I'm new to AS3 and can't figure this out...
    I want to add the function nextClip(); away from a button to the spacebar. So when I click the spacebar, it runs the nextClip();
    btnNext.addEventListener(MouseEvent.CLICK, playNext);
    function playNext(e:MouseEvent):void {
    nextClip();
    index = (index + 1)%(clips.length);
    I can figure out how to do it with any key press, but not with just the spacebar.
    function checkKeysDown(event:KeyboardEvent):void{
    nextClip();
    index = (index + 1)%(clips.length);
    Thanks in advance for any help.

    Take a look at the keyCode propoerty of a KeyboardEvent. Compare it to the Keyboard.SPACE constant. If they'er equal, the spacebar was pressed:
    import flash.events.KeyboardEvent;
    import flash.ui.Keyboard;
    stage.addEventListener(KeyboardEvent.KEY_DOWN, checkKey );
    function checkKey( event:KeyboardEvent ):void
    if( event.keyCode == Keyboard.SPACE )
    trace( "Space!" );

  • Probably simple batch resize question  :_

    Hi, I am trying to create an action to batch resize a folder of images, and when I hit Run, I am asked for the jpeg quality for every file, which defeats the purpose of creating an action.
    I am using File>Automate>Fit Image  Inputting dimensions, hitting OK, and stop recording. 
    What am I doing wrong please?

    Is the Destination > Save and Close?
    Have you tried using File > Scripts > Image Processor without any Action?

  • Simple Library Import question

    I have a simple question pertaining to importing. I am used to iPhoto where you import all pictures into your "Library" folder. However in Aperture I find that I can import into the "Library" (which in turn also puts the picture in a "Project") and also import directly into a Project which sometimes doesn't seem to include the pictures in the Library.
    My confusion is what is the point of Library then if you can import into a project? (or have I done something wrong during an import?)
    Thanks in advance!

    An image is always in exactly one project. All the images in all projects are in the library. (Folders and albums are a little more complicated, holding pointers to images, not images.)
    Highlighting "Library" in the projects panel doesn't show anything (usually). If you highlight the All Images blue Smart Album under Library, it will show all the images in all projects. If that doesn't seem to be the case, it's probably because you're filtering images. Select "Show All" in the search box at the upper right corner of the Browser. It's easy to forget this, and panic because all or most of your images seem to have disappeared.

  • Simple how to question ...

    ... here is the situation: I'm brand new to Motion ... I received footage and applied some simple lower thirds to it ... now, I received much higher resolution footage ... how can I re-use/merge/export the motion effects I created with/to the new high resolution footage?
    It is probably not the correct venue, but I'm kinda under the gun timeline wise.
    Thank you.

    Alan, brief follow-up question: I finally got the new footage (1280x720 ... oh my, so crisp!) ... I imported the elements from my first, low res project ... all good ... but now I can not move the imported elements freely ... I can move the group (the "old" project was 720 x 486) within the new canvas, but individual elements "disappear outside the old canvas dimensions ... almost like a mask has been imported, masking everything beyond the old dimensions ...
    Thanks again,
    Stephan

  • Simple JPA - JSF question

    Welcome!
    I Have simple question regarding updating JPA entities from JSF application
    One option is to directly invoke entity manager code from JSF managed bean action, but in this case we must explicitly deal with transactions (and we don't get other EJB benefits).
    Other approach is to create EJB as a stateless session bean. And delegate all the operations on entities to the EJB. In this case container create transactions for us.
    Please correct me if I wrongly understand this topic.
    My key question is how to update entity bean, which I have persiteted earlier. I assume it's illegal to issue manager .find method in EJB class, return managed entity as an object to JSF backing been and then modify it. Normally entity bean should be managed, but in this case there is no transaction support in JSF backing bean and hence we cannot modify the object directly.
    I assume that correct way is to detach entity in EJB, pass this object to JSF backing bean. In this case entity will not be managed, then edit it in JSF and finally update in EJB by .merge method.
    I assume multi-user environment (currently I am using glassfish if it does matters)
    Best regards
    Pawel

    Thanks for responding r035198x (this place has some memorable usernames :) ).
    You were absolutely right about flagging me up for not catching the exception (at the time I didn't know how to handle exceptions as im still learning). I am now using:
    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Error deleting record: "+ex.getMessage()));and am now getting the following when pressing the delete button:
    Error deleting record: Internal Exception: java.sql.SQLIntegrityConstraintViolationException: DELETE on table 'MBUSER' caused a violation of foreign key constraint 'USERPOST_OWNER_ID' for key (4). The statement has been rolled back. Error Code: -1 Call: DELETE FROM MBUSER WHERE (ID = ?) bind => [4] Query: DeleteAllQuery(name="messageboard.entity.MBUser.deleteUser" referenceClass=MBUser sql="DELETE FROM MBUSER WHERE (ID = ?)")
    This is probably getting out of the realm of JSF, but in case your interested I can delete a user which does not have any child posts or threads (this is a messageboard), but if that user owns any threads or posts then it shows the above error. At this stage I am guessing its because I am not deleting joined child objects which are in persistence, and therefore will not allow the parent to be deleted without first the children being deleted. I was hoping that the cascade tag in the @OneToMany annotation would do it for me, but that doesn't seem to be the case:
        @OneToMany(mappedBy = "owner", cascade = CascadeType.ALL)
        private List<UserPost> ownedPosts = null;
        @OneToMany(mappedBy = "owner", cascade = CascadeType.ALL)
        private List<UserThread> ownedThreads = null;Therefore I guess i'll have to construct a NamedQuery a bit more complicated than the current one im using. Still, at least im making progress :) Thanks...

  • Plzzz write prog to this simple java threads question

    Write a program in C to create four processes. The original processes creates
    two children before it prints out "PARENT". The children processes print
    "CHILD1" and "CHILD2" respectively. The first child process creates a child
    process that prints out "GRANDCHILD".
    Note: The output must be guaranteed to print out in the following order each
    time it is executed:
    GRANDCHILD
    CHILD2
    CHILD1
    PARENT
    a. Write the program using C or C++ and forks to create the children processes.
    b. Write a second program using Java and Threads for the children processes.
    The output statements for CHILD1, CHILD2 and GRANDCHILD must come from print
    statements in the run method of the thread.

    Most people here will not do your homework for you. If you post a reasonable question that shows you've made some effort, and what the results of that effort were, and provides details about what parts you're having trouble with, then somebody will probably provide guidance so that [you can complete the work.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Simple Java SDK question for server group assignment

    I have a snippet of code below in which I am trying to apply the setProcessingServerGroup() and setProcessingServerGroupChoice() methods to my report object. My question should be relatively simple: I believe I need to cast(?) my iObject report object to iProcessingServerGroupInfo per the API in order to use the setProcessingServerGroup() and setProcessingServerGroupChoice() methods, but I'm not sure how to do so.
    Can someone please advise how to cast my iObject to iProcessingServerGroupInfo?
    Thanks in advance...
    Code:
    IInfoObject iObject = (IInfoObject) childReports.get(i); 
    int sgID_view = Integer.parseInt(serverGroupID_view);
    int sgPref_view = Integer.parseInt(serverGroupPref_view);
    !!!!!  CONVERSION / CAST NEEDED HERE !!!!!
    iProcessingServerGroupInfo.setProcessingServerGroup(sgID_view);
    iProcessingServerGroupInfo.setProcessingServerGroupChoice(sgPref_view);

    To followup, I've been able to cast to IShedulingInfo in order to use the setServerGroup() and setServerGroupChoice() methods successfully:
    IInfoObject iObject = (IInfoObject) iObjects.get(i);    
    ISchedulingInfo iSchedulingInfo = iObject.getSchedulingInfo();
    iSchedulingInfo.setServerGroup(427);
    iSchedulingInfo.setServerGroupChoice(2);
    But I don't know how to perform the cast to be able to access the setProcessingServerGroup(), sterProcessingServerGroupChoice() methods.
    Any help appreciated.
    Thanks!

Maybe you are looking for

  • Underlining a digit in jFormatted Text Field

    Let me rephrase a question a I asked yesterday now that I've learned more.. I want to allow the user to click on a digit in a FormattedTextField and have that digit underlined. (buttons then inc or dec the digit value). I tried changing the default C

  • A very simple question about WF

    hi experts I would like to ask a question about workflow as u may know there is 'Loop' step in workflow, but I am confused when should I use Loop? Is this step used for processing internal table?  if yes, why shouldn't I create a custom BOR method an

  • How to create an account without a credit card

    Does anyone know how to create an account without using a credit card?

  • Drop tablespace in Oracle 8i

    I want to know how to drop tablespace in Oracle 8i. Actually i read on internet that we cannot drop tablespace in oracle 8i. Is that true? How can i drop the tablespace in 8i? Thanks,

  • Trying to download trial version essbase--Please help

    We'd like to use this for our company; supposedly analysts can manage this vs. an IT dept. However I'm not finding this to be the case. I'm a good financial analyst but can't download and install this essbase trial version for s@@t!! Please, I now ca