Xref: alice comp.databases.oracle.tools:32434
Path: alice!news-feed.fnsi.net!newsfeed.icl.net!colt.net!news.belnet.be!krypton.inbe.net!INbe.net!newsfeed2.news.nl.uu.net!sun4nl!news.worldonline.nl!not-for-mail
From: Pieter Steenhuis <pieter.steenhuis@worldonline.nl>
Newsgroups: comp.databases.oracle.tools
Subject: Re: Help!!! Pl/SQL and Report
Date: Fri, 24 Sep 1999 00:08:38 +0200
Organization: WorldOnline News server
Lines: 63
Message-ID: <37EAA4E6.B22BF349@worldonline.nl>
References: <7se4n9$q2j$1@nnrp1.deja.com>
Reply-To: pieter.steenhuis@worldonline.nl
Mime-Version: 1.0
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: news.worldonline.nl 938124035 22080 195.241.236.14 (23 Sep 1999 22:00:35 GMT)
X-Complaints-To: newsmaster@worldonline.nl
NNTP-Posting-Date: 23 Sep 1999 22:00:35 GMT
To: tianh@my-deja.com
X-Mailer: Mozilla 4.61 [en] (Win95; I)
X-Accept-Language: nl,nl-BE,en,en-GB,en-US

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi,
<p>The trick is to store the data in the temporary table by executing PL/SQL
in the before report trigger, something like this:
<p>BEFORE_REPORT
<p>function before_reporttrigger return boolean is
<br>&nbsp;&nbsp; cursor c_tab
<br>&nbsp;&nbsp; is select tab.col1
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
tab.col2
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
tab.col3
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from&nbsp;&nbsp; my_table&nbsp;&nbsp;
tab
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; where&nbsp; &lt;condition>
<br>&nbsp;&nbsp; ;
<br>begin
<br>&nbsp;&nbsp; for r_tab in c_tab
<br>&nbsp;&nbsp; loop
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; insert into temp_table
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ( col1
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , col2
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , col3
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ) values
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ( r_tab.col1
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , r_tab.col2
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; , r_tab.col3
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; )
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;
<br>&nbsp;&nbsp; end loop;
<br>&nbsp;&nbsp; commit;
<br>&nbsp;&nbsp; return true;
<br>end;
<p>The return statement is necessary because the trigger is a function.
If it returns false, the report won't run. This is convenient when the
cursor doesn't return any rows and the report would end up empty anyway.
<p>In the after report trigger you might want to delete the data from the
temp table.
<p>That's how it's done, generally. This is also a very nice trick to make
reports generation from Designer a lot easier..
<p>I hope this helped.
<p>Pieter Steenhuis
<p>Oracle consultant
<br>Redwood Software &amp; Services B.V.
<br>The Netherlands
<br><a href="http://www.redwoodsw.com">Learn about our information lifecycle
management suite at www.redwoodsw.com</a>
<p>tianh@my-deja.com wrote:
<blockquote TYPE=CITE>I need to create a report, which has to incorporate
the PL/SQL to
<br>process the data.
<p>But if in the procedure, either I use Cursor Or Tempory Table to store
<br>the data which has been process, How can I refer to those data stored
in
<br>Cursor or Temp_Table? ----The report need to retrieve the data from
<br>Temp_table or Cursor.
<p>I am anxious to get help, and appreciate very much for any advice.
<p>Helen
<p>Sent via Deja.com <a href="http://www.deja.com/">http://www.deja.com/</a>
<br>Share what you know. Learn what you don't.</blockquote>
</html>

