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
902 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
ID: 17165941
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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
dates - loop 12 57
Extract the first word (before the , ) 2 37
Oracle Public Synonyms and Privileges 2 50
'G_F01' is not a procedure or is undefined 3 12
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

930 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

9 Experts available now in Live!

Get 1:1 Help Now