![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
I'm calling SQL*Plus to run a query from inside a Unix (ksh) script. How can I tell whether the query returned any rows or not? |
#4
| |||
| |||
|
|
Consider: SQL> select row_id from CX_LOCK; ROW_ID --------------- 1 2 3 4 5 6 7 8 9 10 11 ROW_ID --------------- 12 12 rows selected. SQL> select row_id from CX_LOCK where ROW_ID='abc'; no rows selected |
#5
| |||
| |||
|
#6
| |||
| |||
|
|
"Randy Harris" <randy (AT) SpamFree (DOT) com> wrote in news:1q8ke.90$3V.58 (AT) newssvr31 (DOT) news.prodigy.com: I'm calling SQL*Plus to run a query from inside a Unix (ksh) script. How can I tell whether the query returned any rows or not? By making "proper" use of SQL*Plus & the ability to generate a SPOOL file, I test for non-zero length of the output file. In other words zero rows results in a spool file of length 0. I use this approach daily in cron jobs |
#7
| |||
| |||
|
|
"IANAL_VISTA" <IANAL_Vista (AT) hotmail (DOT) com> wrote in message news:Xns965EB230B9ADFSunnySD (AT) 68 (DOT) 6.19.6... "Randy Harris" <randy (AT) SpamFree (DOT) com> wrote in news:1q8ke.90$3V.58 (AT) newssvr31 (DOT) news.prodigy.com: I'm calling SQL*Plus to run a query from inside a Unix (ksh) script. How can I tell whether the query returned any rows or not? By making "proper" use of SQL*Plus & the ability to generate a SPOOL file, I test for non-zero length of the output file. In other words zero rows results in a spool file of length 0. I use this approach daily in cron jobs I'm running the jobs from cron and generating spool files. It didn't occur to me that the file would be 0 length. I assumed that it would contain the message "no rows selected". Thanks. |
#8
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |