Sponsored Content
Top Forums Shell Programming and Scripting Passing a parameter from a shell script to sqlplus Post 302844046 by durden_tyler on Friday 16th of August 2013 08:06:03 AM
Old 08-16-2013
Quote:
Originally Posted by Mahomed
...
where must this go? in the sql script?
...
cat -n per12.sql
1 begin
2 dbms_output.put_line ('You entered PID = ' || '&1');
3 dbms_output.put_line ('You entered PEE = ' || '&2');
4 end;
5 /
6
Yes, that is my sample SQL script.
I don't know the contents of your SQL script - "PER12.sql", so I created my own sample script to demonstrate how you could pass parameters to it.

Since you put the "expect" command after calling "PER12.sql", my guess is that your SQL script prompts for the inputs when it is run directly in sqlplus. So, I'd think you have an "accept" statement in there somewhere in your SQL script that accepts substitution variables.

What I meant to say in my post was - you could remove the named substitution variables in your original "PER12.sql" script and use "&1", "&2" instead. That way you can pass them in the invocation line itself.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

passing parameters from a shell script to sqlplus

Hi , I want to pass parameters from a shell script to a sql script and use the parameter in the sql query ..and then I want to spool a particular select query on to my unix box... for 4 different locations by writing only one sql script Right now no file is generated on the unix box...it is a... (2 Replies)
Discussion started by: phani
2 Replies

2. 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

3. Shell Programming and Scripting

How to pass parameter from sqlplus(procedure completed) to your shell script

if then # mail -s "Import failed file does not exist" sanjay.jaiswal@xyz.com echo "FILE does not exist" exit 1 fi echo "FILE EXIST" size=-1 set $(du /export/home/oracle/nas/scott21.dmp.gz) while do echo "Inside the loop" size=$1 set $(du... (1 Reply)
Discussion started by: sanora600
1 Replies

4. Shell Programming and Scripting

Passing parameter from one file to shell script

Hi All, I have a 2 files. File1 i am generating using an ETL tool, which is a comman seperated delimited file which contains country code & load date. everytime, this country code will be updated from a table. It might be AB or BA & ld_date will be for which date we need to load the file. ... (7 Replies)
Discussion started by: Amit.Sagpariya
7 Replies

5. AIX

Passing a parameter to a shell script?

I would like to run a compress script on files in certain directories. My compress_script.sh is just basically compress file* In order for me to use this I have to copy it into each directory and run it. How can I state the directory on the command line with the compress script so it... (2 Replies)
Discussion started by: NycUnxer
2 Replies

6. SCO

Parameter passing to dot shell script

OS SCO Open Server 6.0 MP4 I am trying to change the value of a enviornment variable thru a script and want to pass a parameter on the commande line, If I hard code the value inside the script the script changes the enviornment variable . mytest where my test is MYVAR=$1 export MYVAR... (6 Replies)
Discussion started by: atish0
6 Replies

7. Shell Programming and Scripting

Passing Parameter containing space in between to Shell Script

Hi, I have one shell script which use two parameter however one of its parameter have space in between. eg. a.sh 20110114 b c d here b c d is one parameter I used 'b c d' but its not giving correct result. Also i tried b\c\d but this one also didnt work. Any help would be... (5 Replies)
Discussion started by: diehard
5 Replies

8. UNIX for Dummies Questions & Answers

Passing a Unix parameter to SQLPlus login command

hi All, i m trying to pass a user choice paramter from unix to sqlplus connect command here i want the user to enter the username and password he wants to connect in sql plus through read in unix and then automatically connect to that instance. sqlplus -s $1/$2 where $ 1 and $2 will b... (2 Replies)
Discussion started by: Jcpratap
2 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 parameter with single quote to shell script

Hello All, I am trying below +++++++++ #/bin/bash set -x Host=$1 Port=$2 User=$3 Pass=$4 Warning=$5 Critical=$6 SCRIPT_LOC=/opt/agent/ Parameters="'""hostname=$Host&""port=$Port&""username=$User&""password=$Pass&""jvm=UsedMemory,$Warning,$Critical""'" echo $Parameters... (10 Replies)
Discussion started by: sundari127
10 Replies
MYSQL_FIX_PRIVILE(1)					       MySQL Database System					      MYSQL_FIX_PRIVILE(1)

NAME
mysql_fix_privilege_tables - upgrade MySQL system tables SYNOPSIS
mysql_fix_privilege_tables --password=root_password DESCRIPTION
Note In MySQL 5.1.7, mysql_fix_privilege_tables was superseded by mysql_upgrade, which should be used instead. See mysql_upgrade(1). Some releases of MySQL introduce changes to the structure of the system tables in the mysql database to add new privileges or support new features. When you update to a new version of MySQL, you should update your system tables as well to make sure that their structure is up to date. Otherwise, there might be capabilities that you cannot take advantage of. mysql_fix_privilege_tables is an older script that previously was used to uprade the system tables in the mysql database after a MySQL upgrade. Before running mysql_fix_privilege_tables, make a backup of your mysql database. On Unix or Unix-like systems, update the system tables by running the mysql_fix_privilege_tables script: shell> mysql_fix_privilege_tables You must run this script while the server is running. It attempts to connect to the server running on the local host as root. If your root account requires a password, indicate the password on the command line like this: shell> mysql_fix_privilege_tables --password=root_password The mysql_fix_privilege_tables script performs any actions necessary to convert your system tables to the current format. You might see some Duplicate column name warnings as it runs; you can ignore them. After running the script, stop the server and restart it so that any changes made to the system tables take effect. On Windows systems, MySQL distributions include a mysql_fix_privilege_tables.sql SQL script that you can run using the mysql client. For example, if your MySQL installation is located at C:Program FilesMySQLMySQL Server 5.1, the commands look like this: C:> cd "C:Program FilesMySQLMySQL Server 5.1" C:> binmysql -u root -p mysql mysql> SOURCE share/mysql_fix_privilege_tables.sql Note Prior to version 5.1.17, the mysql_fix_privilege_tables.sql script is found in the scripts directory. The mysql command will prompt you for the root password; enter it when prompted. If your installation is located in some other directory, adjust the path names appropriately. As with the Unix procedure, you might see some Duplicate column name warnings as mysql processes the statements in the mysql_fix_privilege_tables.sql script; you can ignore them. After running the script, stop the server and restart it. COPYRIGHT
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc. This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see http://www.gnu.org/licenses/. SEE ALSO
For more information, please refer to the MySQL Reference Manual, which may already be installed locally and which is also available online at http://dev.mysql.com/doc/. AUTHOR
Sun Microsystems, Inc. (http://www.mysql.com/). MySQL 5.1 04/06/2010 MYSQL_FIX_PRIVILE(1)
All times are GMT -4. The time now is 08:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy