How do i map one field to another in control file via SQL Loader

Can someone please reply back to this question
Hi,
I have a flat file (student.dat delimiter %~| ) using control file (student.ctl) through sql loader. Here are the details.
student.dat
student_id, student_firstname, gender, student_lastName, student_newId
101%~|abc%~|F %~|xyz%~|110%~|
Corresponding table
Student (
Student_ID,
Student_FN,
Gender,
Student_LN
Question:
How do i map student_newId field to student_id field in STUDENT DB table so that new id should be inserted in student_id column. How do i specify the mapping in control file. I dont want to create a new column in student table. Please let me know the best way to do this.
Can someone please reply back to this question.
My approach:
In control file i will sepecify the below, Is this a best approach?. Do we have any othe way?
STUDENT_ID *(:STUDENT_NEWID)*,
STUDENT_FN,
GENDER,
STUDENT_LNAME,
STUDENT_NEWID BOUNDFILLER
Thanks
Sunil
Edited by: 993112 on Mar 13, 2013 12:28 AM
Edited by: 993112 on Mar 13, 2013 12:30 AM
Edited by: 993112 on Mar 13, 2013 12:31 AM
Edited by: 993112 on Mar 18, 2013 2:52 AM

OK, ok...
Here is the sample data:
101%~|abc%~|F %~|xyz%~|110%~|
102%~|def%~|M %~|pqr%~|120%~|
103%~|ghi%~|M %~|stu%~|130%~|
104%~|jkl%~|F %~|vwx%~|140%~|
105%~|mno%~|F %~|yza%~|150%~|Here is the control file:
LOAD DATA
INFILE student.dat
TRUNCATE INTO TABLE STUDENT
FIELDS TERMINATED BY '%~|' TRAILING NULLCOLS
  student_old  FILLER
, student_fn
, gender
, student_ln
, student_id
)And here is the execution:
SQL> CREATE TABLE student
  2  (
  3    student_id   NUMBER
  4  , student_fn   VARCHAR2 (10)
  5  , gender       VARCHAR2 (2)
  6  , student_ln   VARCHAR2 (10)
  7  );
Table created.
SQL>
SQL> !sqlldr / control=student.ctl
SQL*Loader: Release 11.2.0.3.0 - Production on Tue Mar 19 14:37:31 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
Commit point reached - logical record count 5
SQL> select * from student;
STUDENT_ID STUDENT_FN                     GENDER STUDENT_LN
       110 abc                            F      xyz
       120 def                            M      pqr
       130 ghi                            M      stu
       140 jkl                            F      vwx
       150 mno                            F      yza
SQL>:p

