Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: SQLLoader Newbie: using constant function

Re: SQLLoader Newbie: using constant function

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Thu, 12 Aug 1999 11:00:25 GMT
Message-ID: <37b3a913.58632188@newshost.us.oracle.com>


A copy of this was sent to oliver <oliver_at_agyinc.com> (if that email address didn't require changing) On Wed, 11 Aug 1999 18:01:35 +0100, you wrote:

>Hi,
>
>I am try to insert a constant number (0) into one column of the table
>when I use SQLLOADER to loader data into a table. Can anyone give me a
>clue what should I, or an sample code.
>
>The explanation of CONSTANT function in Oracle online documentation is
>very confuse. I can not find the sample of using this function. What
>is the proper place to check out?
>
>Thanks for your reply

it is simply:

column_name CONSTANT value

for example:

SQL> create table t ( d int, input varchar2(25) ); Table created.

SQL> !cat test.ctl
LOAD DATA
INFILE *
INTO TABLE T
REPLACE
( d CONSTANT 5,
 input position(1:6)
)
BEGINDATA
250301
290101
301020
311020
990112
000423
010530

SQL> !sqlldr tkyte/tkyte test.ctl
SQL*Loader: Release 8.0.3.0.0 - Production on Thu Aug 12 6:54:21 1999 (c) Copyright 1997 Oracle Corporation. All rights reserved. Commit point reached - logical record count 7

SQL> select * from t;

         D INPUT

---------- -------------------------
         5 250301
         5 290101
         5 301020
         5 311020
         5 990112
         5 000423
         5 010530

7 rows selected.

That loaded the constant 5 into D for every row loaded by sqlldr.

--
See http://govt.us.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'... Current article is "Part I of V, Autonomous Transactions" updated June 21'st  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA

Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Thu Aug 12 1999 - 06:00:25 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US