set oracle variable in function


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting set oracle variable in function
# 1  
Old 09-30-2012
set oracle variable in function

Hi,

I have a function that is suposed to generate a AWR report:

Code:
#-----------------------#
gen_awr()
#-----------------------#
{
	sqlplus -s admin/admin@OCEAN11<<ENDOFSQL
	define num_days = ''
	define report_type = "html"
	define begin_snap =$snap1
	define end_snap =%snap2
	define report_name =/export/home/ctemeabm/amit/test.HTML
	@?/rdbms/admin/awrrpt
	ENDOFSQL
}


When I try to run it I get the following error:

sql_test1.ksh[49]: syntax error at line 52 : `<<' unmatched





Thanks,
Amit
# 2  
Old 09-30-2012
Try this (untested):

Code:
#-----------------------#
{
sqlplus -s admin/admin@OCEAN11<<-ENDOFSQL
    define num_days = ''
    define report_type = "html"
    define begin_snap = "$snap1"
    define end_snap = "$snap2"
    define report_name = /export/home/ctemeabm/amit/test.HTML
    @?/rdbms/admin/awrrpt
ENDOFSQL
}

This User Gave Thanks to radoulov For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to pass variable from one function to another function?

updateEnvironmentField() { linewithoutquotes=`echo $LINE | tr -d '"'` b() } I want to pass variable named $linewithoutquotes to another method called b(), which is called from updateEnvironmentField() method. How to do the above requirement with shell script (1 Reply)
Discussion started by: pottic
1 Replies

2. Shell Programming and Scripting

Passing variable value in a function to be used by another function

Hello All, I would like to ask help from you on how to pass variable value from a function that has been called inside the function. I have created below and put the variables in " ". Is there another way I can do this? Thank you in advance. readtasklist() { while read -r mod ver... (1 Reply)
Discussion started by: aderamos12
1 Replies

3. UNIX and Linux Applications

Identify a specific environment Oracle variable to connect a remote Oracle database ?

Good evening I nned your help pls, In an unix server i want to connect to a remote oracle databse server by sqlplus. I tried to find out the user/passwd and service name by env variable and all Ive got is this: ORACLE_SID_REPCOL=SCL_REPCOL ORACLE_SID=xmeta ORACLE_SID_TOL=SCL_PROTOLCOL... (2 Replies)
Discussion started by: alexcol
2 Replies

4. Shell Programming and Scripting

Pass a variable string in To_Date Oracle function in shell script

Hello, I am trying to execute an SQL query from shell script. A part of script is something like this: fromDate=`echo $(date +"%F%T") | sed "s/-//g" | sed "s/://g"` $ORACLE_HOME/sqlplus -s /nolog <<EOD1 connect $COSDBUID/$COSDBPWD@$COSDBSID spool... (4 Replies)
Discussion started by: sanketpatel.86
4 Replies

5. Shell Programming and Scripting

set -o noglob in a function

I don't understand noglob. I have a function: function no_globb () { set -o noglob echo "$1" set +o noglob echo "$@" } When I run the function like this noglobb *.txt The ouput is: file01.txt file01.txt file02.txt file03.txt Shouldn't it be *.txt file01.txt file02.txt file03.txt (1 Reply)
Discussion started by: AlphaLexman
1 Replies

6. HP-UX

What is the use of command set -- and set - variable?

Hi, I am using hp unix i want to know the use of the following commands set -- set - variable thanks (4 Replies)
Discussion started by: gomathi
4 Replies

7. Shell Programming and Scripting

Passing global variable to a function which is called by another function

Hi , I have three funcions f1, f2 and f3 . f1 calls f2 and f2 calls f3 . I have a global variable "period" which i want to pass to f3 . Can i pass the variable directly in the definition of f3 ? Pls help . sars (4 Replies)
Discussion started by: sars
4 Replies

8. Shell Programming and Scripting

Help to set the oracle environment????

Hi, I am trying to set the environment for my oracle database. I have 5 database in an unix box. My idea is to create 5 files for each database with the following script on it. After logging into the unix box ...just by typing the database name....the enviornment for the database... (2 Replies)
Discussion started by: castlerock
2 Replies

9. UNIX for Dummies Questions & Answers

Export command giving Variable Name vs the Value set for the Variable

I'm having an issue when I export within my program. I'm getting the variable name, not the variable value. I have a configuration file (config.txt) that has the values of the variables set as so: set -a export ARCHIVEPOSourceDir="/interfaces/po/log /interfaces/po/data" export... (2 Replies)
Discussion started by: ParNone
2 Replies

10. Shell Programming and Scripting

Set Oracle Environmental Variable !!

Can someone send me a shell script to set all Oracle environment variable which is working. I have the following script which works but not 100%. Please advice what you think is wrong. if # Command executed from a terminal then ORACLE_SID="" ... (4 Replies)
Discussion started by: uuser
4 Replies
Login or Register to Ask a Question