set oracle variable in function

Hi,

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


#-----------------------#
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

Try this (untested):

#-----------------------#
{
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
}
1 Like