473,789 Members | 2,694 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sqlplus exit statement prematurely terminates unix script

3 New Member
#!/bin/ksh
echo ""
echo "Enter person ID:"
read person_id
sqlplus -silent '/nolog'<<end_sql 1
connect useract/passwd
start $BANNER_LINKS/gurlsid.sql
$person_id
FAISMGR
end_sql1
cat person.lst >person_list
sqlplus -silent '/nolog'<<end_sql 2
connect useract/passwd
start $BANNER_LINKS/gurlsid.sql
$person_id
FIMSMGR
end_sql2
cat person.lst >>person_list
sqlplus -silent '/nolog'<<end_sql 2b
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_c ode) "Count",
'WHERE FOBTEXT_DTYP_SE Q_NUM = 73' "CONDITION"
from fobtext
where fobtext_code = '$person_id'
and fobtext_dtyp_se q_num = 73
having count(fobtext_c ode) > 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 9665
Mondo Tofu
12 New Member
#!/bin/ksh
echo ""
echo "Enter person ID:"
read person_id
sqlplus -silent '/nolog'<<end_sql 1
connect useract/passwd
start $BANNER_LINKS/gurlsid.sql
$person_id
FAISMGR
end_sql1
cat person.lst >person_list
sqlplus -silent '/nolog'<<end_sql 2
connect useract/passwd
start $BANNER_LINKS/gurlsid.sql
$person_id
FIMSMGR
end_sql2
cat person.lst >>person_list
sqlplus -silent '/nolog'<<end_sql 2b
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_c ode) "Count",
'WHERE FOBTEXT_DTYP_SE Q_NUM = 73' "CONDITION"
from fobtext
where fobtext_code = '$person_id'
and fobtext_dtyp_se q_num = 73
having count(fobtext_c ode) > 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 New Member
#!/bin/ksh
echo ""
echo "Enter person ID:"
read person_id
sqlplus -silent '/nolog'<<end_sql 1
connect useract/passwd
start $BANNER_LINKS/gurlsid.sql
$person_id
FAISMGR
end_sql1
cat person.lst >person_list
sqlplus -silent '/nolog'<<end_sql 2
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_c ode) "Count",
'WHERE FOBTEXT_DTYP_SE Q_NUM = 73' "CONDITION"
from fobtext
where fobtext_code = '$person_id'
and fobtext_dtyp_se q_num = 73
having count(fobtext_c ode) > 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_sql 2b >/dev/null
Jul 25 '07 #3
iwantvarun
1 New Member
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_N AME <<FIN>
/E210/kcust/ddl
* @USERS_LDAP_SYN CHRO.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
20207
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 trying to run netca: Error loading native library: libnjni9.so. java.lang.UnsatisfiedLinkError: jniGetOracleHome at oracle.net.common.NetGetEnv.getOracleHome(NetGetEnv.java) at oracle.net.ca.CmdlineArgs.setOraArgs(CmdlineArgs.java)
2
17111
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 whoisit 23 returns
4
44059
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 show below. What I NEED it to do is exit to the DOS prompt. c:\>sqlplus someuser/mypass@mydb NonExistantCommandFile.sql SQL> Does someone know how this can be done or have a commandline switch reference that might have the answer?
2
5750
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 8.1.7.3.0 with JServer 8.1.7.3.0. The reason it seams strange is that the problem only occurs with the UNIX version of SQL*PLUS, not the PC client version running on Windows 2000 but connected to the same database and schema. Can anyone shed any light...
1
22767
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 @/mp3/generated/listpullmon/sql/5485_de.sql And I set line size in the file: set pagesize 0
2
14893
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
11250
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 statement? The break keyword will only come out of the switch, not the for-next loop.
0
1683
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 >person_list
9
11581
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 like this: void exithandler() { DWORD exitCode = 0;
0
9663
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10404
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10136
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9016
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5415
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4090
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3695
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2906
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.