Home » Infrastructure » Unix » Calling function from Unix
Calling function from Unix [message #118263] Tue, 03 May 2005 22:22 Go to next message
Hina
Messages: 51
Registered: April 2004
Member

I have to write a script in PL/SQL where process some records reading from table.
All processed and rejected record has to be logged in log file.

My function will be calling from Unix by a shell script.

I have no clue how its going to be.

Can someone give me a thought and a example.

Thanks

Re: Calling function from Unix [message #118401 is a reply to message #118263] Wed, 04 May 2005 20:58 Go to previous messageGo to next message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
this would be the easiest if you don't really need a function:
sqlplus -s scott/tiger@db @my_script.sql

my_script.sql
=============
set echo off
set pagesize 0
set linesize 80
set trimspool on
spool \tmp\mylog_processed.log
select to_char(sysdate, dd-mon-yyyy'), 'Processed records...' from dual;
select * from T1 where STATUS='PROCESSED';
spool \tmp\mylog_rejected.log
select * from T1 where STATUS='REJECTED';
spool off
Re: Calling function from Unix [message #118407 is a reply to message #118401] Wed, 04 May 2005 22:50 Go to previous messageGo to next message
Hina
Messages: 51
Registered: April 2004
Member
Thanks, but I have to call a function written in a package, and processed and rejected record has to be logged in a log file that store in unix server.

My question is how to write a log file using 'UTL_FILE' ?

Please give me a example.

Regards

Re: Calling function from Unix [message #118498 is a reply to message #118407] Thu, 05 May 2005 11:01 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
http://www.orafaq.com/scripts/plsql/utlfile.txt
Previous Topic: How to launch Enterprise Manager Console on HPUX 11.23 IA64 systems?
Next Topic: how to call a package from Unix
Goto Forum:
  


Current Time: Fri Apr 19 23:50:38 CDT 2024