Similar Messages

  • Can I have two Data Files in One control file of sql*loader tool

    hi,
    Can someone help me out. is it possible to have two Data Files in one control file of Sql*loader.
    And isit possible to run 10,000 records before lunch and 10,000 records before tea and 10,000 records before evening session by giving breaks after every 10,000 records.
    Thanks
    Ram

    Yes. You can specify two datafiles in one control file and can load using sql loader.
    I give you the sample control file.
    Load DATA
    INFILE 'TEST1.CSV'
    INFILE 'TEST2.CSV'
    TRUNCATE
    INTO TABLE TEST_P
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    (COL_1,
    COL_2,
    COL_n)
    Hope It will help you.
    -Karthik

  • Adobe Bridge CC : metadata copy from one field to another for multiple files

    So I am using Bridge CC for managing audio files and have many many MP3's that I need to copy or move one field of metadata to another.
    ie:  copy "Audio Artist" field to "IPTC Core Creator" Field
         move "IPTC Core Description" to "Video Log Comment" field
    Is there a script I can add that will let me select multiple files, and have it copy or move all the info from one of these fields to another?
    Thanks
    Scott
    [email protected]

    Scott, I did have a go at this but I can't get the right path to the logComment in the XMP…
    Coping artist to creator works fine… If I find the solution I will post back…

  • How do I skip footer records in Data file through control file of sql*loade

    hi,
    I am using sql*loader to load data from data file and i have written control file for it. How do i skip last '5' records of data file or the footer records to be skiped to read.
    For first '5' records to be skiped we can use "skip" to achieve it but how do i acheive for last '5' records.
    2)
    Can I mention two data files in one control file if so what is the syntax(like we give INFILE Where we mention the path of data file can i mention two data file in same control file)
    3)
    If i have datafile with variable length (ie 1st record with 200 charcter, 2nd with 150 character and 3rd with 180 character) then how do i load data into table, i mean what will be the syntax for it in control file.
    4)if i want to insert sysdate into table through control file how do i do it.
    5) If i have variable length records in data file and i have first name then white space between then and then last name, how do i insert this value which includes first name and last name into single column of the table.( i mean how do you handle the white space in between first name and last name in data file)
    Thanks in advance
    ram

    You should read the documentation about SQL*Loader.

  • How to pass value to a control file in sql loader

    Hello
    please want to know if i can pass a value to a control file?
    I have a table which i will populate using a control file but there is a field in the table which i will pass the date of the file.
    how can i archive this
    Thanks
    Edited by: kama021 on Apr 18, 2012 3:49 AM

    The content of the control file must be made dynamically to include desired value.
    Handle:     kama021
    Status Level:     Newbie
    Registered:     Jun 9, 2009
    Total Posts:     154
    Total Questions:     42 (25 unresolved)
    Why so many unanswered questions?
    Edited by: sb92075 on Apr 18, 2012 6:34 AM

  • How do we map one R3 field to two bw objects in BW 35?

    How do we map one R3 field to two infoobjects in an infosource at transfer structure level.
    For example: KUNNR field from R3 needs to be mapped to two different bw objects in transfer structure level.

    Nop you got it wrong :
    KUNNR --> 0CUSTOMER
    0SOLD_TO     <--- 0CUSTOMER
    0CUSTOMER <-- 0CUSTOMER
    or
    KUNNR --> 0SOLD_TO
    0SOLD_TO    <-- 0SOLD_TO
    0CUSTOMER <-- 0SOLD_TO
    This is the way.
    Hope this helps.
    Edited by: Praveen G on Sep 30, 2008 1:51 AM
    Edited by: Praveen G on Sep 30, 2008 1:52 AM

  • How do I swap one clip for another in Final Cut Pro 7?

    How do I sway one clip for another in Final Cut Pro 7? I am doing what it says in a book but it is not working. Thanks.

    You drag the clip from the browser to the clip on the timeline. Wait till the timeline clip goes white. Drop it and pick from the menu that appears the replace option you want.

  • My slide presentation (with sound) is done. How can I change one song from another?

    My slide presentation (with songs) is done. How can I change one song from another?

    Do you still have your Aperture Slideshow project? Then open the slideshow and select the one of the green audio file clips in the film strip that you want to replace. Press the "delete" key and drag another audio file from the Media Browser directly onto the slide, where the sound should start.

  • Select a number of fields between one field and another

    Hello,
    Is there any way to make a SELECT to show a number of fields between one field and another,
    without writting all the fields one by one ?
    For example, I have one table with these fields:
    TABLE EMPLOYEE:
    ID_EMPLOYEE NAME PHONE CAR AGE MARRIED
    and I just want to make a SELECT who shows only fields from NAME to AGE, but i don't want to
    write in the SELECT all the fields one by one.
    Is this possible?
    Thank you very much.
    Sorry for my english it's not very good.

    Swam wrote:
    Hello,
    Is there any way to make a SELECT to show a number of fields between one field and another,
    without writting all the fields one by one ?
    For example, I have one table with these fields:
    TABLE EMPLOYEE:
    ID_EMPLOYEE NAME PHONE CAR AGE MARRIED
    and I just want to make a SELECT who shows only fields from NAME to AGE, but i don't want to
    write in the SELECT all the fields one by one.
    Is this possible?
    Thank you very much.
    Sorry for my english it's not very good.If you use the DBMS_SQL package to execute your query you can reference the columns by position rather than name.
    One examples of using DBMS_SQL package:
    SQL> ed
    Wrote file afiedt.buf
      1  DECLARE
      2    cur       PLS_INTEGER := DBMS_SQL.OPEN_CURSOR;
      3    cols      DBMS_SQL.DESC_TAB;
      4    ncols     PLS_INTEGER;
      5    v_min_col NUMBER := 2;
      6    v_max_col NUMBER := 4;
      7    v_val     VARCHAR2(4000);
      8    v_bindval VARCHAR2(4000);
      9    v_ret     NUMBER;
    10    d         NUMBER;
    11  BEGIN
    12    -- Parse the query.
    13    DBMS_SQL.PARSE(cur, 'SELECT * FROM emp', DBMS_SQL.NATIVE);
    14    -- Retrieve column information
    15    DBMS_SQL.DESCRIBE_COLUMNS (cur, ncols, cols);
    16    -- Display each of the column names and bind variables too
    17    FOR colind IN v_min_col..v_max_col
    18    LOOP
    19      DBMS_OUTPUT.PUT_LINE ('Column:'||colind||' : '||cols(colind).col_name);
    20      DBMS_SQL.DEFINE_COLUMN(cur,colind,v_bindval,4000);
    21    END LOOP;
    22    -- Display data for those columns
    23    d := DBMS_SQL.EXECUTE(cur);
    24    LOOP
    25      v_ret := DBMS_SQL.FETCH_ROWS(cur);
    26      v_val := NULL;
    27      EXIT WHEN v_ret = 0;
    28      FOR colind in v_min_col..v_max_col
    29      LOOP
    30        DBMS_SQL.COLUMN_VALUE(cur,colind,v_bindval);
    31        v_val := LTRIM(v_val||','||v_bindval,',');
    32      END LOOP;
    33      DBMS_OUTPUT.PUT_LINE(v_val);
    34    END LOOP;
    35    DBMS_SQL.CLOSE_CURSOR (cur);
    36* END;
    SQL> /
    Column:2 : ENAME
    Column:3 : JOB
    Column:4 : MGR
    SMITH,CLERK,7902
    ALLEN,SALESMAN,7698
    WARD,SALESMAN,7698
    JONES,MANAGER,7839
    MARTIN,SALESMAN,7698
    BLAKE,MANAGER,7839
    CLARK,MANAGER,7839
    SCOTT,ANALYST,7566
    KING,PRESIDENT,
    TURNER,SALESMAN,7698
    ADAMS,CLERK,7788
    JAMES,CLERK,7698
    FORD,ANALYST,7566
    MILLER,CLERK,7782
    PL/SQL procedure successfully completed.
    SQL>Of course, if you were going to do this properly you would bind the correct datatypes of variables based on the types of the columns (the type information is also available through the describe information)

  • HT3529 How do I disconnect one iphone from another iphone's iMessage?

    How do I disconnect one iphone from another iphone's iMessage?

    He needs to get his own Apple ID.
    Have him logout from your Apple ID at settings>>iCloud .
    He should then set up his own Apple ID.

  • How do I copy one image onto another image?

    How do I copy one image onto another image?

    Lots of ways;  Use the Place command to place a file in another.  Open two files and drag one to the other's window tab, drag an image from bridge onto an open file.  Open an image, press ctrl/cmd-A to select all, the ctrl/com-C to copy the image, the ctrl/cmd-V to paste it into another image.

  • How to integration between one model to another model

    hi friends
    can any one explain me
    how to integration between one model to another model 
    ex:- i have sales model 1 and  i have anther model finance model how to changes  in figures in sales model as well same change are happen in finance model how it possibly please explain me friends   
    and how many ways i can do this ?
    Thank you
    suresh m

    Hi Suresh,
    If you do changes in Finance and want to send data in Sales , you can use LOOKUP /DESTIANTION_APP -script logic or ABAP logic.
    To have seamless flow, you need to take care of security.
    Explain your requirement in  more detail .
    May be helpful .
    Shrikant

  • HOW TO MOVE FROM ONE JSP TO ANOTHER BY HIDING URL CHANGES

    HOW TO MOVE FROM ONE JSP TO ANOTHER BY HIDING URL CHANGES IN AN ADDRESS BAR

    Please check before posting that you have not accidentally turned on the CAPS LOCK feature of your keyboard.
    To answer your question. You can't do that. There are alterate ways to solve this sort of problem. What exactly is the nature of the problem you are seeking to solve?

  • How to skip from one list to another list in interactive report?

    Hi Friends,
    How to skip from one list to another list in interactive report that means now i am in 7 th list how to skip 4th list ?
    Or  now i am in 7 th list how to skip 9th list ?
    can anybody send sample code please.
    Thanks in advance.

    hi,
    at line-selection.
    case sy-lsind.
    when 9.
    sylsind = 4.
    endcase.
    try like this when u r in 9th list next it goes to 4 th list

  • How GroupArt remove from one layer to another.

    hi all,
    How GroupArt move from one layer to another.
    Thanks in advance.

    Hi Vijay,
    1) To add new events you have to define a custom action, e.g. under the settings of a button you can choose custom action and define a name for this action
    2) You have to add a custom action, e.g. "next" then you must connect the two layers (drag a line from one layer to the other) and change the event name into "next"
    3) you can pass data from one layer to another like you do it from a form into a rfc/query and so on
    There is also a tutorila available in the help:
    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/04/80aab03df044ec995000842e77e1be/frameset.htm">http://help.sap.com/saphelp_nw2004s/helpdata/en/04/80aab03df044ec995000842e77e1be/frameset.htm</a>
    The bank example shows you how to use layers as a wizzard.
    Best Regards,
    Marcel

