Emailing results of a pl sql procedure from UNIX shell script
Hello All,
I am writing the below unix script to email the result of a small pl sql procedure:
When i run the script, i am just getting the email without the id value.
Please assist.
Moderator's Comments:
edit by bakunin: as Yoda already said, CODE-tags please! It is entirely possible to edit oneselfs posts to put these tags in, btw., like i did for you right now.
Thanks for the prompt response Jedi Master
This code i tried initially and it worked. But my requirement is to email more than one value after applying some logic through pl sql procedure. So, i was thinking to embed a pl sql procedure in the script.
For example i want to return the employee_id, sal, and department_name by joining the employee table and the department table in the query, how to i accomplish this?
This is just an example, my actual requirement is bigger though.
For example i want to return the employee_id, sal, and department_name by joining the employee table and the department table in the query, how to i accomplish this?
This is just an example, my actual requirement is bigger though.
Instead of capturing the output to a variable you could spool out to a temporary file, then use the file to create the mails body (here is just a sketch):
Well , let me post my real requirement.
the script will select all the records from a table with the condition timestamp=(sysdate-1 hr). once the records are selected, it will check the flag value of each record and if the record matches a particular flag value, it will send out an email.
i want to accomplish this task in the shell script itself without using any additional files.
is this feasible?
i am a newbee to unix and doesn't have much knowlegde.
---------- Post updated at 05:22 PM ---------- Previous update was at 04:36 PM ----------
here is my sample script
getting the following errors on executing
it runs perfect without the if else decision making. and there are only 2 records in the result of my sql query.
Looks like a syntax error to me.
should be
Is result.csv a true comma separated file, if so, then you need to set the internal field separator character to a comma
Hi,
We have a procedure e.g. prc_synonym created in Oracle 12c Database. I want to do small change in procedure through Unix. I have that changed procedure (prc_synonym) in proc.sql file. Want to recompile that procedure through Unix so that changes should reflect in existing procedure in... (10 Replies)
Hi everyone,
I am new to unix and bash and in need of some help.
I am writing a script that will execute a SQL query. The script runs and the SQl query runs, but I cannot figure out how to save the results as a file that can be emailed to a user. Here is my scripts thus far:
#!/bin/sh
SID=$1... (2 Replies)
hi,
Could anyone tell me how to pass the output values of the PL/SQL procedure to Shell script and how to store that values in a shell script variable...
Thanks in advance... (5 Replies)
Hi Dudes :)
I want a unix shell script to pass value to SQL stored procedure.
Below is the procedure
declare
res varchar2(10);
begin
odm_load_check('PRE_SANITY',res);
dbms_output.put_line(res);
end;
select * from error_log;
truncate table error_log;
select * from test; (1 Reply)
Here's a shell script snippet.....
cd $ORACLE_HOME/bin
Retval=`sqlplus -s <<eof
$TPDB_USER/april@$TPD_DBCONN
whenever SQLERROR exit 2 rollback
whenever OSERROR exit 3 rollback
set serveroutput on
set pages 999
var status_desc char(200)
var status_code... (1 Reply)
hai,
can anybody say how to call or to execute an oracle stored procedure in oracle from unix...
thanks in advance.... for ur reply....
by,
leo (2 Replies)
Hi
I want to get the a field from a SQL query into unix shell script variable. the whole situation is like this.
1. Opened a cursor to a table in DB2 databse.
2. Fetching individual rows with the help of cursor.
3. Each row has 4 fields.
I want each of the field in individual shell... (1 Reply)
Hi
i'm calling a pl/sql procedure which is returning one variable.
i'm trying to assing this value to variable in shell script
the code i wrote is
** in shell script**
var= 'sqlplus user/pass @ret.sql'
echo $var
**
and
variable dum_var number
exec rt_test(:DUM_VAR);
exit;
in... (4 Replies)