473,385 Members | 1,325 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

sqlplus exit statement prematurely terminates unix script

3
#!/bin/ksh
echo ""
echo "Enter person ID:"
read person_id
sqlplus -silent '/nolog'<<end_sql1
connect useract/passwd
start $BANNER_LINKS/gurlsid.sql
$person_id
FAISMGR
end_sql1
cat person.lst >person_list
sqlplus -silent '/nolog'<<end_sql2
connect useract/passwd
start $BANNER_LINKS/gurlsid.sql
$person_id
FIMSMGR
end_sql2
cat person.lst >>person_list
sqlplus -silent '/nolog'<<end_sql2b
connect useract/passwd
spool person
set feedback off
column "Table Name" format a12
column "Column Name" format a30
column "Count" format 9999
column "Condition" format a32
select 'FOBTEXT' "Table Name",
'FOBTEXT_CODE' "Column Name",
count(fobtext_code) "Count",
'WHERE FOBTEXT_DTYP_SEQ_NUM = 73' "CONDITION"
from fobtext
where fobtext_code = '$person_id'
and fobtext_dtyp_seq_num = 73
having count(fobtext_code) > 0;
spool off
exit
end_sql2b
#--------------------------
cat person.lst >>person_list
echo ""
echo "finish my program"

*******

I am runing Oracle 10.2 on Sun OS.

The last three statements of this script did not execute at all. The last person.lst has something, but it didn't append to person_list. The last two echo didn't display on the screen either. I think somehow when exiting from sqlplus, it just exited out of the script completely.

Can someone indicate why the last three statements of this script did not carry out?

Thanks,
Trang
Sep 27 '06 #1
3 9640
#!/bin/ksh
echo ""
echo "Enter person ID:"
read person_id
sqlplus -silent '/nolog'<<end_sql1
connect useract/passwd
start $BANNER_LINKS/gurlsid.sql
$person_id
FAISMGR
end_sql1
cat person.lst >person_list
sqlplus -silent '/nolog'<<end_sql2
connect useract/passwd
start $BANNER_LINKS/gurlsid.sql
$person_id
FIMSMGR
end_sql2
cat person.lst >>person_list
sqlplus -silent '/nolog'<<end_sql2b
connect useract/passwd
spool person
set feedback off
column "Table Name" format a12
column "Column Name" format a30
column "Count" format 9999
column "Condition" format a32
select 'FOBTEXT' "Table Name",
'FOBTEXT_CODE' "Column Name",
count(fobtext_code) "Count",
'WHERE FOBTEXT_DTYP_SEQ_NUM = 73' "CONDITION"
from fobtext
where fobtext_code = '$person_id'
and fobtext_dtyp_seq_num = 73
having count(fobtext_code) > 0;
spool off
exit
end_sql2b
#--------------------------
cat person.lst >>person_list
echo ""
echo "finish my program"

*******

I am runing Oracle 10.2 on Sun OS.

The last three statements of this script did not execute at all. The last person.lst has something, but it didn't append to person_list. The last two echo didn't display on the screen either. I think somehow when exiting from sqlplus, it just exited out of the script completely.

Can someone indicate why the last three statements of this script did not carry out?

Thanks,
Trang
The last SQL was not valid, hence your person.lst file would be empty.
In the list of columns and expressions for the select statement, you have an extra comma.

That would make life a bit difficult for you.
Dec 10 '06 #2
ENDBA
1
#!/bin/ksh
echo ""
echo "Enter person ID:"
read person_id
sqlplus -silent '/nolog'<<end_sql1
connect useract/passwd
start $BANNER_LINKS/gurlsid.sql
$person_id
FAISMGR
end_sql1
cat person.lst >person_list
sqlplus -silent '/nolog'<<end_sql2
connect useract/passwd
start $BANNER_LINKS/gurlsid.sql
$person_id
FIMSMGR
end_sql2
cat person.lst >>person_list
connect useract/passwd
spool person
set feedback off
column "Table Name" format a12
column "Column Name" format a30
column "Count" format 9999
column "Condition" format a32
select 'FOBTEXT' "Table Name",
'FOBTEXT_CODE' "Column Name",
count(fobtext_code) "Count",
'WHERE FOBTEXT_DTYP_SEQ_NUM = 73' "CONDITION"
from fobtext
where fobtext_code = '$person_id'
and fobtext_dtyp_seq_num = 73
having count(fobtext_code) > 0;
spool off
exit
end_sql2b
#--------------------------
cat person.lst >>person_list
echo ""
echo "finish my program"

*******

I am runing Oracle 10.2 on Sun OS.

The last three statements of this script did not execute at all. The last person.lst has something, but it didn't append to person_list. The last two echo didn't display on the screen either. I think somehow when exiting from sqlplus, it just exited out of the script completely.

Can someone indicate why the last three statements of this script did not carry out?

Thanks,
Trang

====================
try adding the following:

sqlplus -silent '/nolog'<<end_sql2b >/dev/null
Jul 25 '07 #3
I am facing the same issue...

script is terminating in between due to SQL exit

I am trying below script
cd $ROOT_APPLI/kcust/ddl
sqlplus -s e210/$PWD_E210@$DB_NAME <<FIN>
/E210/kcust/ddl
* @USERS_LDAP_SYNCHRO.sql $1 $1
commit;
exit 1;
FIN
cd $ROOT_APPLI/sh
script is terminating at exit line.

Please help
Mar 10 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Rick | last post by:
I am installing Oracle 9i client runtime on AIX 5.1-003. The installation completes successfully, but neither the Net Configuration Assistant or SQLPLUS will run. I get the following error when...
2
by: Vincento Harris | last post by:
Oracle 8.1.7.4 on Hp Unix 11i I am attempting to pass unix parameters on to sql plus I did read on technet that with 9i it is very straightforward Example script name whoisit Pass sid 23...
4
by: tommy | last post by:
I'm running sqlplus from a DOS command line and inducing an error by purposly giving it the wrong script (hence, it cannot find the script file.) What it is doing is exiting to the SQL> prompt as...
2
by: Matt | last post by:
I'm new to Java but experienced with PL/SQL. I've found what appears to be strange behaviour (a bug?) when attempting to create java stored objects using the UNIX version of Oracle SQL*PLUS...
1
by: Krusty276 | last post by:
I'm getting this error using sql plus Input is too long (> 2499 characters) - line ignored This is my command line on linux: /home/oracle/product/8.1.6/bin/sqlplus -s loader/loader@ecrmdb...
2
by: Zvika Glickman | last post by:
I have a script a.ksh as follow: <orasp> cat a.ksh sqlplus -s rsi/rsi < aaa1.sql echo stat $? <orasp> text of aaa1.sql: exec dbms_stats.gather_table_stats
13
by: PeterZ | last post by:
Hi, Back to basics! My understanding is that the only way to exit a For-Next loop prematurely is with the 'break' keyword. How are you supposed to do that if you're inside a Switch...
0
by: tngoe | last post by:
echo "" echo "Enter person ID:" read person_id sqlplus -silent '/nolog'<<end_sql1 connect useract/passwd start $BANNER_LINKS/gurlsid.sql $person_id FAISMGR end_sql1 cat person.lst...
9
by: titanandrews | last post by:
Hi All, Is there any way to catch the exit code from someone calling exit(status) and check the value before the program terminates? Just for an idea, the code I'm thinking of is something...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.