error in passing a variable to sqlplus from a shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting error in passing a variable to sqlplus from a shell script
# 1  
Old 07-02-2008
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 getting an error message saying that the input variable is too long...

is there any way with which i can overcome this issue... ?

thanks,

Krips.
# 2  
Old 07-02-2008
Why not dump it into a script file that SQLPlus can read?

A sample of your actual code and data would be helpful.
# 3  
Old 07-08-2008
hi,

if i am writing my query in a .sql file, passing the variable inside that.. and i am giving this sql file as input to the sqlplus to process it in a particular server...

like suppose file.sql is my input file..

file.sql

SELECT * FROM TABLEA WHERE value in ('$STRING');

and in my shell script i will be processing this file ..

i am passing this STRING variable to the file.sql from my shell script itself...

thanks.
# 4  
Old 07-08-2008
Let's say you do this:

Code:
echo "SELECT * FROM TABLEA WHERE value in ('$STRING');" > file.sql
sqlplus username@database < file.sql

Does it work? If not, do the contents of file.sql look okay, or are they truncated?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing sqlplus output to shell variable

Hi , I am using below code : for i in `ps -ef|grep pmon|awk {' print $8 '}|cut -f3 -d'_'|grep -v '^grep'` do ORACLE_SID=$i export ORACLE_SID; dest=`sqlplus "/ as sysdba" <<EOF set heading off feedback on verify off select DESTINATION from v\\$archive_dest where target in... (5 Replies)
Discussion started by: admin_db
5 Replies

2. Shell Programming and Scripting

Shell Script (ksh) - SQLPlus query filter using a string variable

Using ksh, I am using SQLPlus to execute a query with a filter using a string variable. REPO_DB=DEV1 FOLDER_NM='U_nmalencia' FOLDER_CHECK=$(sqlplus -s /nolog <<EOF CONNECT user/pswd_select@${REPO_DB} set echo off heading off feedback off select subj_name from subject where... (5 Replies)
Discussion started by: nkm0brm
5 Replies

3. Shell Programming and Scripting

How to pass Variable from shell script to select query for SqlPlus?

echo "set echo off"; echo "set feedback off"; echo "set linesize 4000"; echo " set pagesize 0"; echo " set sqlprompt ''"; echo " set trimspool on"; Select statement is mentioned below echo "select res.ti_book_no from disney_ticket_history res where res.ti_status =${STATUS} and... (7 Replies)
Discussion started by: aroragaurav.84
7 Replies

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

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

6. Shell Programming and Scripting

Passing shell variable to awk script

I want to pass a shell variable to awk script : # cat file PSAPSR3 3722000 91989.25 2 98 PSAPSR7 1562000 77000.1875 5 95 PSAPUNDO 92000 4087.5625 4 96 #... (8 Replies)
Discussion started by: Reboot
8 Replies

7. Shell Programming and Scripting

Passing Shell array to SQLPlus

Dears, Newbie here and tried to search this topic for 3 days now with results. I have a shell array and I want to use it in sqlplus with one connection. here is what I have for now #!/bin/ksh FileName=1000 FileName=2000 FileName=3000 FileName=4000 sqlplus /nolog <<EOF connect... (20 Replies)
Discussion started by: roby2411
20 Replies

8. Shell Programming and Scripting

Passing the unix variable to sqlplus

Hi, I am writing a script which creates an external table using a shell script. My requirement is like this. Usage: . ./r.ksh <table_name> - this should create an external table. e.g . ./r.ksh abc - this should create an external table as abc_external. How do i achieve this? Please... (5 Replies)
Discussion started by: Anaramkris
5 Replies

9. UNIX for Advanced & Expert Users

passing unix variable to sqlplus without a file name

Hi, I want to input unix variable to sqlplus.The following is working fine sqlplus username/password @dummy.sql param1 param2 << EOF create user $1 identified by $2; EOF But I dont want any file name to be passed,I just want to pass the parameter. Is there any way to that?? Thanks... (3 Replies)
Discussion started by: sakthi.abdullah
3 Replies

10. 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
Login or Register to Ask a Question