sqlloader question
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 6 of 6

Thread: sqlloader question

  1. #1
    Join Date
    Mar 2002
    Posts
    301

    sqlloader question

    I've 2 columns in my data file: A1, A2.
    I want to insert the contents in a table wich h've as Primary Key: A1,A2 and B3.
    I want in the control file to insert a default value for column B3.
    How can i do?

    Thank's

  2. #2
    Join Date
    Dec 2002
    Location
    Bangalore ( India )
    Posts
    2,434
    instead why dont you define a default for the column?
    funky...

    "I Dont Want To Follow A Path, I would Rather Go Where There Is No Path And Leave A Trail."

    "Ego is the worst thing many have, try to overcome it & you will be the best, if not good, person on this earth"

  3. #3
    Join Date
    Mar 2002
    Posts
    301
    I can't add default value for this column, cause B3 is a year value. every year, we load data with the current year. So if we make default in table level.... it'll not work.

    Is there no default value in the Load data clause?

  4. #4
    Join Date
    Apr 2001
    Location
    Bangalore, India
    Posts
    727
    Code:
    SQL> create table t (year number default  to_char(sysdate,'yyyy'),
      2  name varchar(2));
    
    Table created.
    
    SQL> insert into t (name) values ('Th');
    
    1 row created.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> select * from t;
    
          YEAR NA
    ---------- --
          2004 Th
    Thomas Saviour(royxavier@yahoo.com)
    Technical Lead (Databases)
    Thomson Reuters (Markets)

    http://ora600tom.wordpress.com/

  5. #5
    Join Date
    Dec 2002
    Location
    Bangalore ( India )
    Posts
    2,434
    Originally posted by bensmail
    I can't add default value for this column, cause B3 is a year value. every year, we load data with the current year. So if we make default in table level.... it'll not work.
    Why cant you set default.. you can do just by

    Trunc(Sysdate, 'YEAR')

    Abhay.
    funky...

    "I Dont Want To Follow A Path, I would Rather Go Where There Is No Path And Leave A Trail."

    "Ego is the worst thing many have, try to overcome it & you will be the best, if not good, person on this earth"

  6. #6
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439

    Re: sqlloader question

    Originally posted by bensmail
    I want in the control file to insert a default value for column B3.
    How can i do?
    Use SQL*Loader's control file parameter CONSTANT.

    http://download-west.oracle.com/docs...06.htm#1008262
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width