Sponsored Content
Full Discussion: Korn Shell and Oracle
Top Forums Shell Programming and Scripting Korn Shell and Oracle Post 302286910 by curleb on Thursday 12th of February 2009 09:50:20 AM
Old 02-12-2009
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

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Oracle To Korn Shell Array

I'm attempting to populate an array in ksh using the following command: set -A $(SELECT_INVOICE | sed '/^$/d') SELECT_INVOICE is a function that executes the SQL query. Problem: Some of the invoice numbers have alpha characters with spaces(example: OVEN MICRO). The Korn shell is treating... (1 Reply)
Discussion started by: kdst
1 Replies

2. UNIX for Dummies Questions & Answers

Executing Oracle Stored Procs from Korn Shell

Can someone tell me how to execute an Oracle Stored Procedure from a Korn Shell Script. Previously, I'm able to execute standard sql using the following:- The_Output=`sqlplus................. << EOF select count(*) from abc / ... (3 Replies)
Discussion started by: Vinny_Mitchell
3 Replies

3. Shell Programming and Scripting

KORN Shell - Spawn new shell with commands

I want to be able to run a script on one server, that will spawn another shell which runs some commands on another server.. I have seen some code that may help - but I cant get it working as below: spawn /usr/bin/ksh send "telnet x <port_no>\r" expect "Enter command: " send "LOGIN:x:x;... (2 Replies)
Discussion started by: frustrated1
2 Replies

4. Shell Programming and Scripting

how to convert from korn shell to normal shell with this code?

well i have this code here..and it works fine in kornshell.. #!/bin/ksh home=c:/..../ input=$1 sed '1,3d' $input > $1.out line="" cat $1.out | while read a do line="$line $a" done echo $line > $1 rm $1.out however...now i want it just in normal sh mode..how to convert this?... (21 Replies)
Discussion started by: forevercalz
21 Replies

5. UNIX for Advanced & Expert Users

Need Help for Using Oracle Cursors in Shell Script Korn

Hi, My Oracle Stored procedure returns sys_refcursor to shell script. I have to iterate through it in script and use those retrieved values further in my script. I am using K Shell Scrpting. Stored Procedure is: create or replace PROCEDURE p_test(job_id IN VARCHAR2, c1 OUT SYS_REFCURSOR)... (0 Replies)
Discussion started by: rajeshorpu
0 Replies

6. Shell Programming and Scripting

How to activate Korn Shell functionnalities in Bourne Shell

Hi All I have writing a Korn Shell script to execute it on many of our servers. But some servers don't have Korn Shell installed, they use Borne Shell. Some operations like calculation don't work : cat ${file1} | tail -$((${num1}-${num2})) > ${file2} Is it possible to activate Korn Shell... (3 Replies)
Discussion started by: madmat
3 Replies

7. Shell Programming and Scripting

Korn shell program to parse CSV text file and insert values into Oracle database

Enclosed is comma separated text file. I need to write a korn shell program that will parse the text file and insert the values into Oracle database. I need to write the korn shell program on Red Hat Enterprise Linux server. Oracle database is 10g. (15 Replies)
Discussion started by: shellguy
15 Replies

8. Shell Programming and Scripting

Bourne shell & Korn shell

Could some one tell me the difference btw Bourne shell and the Kshell? Which is more flexible and reliable in terms of portability and efficiency. When i type the following command .. $ echo $SHELL yields me /bin/sh Does this tells me that I am in Bourne shell. If yes, how can i get... (6 Replies)
Discussion started by: bobby1015
6 Replies

9. Shell Programming and Scripting

Korn Script to connect and query oracle database

I've been sent the following script to finish. It's supposed to connect to an oracle database, query it, and send an email if the query result value is one or more. Currently it isn't connecting properly, just giving the following error: ERROR: ORA-01017: invalid username/password; logon denied... (2 Replies)
Discussion started by: jackmorgan2007
2 Replies

10. Programming

pass value from Oracle sql to Korn shell

Hi All , I am trying to pass a value from sqlplus to korn shell . There is a table tab1 in Oracle that has a column userdate. I need to pass the userdate to the korn shell . This is what I am doing . VALUE=`sqlplus -silent username/password << END set pagesize 0 feedback off verify off... (14 Replies)
Discussion started by: megha2525
14 Replies
DBIx::Class::Schema::Loader::DBObject::Sybase(3pm)	User Contributed Perl Documentation	DBIx::Class::Schema::Loader::DBObject::Sybase(3pm)

NAME
DBIx::Class::Schema::Loader::DBObject::Sybase - Class for Database Objects for Sybase ASE and MSSQL Such as Tables and Views in DBIx::Class::Schema::Loader DESCRIPTION
This is a subclass of DBIx::Class::Schema::Loader::DBObject that adds support for fully qualified objects in Sybase ASE and MSSQL including both "database" and schema of the form: database.owner.object_name METHODS
database The database name this object belongs to. Returns undef if ignore_schema is set. sql_name Returns the properly quoted full identifier with "database", schema and name. SEE ALSO
DBIx::Class::Schema::Loader::Table::Sybase, DBIx::Class::Schema::Loader::DBObject, DBIx::Class::Schema::Loader::Table, DBIx::Class::Schema::Loader, DBIx::Class::Schema::Loader::Base AUTHOR
See "AUTHOR" in DBIx::Class::Schema::Loader and "CONTRIBUTORS" in DBIx::Class::Schema::Loader. LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-05-05 DBIx::Class::Schema::Loader::DBObject::Sybase(3pm)
All times are GMT -4. The time now is 11:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy