Sponsored Content
Top Forums Shell Programming and Scripting passing parameters from a shell script to sqlplus Post 66369 by andyl on Sunday 13th of March 2005 07:41:09 PM
Old 03-13-2005
First time i've replied. Normally loiter.

Phani:
This worked for me when I was doing something similar. Used '.' to terminate variable names.

Hope this helps

Andrew

define Org_Unit = "&1"
define Year_Code = "&2"
define Semesters = "&3"
define Unit_Cd = "&4"
define Unit_Location_Cd = "&5"
define Unit_Class = "&6"
define fileroot = "Q:\ELUP\20030318\"

host "IF NOT exist &fileroot.&Org_Unit. mkdir &fileroot.&Org_Unit."
prompt &fileroot.&Org_Unit.\&Year_Code._&Unit_Cd._&Semesters._&Unit_Location_Cd.&Unit_Class..csv
spool &fileroot.&Org_Unit.\&Year_Code._&Unit_Cd._&Semesters._&Unit_Location_Cd.&Unit_Class..csv

Same with variable values
( CAL_INSTANCE1.CAL_TYPE = 'ACAD-YR' AND CAL_INSTANCE1.ALTERNATE_CODE = '&Year_Code.' )

Last edited by andyl; 03-13-2005 at 08:55 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to pass Shell variables to sqlplus use them as parameters

Hi, I am trying to pass some of the variables in my shell scripts to the sqlplus call and use them as parameters. For example, I would like to replace the 'SAS', and '20050612' with $var1 and $var2, respectively, how can I do that? --------------------------------------------------------... (1 Reply)
Discussion started by: Jtrinh
1 Replies

2. Programming

Passing Parameters and getting values back from a c program to Shell script

I am having a shell script which has to be called from a C program. I have to pass two parameters to this script. HOw can I do that? eg: int main() { char st1; char str2; // call a shell script call_sh(str1,str2) where call_sh is the name of the shell script. then i need to get the return... (5 Replies)
Discussion started by: Rajeshsu
5 Replies

3. Shell Programming and Scripting

help me in sending parameters from sqlplus script to unix shell script

Can anybody help me out in sending parameters from sql*plus script to unix shell script without using flat files.. Initially in a shell script i will call sql*plus and after getting some value from some tables, i want that variable value in unix shell script. How can i do this? Please tell me... (2 Replies)
Discussion started by: Hara
2 Replies

4. Shell Programming and Scripting

error in passing a variable to sqlplus from a shell script

hi, I am using a shell script from where i will be conecting to sqlplus.. i am having a problem in passing a variable to sqlplus query.. i will be assigning the variable in the unix environment..whenever i am trying to pass a variable having the contents greater than 2500 characters, i am... (3 Replies)
Discussion started by: kripssmart
3 Replies

5. Shell Programming and Scripting

Passing parameters to Shell script for GREP command

I am using grep to capture date from a file . Since i need to use the shell script for different dates ,is it possible to pass the date parameter to the shell script the Script is as below grep -E "08 Aug 2008|2008-08-08"* somefile.txt>test.txt The above script file greps the... (1 Reply)
Discussion started by: sud.tech
1 Replies

6. Shell Programming and Scripting

Shell Script Passing Parameters For Directory Listing

i have this basic piece of code that i am trying to debug to accept input parameter to be able to display a directory listing of files. cd /u02/app/eatv/dev/out CURDIR=`pwd` echo directory listing of $CURDIR echo if ; then ls -latr else ls -latr $1 fi basically if the script... (9 Replies)
Discussion started by: wtolentino
9 Replies

7. Shell Programming and Scripting

specified path name is too long passing parameters to awk via shell script

Hello, I have this shell script that runs awk code by passing in parameters however now it doesn't work anymore with the parameters and I don't know why. It removes duplicates from an input file based on a part of the last field and a key column. It removes the record with the older datetime... (0 Replies)
Discussion started by: script_op2a
0 Replies

8. Shell Programming and Scripting

Can't get shell parameters to pass properly to sqlplus

Gurus, The issue I'm having is that my Shell won't accept SQL parameters properly...... Here's they way I'm running it.... applmgr@ga006hds => sh CW_MigrationDeployScript.sh apps <appspwd> <SID> '01-JAN' '31-MAR' The process just hangs not submitting the SQL job... ... (3 Replies)
Discussion started by: WhoDatWhoDer
3 Replies

9. Shell Programming and Scripting

Shell Script passing parameters to sqlplus code

Hello All, I am interested in finding out a way to pass parameters that are entered at the prompt from HP unix and passed to SQLPlus code with a Shell Script. Is this possible? Thanks (4 Replies)
Discussion started by: compprog11
4 Replies

10. Shell Programming and Scripting

Passing a parameter from a shell script to sqlplus

Hi All, I'm new to Linux and scripting, apologies in advance for 'stupid' questions. Please help... Im writing a script that calls a sqlplus script but the sqlplus requires inputs and i cant seem to get this to work. here is my code. #!/bin/sh TERM=vt100 export TERM... (4 Replies)
Discussion started by: Mahomed
4 Replies
oar-database(1) 						   OAR commands 						   oar-database(1)

NAME
oar-database - create/initialize/upgrade/reset/drop the oar database SYNOPSIS
oar-database --create [OPTIONS] oar-database --drop [OPTIONS] oar-database --setup [OPTIONS] oar-database --reset [OPTIONS] DESCRIPTION
Manage the oar database. --setup Initialize/Upgrade an existing database. --reset Reset an existing database. --create Create and initialize a new database/user. --drop Drop an existing database/user. OPTIONS
General parameters --conf=OAR_CONF_FILE Define the oar configuration file to use. By default /etc/oar/oar.conf is used. This file doesn't exist, the default parameters for each value are used. --update-conf The database parameters given in the command line are writen to the OAR_CONF_FILE -h,--help Display this help. -d,--debug Display more information during the script execution -f,--force-sql Force to resume the execution even if an sql instruction fails -y,--force-yes This option will cause oar-database to continue without prompting if it is doins something potentially harmful Database admin parameters These parameters are only needed for database/user creation or removing. --db-is-local For --create or --drop, this option tells that the database is local. oar-database can use local admin account to execute command (useful for postgres). --db-admin-user=DB_ADMIN_USER For --create or --drop, this option gives the privilegied user to use. --db-admin-pass=DB_ADMIN_PASS For --create or --drop, this option gives the privilegied user pass to use. SQL parameters By default, if not specified, all the sql parameters are taken from the OAR_CONF_FILE. It is preferable to set these values directly to this file. --db-type=DB_TYPE The type of the SQL database. It can be currently, mysql or Pg (for postgresql). --db-user=DB_USER Connect to the database as the user DB_USER instead of the one given in OAR_CONF_FILE. By default, if OAR_CONF_FILE doesn't specify a user, it is oar. --db-pass=DB_PASS Connect to the database with the password DB_PASS instead of the one given in OAR_CONF_FILE. --db-host=DB_HOST Connect to the database on the host DB_HOST, By default, if OAR_CONF_FILE doesn't specify a host, it is localhost. --db-port=DB_PORT Connect to the database on the port DB_PORT, By default, if OAR_CONF_FILE doesn't specify a port, the value depend on the DB_TYPE. if DB_TYPE is mysql, DB_PORT is 3306. If DB_TYPE is postgresql, DB_PORT is 5432. --db-name=DB_NAME Connect to the database on the host DB_HOST, By default, if OAR_CONF_FILE doesn't specify a database name, it is oar. --db-ro-user=DB_RO_USER same as --db-user except that it is for the read only access. --db-ro-pass=DB_RO_PASS same as --db-pass except that it is for the read only access. EXAMPLES
Mysql First you need to specify the sql parameters in /etc/oar/oar.conf. These parameters will be used by oar-database. To create a new database (assuming that the sql root password is PASS): oar-database --create --db-admin-user root --db-admin-pass PASS To upgrade an existing database: oar-database --setup Postgresql First you need to specify the sql parameters in /etc/oar/oar.conf. These parameters will be used by oar-database. Then if your postgresql database is on the local system, you can use the option --db-is-local (otherwise, the procedure is the same as Mysql). So oar-database will use the postgres unix user to administrate the database (you need privilegied access to the local system). To create a new database: oar-database --create --db-is-local To upgrade an existing database: oar-database --setup Advanced usages To make some tests or to administrate several databases, you can also specify the sql parameters on the command line. For example: oar-database --create --db-type=Pg --db-host=HOST --db-user=oar --db-pass=PASS --db-admin-user=ADMIN_USER --db-admin-pass=ADMIN_PASS will create the oar database and the oar user on the postgresql system hosted by HOST. The user ADMIN_USER must have the right to create new databases and new roles on this system. FILES
/usr/lib/oar/database/mysql_structure.sql, /usr/lib/oar/database/pg_structure.sql SQL instructions for creating the structure of the oar database. /usr/lib/oar/database/mysql_default_admission_rules.sql, /usr/lib/oar/database/pg_default_admission_rules.sql SQL instructions for inserting the default admission rules in the oar database. /usr/lib/oar/database/default_data.sql SQL instructions for inserting the default data in the oar database. /usr/lib/oar/database/mysql_reset_structure.sql, /usr/lib/oar/database/pg_reset_structure.sql SQL instruction for emptying an existing oar database. /usr/lib/oar/database/mysql_structure_upgrade_*.sql, /usr/lib/oar/database/pg_structure_upgrade_*.sql SQL instructions for upgrading an existing database. oar-database 2012-06-26 oar-database(1)
All times are GMT -4. The time now is 03:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy