Dear All,
I have a script as follows:
1 #! /bin/ksh
2 #
28 varDate=`date +%d%h%y`
29 export spool_file=/app/my_user/work/TH_Status_${varDate}_Check.txt
30
31 #########################
32 # Unix Code Starts here #
33 #########################
34
35 echo 'Please Enter Database Password: '
36 stty -echo
37 read db_pass
38 stty echo
39
40 #-------------- Define Function for reusing ---------------#
41
42 displayResult()
43 {
44 echo '\nPlease Enter the Hub name (EMEA/APAC): '
45 read u_region_nm
46 p_region_nm=`echo $u_region_nm|tr '[a-z]' '[A-Z]'`
47 echo 'Extracting information, please wait...\n'
48
49 ###############################
50 # Database connection started #
51 ###############################
52
53 sqlplus -s user_nm/$db_pass@my_db <<ENDOFSQL
54
55 WHENEVER SQLERROR EXIT 1
56
57 set serveroutput on size 1000000
58 set echo off
59 set feedback off
60 set heading off
61 set pages 0
62 set pagesize 1000
63 set linesize 300
64 spool $spool_file
65
66 /* PL/SQL block starts from here */
67
68 declare
------your pl/sql code here
244 exception
------your pl/sql code here
251 end ;
252 /
253 spool off
254 exit;
255 ENDOFSQL
256
278 # Print the end programe message
279 echo '\n-= Data Extraction file created! =-'
280 }
281
282 #---------- Calling the function displayResult ----------#
283 displayResult
284
285 #---------- Code for Exit Confirmation ----------#
286
287 exitConf()
288 {
289 echo 'Do you want to continue with other Hubs[y/n]?'
290 read varWish
291 varWish=`echo $varWish|tr '[a-z]' '[A-Z]'`
292 if [ "$varWish" == "Y" ]; then
293 displayResult # Calling the function
294 exitConf # Calling the function
295 elif [ "$varWish" == "N" ]; then
296 echo '\nExit confirmation received. Exiting...!'
297 else
298 echo '\nInvalid option!'
299 exitConf # Calling the function
300 fi
301 }
302 exitConf
303
304 ###########################
305 # End of Script Programme #
306 ###########################
307
Later, I have added the bold section code. After that the code is throwing the following error:
th_status_chk.ksh[42]: syntax error at line 53 : `<<' unmatched
Earlier It was working fine.
Please help.
Sapy.