Solved

Create an Oracle Function within Report builder.  I need to create a before trigger and then a after trigger with in rdf

Posted on 2006-07-21
3
897 Views
Last Modified: 2013-12-12
I need to create a before trigger that looks at a table to see if a row exists if it does exists then it needs to check a field to see if the field is a valid code.

If a valid code is found then the rdf / report can run.  If not a valid code then the report should fail.


after trigger if a valid code is found then the report runs then after the report runs then a after trigger is fired that
changes the valid code to a invalid code.

How can I do this within the report.
0
Comment
Question by:ValeneSue
3 Comments
 
LVL 12

Accepted Solution

by:
jwahl earned 500 total points
Comment Utility
if there are no possibilities to make the checks before report is started, you could place a trigger like this in the BEFORE PARAMETER FORM trigger (the trigger is the first one to be executed when report starts):

DECLARE
    v_cnt NUMBER;
BEGIN
    --
    -- here we check if row exists:
    --
    SELECT COUNT(*)
    INTO v_cnt
    FROM <your_table>
    WHERE <your_conditions>;
    --
    IF v_cnt > 0 THEN
        -- data found; do nothing:
        NULL;
    ELSE
        -- no data found; raise error and exit report:
       SRW.MESSAGE(100, 'No data found ... exit report ...');
       RAISE SRW.PROGRAM_ABORT;
    END IF;
END;

in the AFTER REPPORT TRIGGER place a trigger like this:

BEGIN
    UPDATE <your_table> -- OR INSERT/DELETE ....
    SET <your_column> = '<your_value>'
    WHERE <your_condition>;
    --
    COMMIT;
    --
END;

good luck!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now