- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- passing variable to sql loader files
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-27-2008 02:39 AM
тАО03-27-2008 02:39 AM
passing variable to sql loader files
I would like to know if we can pass a variable from a shell script to an sql loader control file.
I know we can pass a variable to an sql file from unix shell but not sure if this is possible in sql loaders
Regards,
Gyan
- Tags:
- variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-27-2008 02:46 AM
тАО03-27-2008 02:46 AM
Re: passing variable to sql loader files
echo "some_cmd $VAR1 $VAR2" | sql_loader
or from a here document:
cat << EOF
some_cmd $VAR1 $VAR2
EOF
The here document is easier to use for multiple lines for the loader.
Bill Hassell, sysadmin
- Tags:
- here doc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-27-2008 02:50 AM
тАО03-27-2008 02:50 AM
Re: passing variable to sql loader files
The SQLLDR control file is just a static flat file, you cannot really pass a parameter to that file. Especially when the latter is used by the SQLLDR tool.
You can try to generate the SQLLDR file on-the-fly based on variables input to custom generator script.
If you have anything specific, we can post it here so that we can further assist you.
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-27-2008 03:07 AM
тАО03-27-2008 03:07 AM
Re: passing variable to sql loader files
and in the control file we need use it like this
delete from table where exists (select 1 from table where region_code='$region')
.....
Regards,
Gyan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-27-2008 03:40 AM
тАО03-27-2008 03:40 AM
Re: passing variable to sql loader files
This is a bit confusing. Normally, a SQLLDR control file looks as follows:
LOAD DATA
DISCARDMAX 999
APPEND
INTO TABLE MYTAB130
(
LDRDATE "sysdate",
REGION CONSTANT 'PHX',
STATION "1",
WRKLINE position(1:80) char(80) "rtrim(:WRKLINE)"
)
Will it be possible to post a complete file?
revert!
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-27-2008 04:17 AM
тАО03-27-2008 04:17 AM
Re: passing variable to sql loader files
if i see your the above code,it is mentioned like
APPEND
INTO TABLE MYTAB130
instead of appending in the table MYTAB130,we need to delete records like
delete from MYTAB130 where exists (select 1 from someother table where region='$region') and the rest would continue.
(
LDRDATE "sysdate",
REGION CONSTANT 'PHX',
STATION "1",
WRKLINE position(1:80) char(80) "rtrim(:WRKLINE)"
)
I am yet to write such a file.
Regards,
gyan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-27-2008 04:42 AM
тАО03-27-2008 04:42 AM
Re: passing variable to sql loader files
Unfortunately, SQLLDR has a rather restrictive syntax. The possible operations on the underlying table are only: INSERT, APPEND, REPLACE, TRUNCATE.
You may wish to have a look at the High-Level Syntax Diagrams concerning SQLLDR which are found at:
http://download-west.oracle.com/docs/cd/A87860_01/doc/server.817/a76955/ch05.htm#1261
Can you please describe what you are trying to achieve?
hope this helps!
kind regards
yogeeraj