Reading PL/SQL output online from perl??

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Reading PL/SQL output online from perl??
# 1  
Old 10-28-2009
Reading PL/SQL output online from perl??

Hi there,

I got this situation at job. First i have a Perl script that connect to Oracle 10g and execute a package. That package execute severals transactions and must generate log about process status each interval of time.

What i'm doing now is saving the plsql package log in an auxiliar table and after it ends and return the control to perl, i read that log table and write on my fisical log file.

But what i need is a way to directly write on my log file even while the plsql package is still executing.

I got an idea Smilie, make other perl that goes reading the log table on database and writing to log file parallel to the package execution, but i got no data on that table for other sessions until i commit and i cannot commit with the package until it ends OK.

Any idea, Thanks,
# 2  
Old 10-28-2009
Until the package commits, you cannot see anything it put into a table, regardless of what your perl script may be doing.

If you need to see the changes, either change the pl/sql script to commit after every transaction, so your perl script can see it, or change the package itself to do the edits. It makes more sense, design-wise, to have the pl/sql package edit the changes - it should have gotten them correct to start with.
# 3  
Old 10-30-2009
Thanks Jim,
Well, what i'm going to do is change the pl/sql to commit after every transaction.

Would you like I'll let you know about the tests and result?
# 4  
Old 10-30-2009
But what i need is a way to directly write on my log file even while the plsql package is still executing.
Have a look at the utl_file package which provides functions for handling files via PL/SQL.
# 5  
Old 10-30-2009
Originally Posted by cero
Have a look at the utl_file package which provides functions for handling files via PL/SQL.
I know about utl_file package, but the database server and scripts server are different machines. I don't know how to manage remote file with utl_file and what would happen when if the pl/sql script and the Perl script attempt to write to the file at the same time and keep the loggin time sequence. Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Storing multiple sql queries output into variable by running sql command only once

Hi All, I want to run multiple sql queries and store the data in variable but i want to use sql command only once. Is there a way without running sql command twice and storing.Please advise. Eg : Select 'Query 1 output' from dual; Select 'Query 2 output' from dual; I want to... (3 Replies)
Discussion started by: Rokkesh
3 Replies

2. Shell Programming and Scripting

Reading Multi Line SQL in UNIX

Hello, Currently, I am reading few queries from the below .sql file --SOURCE TABLE NAME --SOURCE QUERY SEL COL1, COL2, COL3, COL4, COL5, COL6, COL7 WHERE COL5 = '2015-11-04 16:24:00.000000' FROM SOURCE TABLE; --TARGET TABLE NAME --TARGET QUERY SEL COLUMN1, COLUMN2, COLUMN3, COLUMN4,... (4 Replies)
Discussion started by: ronitreddy
4 Replies

3. Shell Programming and Scripting

Perl :: reading values from Data Dumper reference in Perl

Hi all, I have written a perl code and stored the data into Data structure using Data::Dumper module. But not sure how to retreive the data from the Data::Dumper. Eg. Based on the key value( Here CRYPTO-6-IKMP_MODE_FAILURE I should be able to access the internal hash elements(keys) ... (1 Reply)
Discussion started by: scriptscript
1 Replies

4. Shell Programming and Scripting

Reading values from sql query

I have sql query in shell script. select distinct account_no from adj order by account_no; This query returns account number daily.Sometimes it may return 90 rows sometime it may return 1 row only and someday it may return 0 rows I am storing the output of this query in sql_output.txt. ... (5 Replies)
Discussion started by: rafa_fed2
5 Replies

5. Shell Programming and Scripting

Awk script to run a sql and print the output to an output file

Hi All, I have around 900 Select Sql's which I would like to run in an awk script and print the output of those sql's in an txt file. Can you anyone pls let me know how do I do it and execute the awk script? Thanks. (4 Replies)
Discussion started by: adept
4 Replies

6. UNIX and Linux Applications

Online insert MySQL rows by perl-script

Hello, Met a problem when I tried to insert rows to MySQL database from an old book that fits my learning level (MySQL and Perl for the Web, by Paul DuBois, 2001). First, under mysql console I created a database: webdb and the table: todo. Then I draft the perl-cgi script to have online page.... (0 Replies)
Discussion started by: yifangt
0 Replies

7. Shell Programming and Scripting

Reading values from a file using DB2 SQL

I have some alphbetical codes in that (1 Reply)
Discussion started by: kavithakuttyk
1 Replies

8. Shell Programming and Scripting

need help in reading a output of a sql query in unix script

i'm used a sql query in a unix script to get the information from table. but unable to extract the output which i need. Any help with logic will be greatly appreciated. my sql query provide output some thing like this - col1 col2 count ---- ---- ------ A B 10 c D 6 e... (8 Replies)
Discussion started by: pharos467
8 Replies

9. Shell Programming and Scripting

PERL Online Resources

Could someone suggest some good on-line PERL resources? tutorials and References? Thanks. Gregg (1 Reply)
Discussion started by: gdboling
1 Replies

10. UNIX for Advanced & Expert Users

Perl - Programmers manual online?

I have never programmed in Perl (insert laughter, mock, etc. here ____) - so I need a sort of "Programming in Perl" covering the basics. I now have two Perl books, one is a 5 volume Unix resource kit, the other is "Mastering algorithms with Perl" - none of them explains how to produce "hello,... (11 Replies)
Discussion started by: AtleRamsli
11 Replies
Login or Register to Ask a Question

Featured Tech Videos