Home » Infrastructure » Unix » Sending messages
Sending messages [message #301642] Thu, 21 February 2008 03:54 Go to next message
user71408
Messages: 585
Registered: November 2007
Location: NE
Senior Member
Hi I have records as follows.
Number     Rows         stmt
------------------------------
1001       10       select count(*) from tabs where rows<=10

 

now what happens is if rows<=10 it returns '0' .if it's >10 then it returns 'nothing'

Now the requirement is :
" if rows>10 i need to send a mail to any(for example... abc.ss@gmail.com mail-id mentioned as " The statement was failed because rows>10."

I need to write "SHELL SCRIPT" for this.

So anyone please send me the script for this issue..

Thank you.

[Updated on: Thu, 21 February 2008 04:00]

Report message to a moderator

Re: Sending messages [message #301657 is a reply to message #301642] Thu, 21 February 2008 04:44 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You can't do this with the query you have as your query does not allow you to know if they are rows in tabs that satisfy the opposite condition.

If you ask how many blue cars in this car park, you can't know if there are black ones.

Regards
Michel
Re: Sending messages [message #301660 is a reply to message #301657] Thu, 21 February 2008 04:52 Go to previous messageGo to next message
user71408
Messages: 585
Registered: November 2007
Location: NE
Senior Member
i wrote a query in the script as follows

[code]
EXEC SQL DECLARE num_rows CURSOR FOR
SELECT rowidtochar(t.rowid) t_rowid
,t.nums
,t.rows
,atc.sql_statement
FROM check t
WHERE t.nums = :ps_nums
ORDER BY t.rows;
Re: Sending messages [message #301662 is a reply to message #301660] Thu, 21 February 2008 04:56 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
And what has this query with the problem you posted?

Regards
Michel
Re: Sending messages [message #301665 is a reply to message #301662] Thu, 21 February 2008 05:08 Go to previous messageGo to next message
user71408
Messages: 585
Registered: November 2007
Location: NE
Senior Member
Here the problem is if we r entering number of rows . So there r 10 rows. but we enter "11" then it send mail to any mail-id "it was failed because it has value>0".
if we enter <=10 then no need to send any message.
This is the requirement "Michael".So could u please send me the solution for this issue...
" I wrote like this"
[code]
echo "message" | mail -s "subject" mail_id
[/code>

but i need to check whether it is exceeding the limit or not.
for that purpost i need to take a variable and check it.
Re: Sending messages [message #301667 is a reply to message #301665] Thu, 21 February 2008 05:11 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I really don't understand what you have, what you want.
Post an example. Don't describe it. Post table, data and what happens when.

Regards
Michel
Re: Sending messages [message #301688 is a reply to message #301667] Thu, 21 February 2008 06:33 Go to previous messageGo to next message
user71408
Messages: 585
Registered: November 2007
Location: NE
Senior Member
hi Michel,
I have two variables A,B
A:=0 and B<>0
now the requirement is

if A then
display message as " working fine"
else
(i.e if B then)
dispaly message as " you are crossing the limit".

I need to write to write a program for this using "shell scripting".
so could u please send me the solution for this.

[note: These mesages should be sent to mail-id's]
Thank you.

[Updated on: Thu, 21 February 2008 06:34]

Report message to a moderator

Re: Sending messages [message #301689 is a reply to message #301688] Thu, 21 February 2008 06:38 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
How is this an Oracle question?

In ksh, you can do,
if [ $A -eq 0 ]
then
  echo message 1
else 
  echo message 2
fi

Regards
Michel

[Updated on: Thu, 21 February 2008 06:39]

Report message to a moderator

Re: Sending messages [message #301697 is a reply to message #301689] Thu, 21 February 2008 07:05 Go to previous message
user71408
Messages: 585
Registered: November 2007
Location: NE
Senior Member
Thank you Michel.
Previous Topic: ORACLE BINARIES INSTALLATION FAILS BECAUSE THE RUNINSTALLER THINKS IS A DIFFERENT VERSION ????
Next Topic: Error message ' ' ' unmatched
Goto Forum:
  


Current Time: Thu Mar 28 10:53:51 CDT 2024