The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 02-12-2009
curleb curleb is offline
Registered User
  
 

Join Date: Mar 2008
Location: Here, in my Ivory Tower...
Posts: 68
Your table would need to exist before attempting to load it. SQL*Loader doesn't do this. You would create this in SQL*Plus, etc.

Otherwise, using a pipe-delimited file for example:

Control File:

Code:
load data infile '/opt/axs/dbgora/ctron/data/useraudt/userupld' 
replace into table 
      CTRONRPT.TUSERFILE3 
fields terminated by "|" optionally enclosed by '"' 
     (USER_ID                    , 
      USER_NAME                  , 
      OPEN_FILENAME              , 
      OPEN_LIBRARY               , 
      OPEN_VOLUME                , 
      WO_INTERFACE               , 
      OPERATOR_LEVEL             , 
      SECURITY_LEVEL             , 
      PRINT_CLASS                , 
      PRINT_MODE                 , 
      PRINTER_NUM                , 
      AD_COMPANY_SW              , 
      AD_COMPANY_0               , 
      AD_COMPANY_1               , 
      AD_COMPANY_2               , 
      AD_COMPANY_3               , 
      AD_COMPANY_4               , 
      AD_COMPANY_5               , 
      AD_COMPANY_6               , 
      AD_COMPANY_7               , 
      AD_COMPANY_8               , 
      AD_COMPANY_9               , 
      CORPORATE_SW               , 
      PAGE_SIZE_ADDER            , 
      LOGOFF_TIME_INTERVAL_MIN   , 
      GROUP_CODE                 , 
      PASSWORD                   , 
      PRINTER_TOP_MARGIN         , 
      GUEST_ID                   , 
      GUEST_PASSWORD             , 
      REFRESH_CACHE_SW           , 
      USER_DEFINED_AREA          )
Script snippet:

Code:
#  Run SQL*Loader utility to replace ctronrpt.tuserfile3 table... 
   sqlldr                   \
      userid=${my_userparm} \
      control=${my_control} \
      data=${my_datfile}    \
      silent=${my_silence}  \
      log=${my_logfile}     \
      bad=${my_badfile}                                      >>${MY_LOG} 2>&1 

#  Confirm results via return code... 
   retcode=$(echo ${?} ) 

   case ${retcode} in 

      0) 
         print "\n\t\tSQL*Loader execution successful " 
         ;; 

      1) 
         print "\n\t\tSQL*Loader execution exited with EX_FAIL, see ${my_logfile} " 
         ;; 

      2) 
         print "\n\t\tSQL*Loader exectuion exited with EX_WARN, see ${my_logfile} " 
         ;; 

      3) 
         print "\n\t\tSQL*Loader execution encountered a fatal error " 
         ;; 

      *) 
         #  Huh...? 
         print "\n ===\n\n ${my_name}: $(date) "             |tee -a ${MY_LOG} 
         print "\n\t${retcode} not valid recognized..."      |tee -a ${MY_LOG} 
         print "\n\t                                  "      |tee -a ${MY_LOG} 
         print "\n\tReturned:  ${retcode} ${*} \n"           |tee -a ${MY_LOG} 
         logger_heads ; return 2 
         ;; 

   esac                                                      >>${MY_LOG} 2>&1