Maybe you are looking for

  • How can i Migrate from EJB Application to Hibernate

    Hi , i have developed web services using EJBs. can i create web services for my hybernate application. can anybody please help me for that?? please advice me how can i Migrate from my EJB Apps to Hibernate. thanks & Regards, nagalaxmi

  • Real Time Screen Updation in the Front End

    I working for a banking sector, My requirement is that, there is a screen which stays open 24 hours 365 days , there are some database changes happening in the backend , the data needs to get refreshed in the page without actually clicking any refesh

  • Create new tab in header using badi ME_GUI_PO_CUST for tcode ME21N

    Dear all, i have implemented method SUBSCRIBE in ME_GUI_PO_CUST to create new tab in ME21N, but the tab is not coming following is the code snips, please tell where is the error, or some setting needs to be done method IF_EX_ME_GUI_PO_CUST~SUBSCRIBE.

  • FI master data in HR system

    hi, is it necessary to have FI master data (GL a/c, chart of acct, fsv, etc) in HR system to integrate HR - FI? Both are on different systems. appreciate immediate reply Thanks

  • Event handling for UIImageView inside UIScrollView

    Hi, I have a UIScrollVIew. I added a UIImageView inside it. I found that UIImageView did not reveive any events. No matter what I do, there is only image zoom in out and flip. How can I enable UIImageVew to receive some events? Thanks, fm