This content has been marked as final. Show 8 replies
1 person found this helpful
Also, could these variables be used in the sql*loader control file?NO!
sounds like you want to source the variables (which is exactly what setting up the ALPHABETS in your profile did).1 person found this helpful
So, from the script that decides what the paths are, you would call the other shell scripts with a '.' before them (after you have set the paths)
( . /my/script/path/srcipt_name)
that will give the script that is being called the same environment as the one calling it.
using EXPORT just sets the variable for that session/script.
of course this will only work if you can use one script to set the paths and call the others from that one.
I suppose another solution might be setting those paths in a config file that all the other scripts can use?
You can create a main shell script , call the export environments and sql loader command inside.
using EXPORT just sets the variable for that session/script.WRONG!
"export" provides/allows any child process/script to inherit the variable
remains local to current script
848265 wrote:We put all our "global" variables in a script called locvars. Every other script we write has the line
I have been using export command to declare variables for setting up the log folder path, data directory path, archive folder path, scripts folder path etc. in my shell scripts. E.g.
However, these variables with the same paths are used in multiple scripts, and with a small change in directory structure I have to reflect the changes across all the shell scripts. I would like to assign these variables as a global variables and want to maintain them at a single place, so that if any change comes I have to make ammendments at a single place rather than across all the files.
export datadir=(path1) export archive=(path2) export logs=(path3)
For example, I have aliased some routinely used directory path with ALPHABETS in my .profile, and whenever I log on to the session I run . .profile and then just have to type in those aliased alphabets to reach those directory paths. And in case any folder structure changes I have to make a change in .profile file only.
I need a solution something like this, I am litlle new to shell programming. Have googled how to declare kind of global variables in a shell script, but could'n get to the right link.
Also, could these variables be used in the sql*loader control file?
Note, that is dot, space, /usr/local/bin/locvars
I have used another shell script where in I declared all the paths that I need in the current script. Everything is running fine, however, it is failing at the sql*loader calling statement. Below is the code snippet and the error coming.
I did an echo of the $control_files before this sql*loader calling as well, and its returning correct path.
sqlldr userid=username@DB/password \ control=$control_files/nc_cntrol.ctl \ log=$control_files/nc_cntrol.log \ discard=$control_files/nc_cntrol.dis \ errors=50
But everytime when I run, its failing at this point.
The error capture in the logs is
Is it that we cannot use variables in sql*loader call statements?
LRM-00116: syntax error at '=' following '=' SQL*Loader-100: Syntax error on command-line
It was a typo mistake I made in my shell script where in I declared all the variables.
As someone said in one of the replies that you cannot use variables in a sql*loader script, please note that YOU CAN use.
Everything is running fine now.