#!/bin/bash
# Define the SQL query
SQL_QUERY="SELECT cm.CONCURRENT_PROGRAM_NAME,
cmr.STATUS,
cmr.ACTUAL_START_DATE,
cmr.ACTUAL_COMPLETION_DATE
FROM fnd_concurrent_requests cmr,
fnd_concurrent_programs cm
WHERE cmr.CONCURRENT_PROGRAM_ID = cm.CONCURRENT_PROGRAM_ID
AND cmr.REQUEST_ID = (SELECT MAX(REQUEST_ID)
FROM fnd_concurrent_requests
WHERE concurrent_program_id = cm.concurrent_program_id);"
# Execute the SQL query and write the results to a file
sqlplus -s <username>/<password>@<database> << EOF > concurrent_manager_status.txt
SET HEADING OFF
SET FEEDBACK OFF
SET LINESIZE 1000
SET PAGESIZE 0
$SQL_QUERY
EOF
# Define the recipient email address
EMAIL_TO=<recipient_email_address>
# Define the subject and message for the email
SUBJECT="Concurrent Manager Status"
MESSAGE="Attached is the current status of the concurrent manager."
# Send the email with the attachment
mail -s "$SUBJECT" -a concurrent_manager_status.txt "$EMAIL_TO" <<< "$MESSAGE"
# Clean up the temporary file
rm concurrent_manager_status.txt
No comments:
Post a Comment