Send email for each row in a result set


 
Thread Tools Search this Thread
Top Forums Programming Send email for each row in a result set
# 1  
Old 06-25-2009
Send email for each row in a result set

I have SQL giving me output of disabled ids in the system every day.
I can send on email for this disabled user list.
But I want to send one email for every disabled user or for every row.

thank you for your help.

Kyle
# 2  
Old 06-26-2009
Bug

Are you using *LK* keyword in /etc/passwd file for marking locked user;
then I can play later;Smilie
# 3  
Old 06-30-2009
No. I am pulling data from table directly. I want to send seprate email for every locked id to help desk for word order creation.
SQL below.

@@\.login_JDEDB.sql
set echo off
set verify off
set feed off term off
prompt ********************************************************
prompt Todays Date
prompt ********************************************************
prompt This SQL runs Daily to Display JDE Locked Out ID
prompt ********************************************************
set feedback on
set echo off head off feed off veri off trimspool on
spool /home/oracle/log/Daily_lockedout.log
set heading on;
set linesize 200;
Select sysdate From dual;
prompt "Following JDE System User Ids Locked Out"
Select SCUSER AS "User Id" FROM SYS7333.F98OWSEC
WHERE SCEUSER =02;
spool off
exit
********************
Than follow script sends email for all user ids locked out. But I want one email per user.

#!/bin/sh
. /home/oracle/.cron_profile
#
export LOGDIR=/home/oracle/log
cd /home/oracle
#
sqlplus /nolog @/home/oracle/Daily_lockedout.sql
#
cat $LOGDIR/Daily_lockedout.log >>$LOGDIR/Daily_lockedout.all.log

mail -s "JDE User IDs Lockedout" help@abc.com < $LOGDIR/Daily_lockedout.log
mail -s "JDE User IDs Lockedout" support@abc.com < $LOGDIR/Daily_lockedout.log


Thanks for your help.

Akbar
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. SuSE

Send outgoing email to my GroupWise email

Dear users, I have Linux server whose versions are Suse 10 SP 3 and Suse 11. I am trying to send email from these servers to my GroupWise email account. In /etc/postfix/main.cf file, The current value of MYHOSTNAME is LINUX.LOCAL. What should be the right value of MYHOSTNAME? Is... (0 Replies)
Discussion started by: JDBA
0 Replies

2. Shell Programming and Scripting

Send email based on row count

i have below code to count number of rows in file1.txt, if the row count is more than one then i have sending an email along with file1.txt attached and fail the process(do nothing if count is <=1), if I test individually count part works good but when i include the email part its not working,... (1 Reply)
Discussion started by: srini_106
1 Replies

3. Shell Programming and Scripting

Comparing two files on row by row and send the report

Comparing two files on row by row File1 ecount~100 dcount~200 ccount~300 zxcscount~5000 and so on. File2 ecount~100 dcount~203 ccount~300 zxcscount~5000 and so on. If i use diff command (1 Reply)
Discussion started by: onesuri
1 Replies

4. UNIX for Dummies Questions & Answers

new to ldap, send email to a ou or group, and see a list from email client

hi, i'm running openldap on ubuntu 10.04, creating new items with apache directory studio (windows version). i use the ldap just as an address book to our small office (email clients are windows live mail 2009, 2011, microsoft outlook 2007 and 2010). a. i cant see a list of the contacts,... (0 Replies)
Discussion started by: V4705
0 Replies

5. Shell Programming and Scripting

Script to send email after comparing the folder permissions to a certain permission & send email

Hello , I am trying to write a unix shell script to compare folder permission to say drwxr-x-wx and then send an email to my id in case the folders don't have the drwxr-x-wx permissions set for them . I have been trying to come up with a script for few days now , pls help me:( (2 Replies)
Discussion started by: nairshar
2 Replies

6. Solaris

Send an email from Solaris using Linux email server

Hello everyone I have a problem and I need your help: I have a Solaris 10 and Solaris 8 UNIX Servers, and Linux Centos4 as email server. I need send an email from Solaris servers preferably using Centos4 email server. I have no mail service configured in my Solaris computers (1 Reply)
Discussion started by: aflores
1 Replies

7. Shell Programming and Scripting

Sending one email for every row as per sql result

I want to send email for every row comes out of following SQL statement thank you for your help. *****SQL STATEMENT****** Select SCUSER AS "USER IDS" , SCEUSER AS "LOCKED OUT" FROM SYS.7333.F98OWSEC; *******OUPUT COMES LIKE THIS AND ONE EMAIL COMES AS PER SCRIPT BELOW****** ******BUT... (4 Replies)
Discussion started by: s1a2m3
4 Replies

8. Shell Programming and Scripting

Send one email with output result from 2 commands

Hi, i want to create a script which should do the following: 1) ping the remote servers and email the hosts which are down 2) netstat on port x on 2 server and email the result too. I want both results to be sent in the same email. I have few ideas but i can't finish it. Here... (4 Replies)
Discussion started by: varu0612
4 Replies

9. UNIX for Advanced & Expert Users

Unable to send eMail from a UNIX-Host ( using mailx ) to a Outlook-email-addres(Win)

Hi A) I am able to send eMail using mailx from a UNIX ( solaris 8 ) host to my Outlook-email-ID : FName.Surname@Citigroup.com ( This is NOT my actual -eMail-ID). But in Outlook the "From :" eMail address is displayed as " usr1@unix-host1.unregistered.email.citicorp.com " .i.e the words... (2 Replies)
Discussion started by: Vetrivela
2 Replies
Login or Register to Ask a Question