Parameter in Trigger

Hi All,
I want to write a trigger on table to delete data from that table for a particular id before insert any new data for that particular id.
so how can i pass that id in trigger and how i will manage to execute this trigger once only i.e othewise it will delete 1st inserted row before inserting 2nd row and finally i will get only last inserted into table.
I hope you all got my problem.
Help me.
Thanks.
Anil Raghuvanshi

Hi,
I m working on mysql.
My table structure is as follow
id p_id feature
1 2 a
2 2 b
3 3 z
4 3 f
now i want to write a trigger on this table before inserting any new data for any p_id if data is thr in this(same) table then delete else insert the new data.
if i want to insert 3 records for p_id= 4 then they should insert and if i want to insert 4 new record for p_id=3 then first it should delete all the records for p_id =3 then it sgould insert new 4 records.
and i wrote following trigger for this
create or replace trigger test before insert on topthings
     If new.phone_id = old.phone_id then
     delete from topthings where phone_id:=new.phone_id;
     end If;
end;
It gets created but when i insert any record in table then it is giviing me error like
Can't update table 'topthings' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
Here i did't use for each row because as i insert 1st it will delete all previously exists rows then 1st inserted row before inserting 2nd row it will delete 1st inserted and finally i will get only last inserted row into table.
i hope you got my prob.
Thanks for the help.

Similar Messages

  • Report Builder 6i returns ORA-01483 in after parameter form trigger ?

    Can anybody help me ?
    I've been working on a report with report builder 6.0.8.11.3,
    and whenever i run the report the after parameter form trigger
    returns REP-1401 and following ORA-01483.
    I've been trying to change the values of some user parameters
    from within the trigger code, none of them is a date or a number
    parameter, these are character variables who would be referenced
    lexically to change a table name dynamically when the trigger
    fires. Aditionally I'm using a cursor to obtain data and then
    modify the parameters.
    How can i get this thing to work ?
    Thanks in advance for your reply...

    hello,
    this might be related to the usage of number(1) as type/length
    of your parameter. this is a known problem. it should be solved
    by using e.g. number(2) as the type/length of your parameter.
    regards,
    the oracle reports team --pw                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Calling report from form and after parameter form trigger

    Hi, I've also posted to this to the reports forum but because it works from Reports Builder it may be a forms issue which is why I'm x-posting. Apologies.
    I have a report that creates a file, desname is set in the after parameter form trigger (it uses one of the parameter values).
    The problem is file is not created using the path and filename set in the trigger, the file is created in the bin folder with the name account_by_service_type.txt (account_by_service_type.rdf is the report definition).
    If the desname is set in the before parameter form AND a field with the source=desname is added to the parameter form then the file will be created with the correct path and name however it won't have the relevant parameter incorporated into the file name obviously.
    I've noticed in other reports that where the desname is being set in the after parameter form that I've had to pass the desname from the form but obviously I cannot do that here either.
    Am I missing something obvious?
    Regards
    Sean

    Hi Frank,
    It's WebForms. Below is the code:
    -- call from menu item
    run_report_object_proc(TRUE,'accounts_by_service_type.RDF',null,FILE,'delimited','paramform=yes');
    -- run_report_0bject procedure
    PROCEDURE run_report_object_proc (p_screen IN BOOLEAN,
                        p_report_filename IN VARCHAR2,
                        p_desname IN VARCHAR2,
                        p_destype IN NUMBER,
                        p_desformat IN VARCHAR2,
                        p_paramform IN VARCHAR2)IS
    v_report_id     report_object;
    v_report     varchar2(100);
    v_job_id     varchar2(100);
    v_url          varchar2(1000);
    rep_status     varchar2(20);
    hidden_action     VARCHAR2(2000)     :='';
    BEGIN
    v_report_id := find_report_object( 'report2');
    SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_FILENAME,p_report_filename);
    SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_DESNAME,p_desname);
    SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_DESTYPE,p_destype);
    SET_REPORT_OBJECT_PROPERTY(v_report_id,REPORT_DESFORMAT,p_desformat);
    hidden_action := hidden_action||'&report='||GET_REPORT_OBJECT_PROPERTY(v_report_id, REPORT_FILENAME);
    hidden_action := hidden_action||'&destype='||GET_REPORT_OBJECT_PROPERTY(v_report_id, REPORT_DESTYPE);
    hidden_action := hidden_action||'&desformat='||GET_REPORT_OBJECT_PROPERTY(v_report_id, REPORT_DESFORMAT);
    hidden_action := hidden_action||'&userid='||GET_APPLICATION_PROPERTY(username)||'/'||GET_APPLICATION_PROPERTY(password)||'@'||GET_APPLICATION_PROPERTY(connect_string);
    if p_desname is not null then
    hidden_action := hidden_action||'&'||p_paramform||'&desname='||p_desname;
    else
    hidden_action := hidden_action||'&'||p_paramform;
    end if;
    hidden_action := '/reports/rwservlet?_hidden_server=rserv1'||hidden_action;
    SET_REPORT_OBJECT_PROPERTY(v_report_id, REPORT_OTHER, 'pfaction='||hidden_action||' '||p_paramform);
    -- SET_REPORT_OBJECT_PROPERTY(v_report_id, REPORT_OTHER, 'paramform=no');
    v_report := run_report_object( v_report_id);
    IF p_screen THEN
         v_job_id := substr(v_report,instr(v_report,'_',-1)+1);
    rep_status:=report_object_status(v_report);
    while rep_status in ('RUNNING', 'OPENING_REPORT', 'ENQUEUED')
    loop
         rep_status:=report_object_status(v_report);
    end loop;
    if rep_status='FINISHED' THEN
         v_url := '/reports/rwservlet/getjobid'||v_job_id||'?server=rserv1';
              web.show_document(v_url,'_blank');
    else
         message(rep_status||' error running report');
    end if;     
    end if;
    END;
    -- report after parameter form trigger
    function AfterPForm return boolean is
    begin
    :desname := 'c:\service_type_'||:p_service_type||'_'||to_char(sysdate,'DDMMYYYY')||'.xls';
    return (TRUE);
    end;

  • Problem in Insertion into table through After Report Parameter form trigger

    Hi All,
    I am getting problem in inserting some data into temp table through Report.
    My requirement is like that, I have to do a calculation based on user parameters, and then insert the data into the temp table. I wanted to do this into After Report Parameter form trigger function. I have done all the calculation and wrote all the insert statement in that function. There is no problem in compilation. then I am taking value from this temp table in my formula columns.
    When I run this report, it hangs, don't understand what is the problem.Can anybody help me out in this.
    Thanks,
    Nidhi

    The code is as follows:
    function AfterPForm return boolean is
    CURSOR CUR_RECEIPT(RECEIPT_NUM_FROM NUMBER, RECEIPT_NUM_TO NUMBER) IS
    SELECT DISTINCT receipt, item_no FROM xxeeg.xxeeg_1229_sp_putaway WHERE RECEIPT BETWEEN
    RECEIPT_NUM_FROM AND RECEIPT_NUM_TO ;
    V_CUR_RECEIPT CUR_RECEIPT%ROWTYPE;
    begin
    OPEN CUR_RECEIPT(:RECEIPT_NUM_FROM, :RECEIPT_NUM_TO);
    FETCH CUR_RECEIPT
    INTO V_CUR_RECEIPT;
    LOOP
    EXIT WHEN CUR_RECEIPT%NOTFOUND;
    IF V_CUR_RECEIPT.ITEM_NO = 'TEST1' AND V_CUR_RECEIPT.RECEIPT = '12' THEN
    INSERT INTO SP_TEMP
    (RECEIPT, ITEM_NO, LOCATION1)
    VALUES
    (V_CUR_RECEIPT.RECEIPT, V_CUR_RECEIPT.ITEM_NO, 10);
    UPDATE SP_TEMP
    SET LOCATION2 = 12
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    UPDATE SP_TEMP
    SET LOCATION3 = 13
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    UPDATE SP_TEMP
    SET LOCATION4 = 14
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    ELSE
    IF V_CUR_RECEIPT.ITEM_NO = 'TEST2' AND V_CUR_RECEIPT.RECEIPT = '12' THEN
    INSERT INTO SP_TEMP
    (RECEIPT, ITEM_NO, LOCATION1)
    VALUES
    (V_CUR_RECEIPT.RECEIPT, V_CUR_RECEIPT.ITEM_NO, 10);
    UPDATE SP_TEMP
    SET LOCATION2 = 16
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    UPDATE SP_TEMP
    SET LOCATION3 = 17
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO =V_CUR_RECEIPT.ITEM_NO;
    UPDATE SP_TEMP
    SET LOCATION4 = 18
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    ELSE
    INSERT INTO SP_TEMP
    (RECEIPT, ITEM_NO, LOCATION1)
    VALUES
    (V_CUR_RECEIPT.RECEIPT, V_CUR_RECEIPT.ITEM_NO, 10);
    UPDATE SP_TEMP
    SET LOCATION2 = 19
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    UPDATE SP_TEMP
    SET LOCATION3 = 20
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO =V_CUR_RECEIPT.ITEM_NO;
    UPDATE SP_TEMP
    SET LOCATION4 = 21
    WHERE RECEIPT = V_CUR_RECEIPT.RECEIPT AND ITEM_NO = V_CUR_RECEIPT.ITEM_NO;
    END IF;
    END IF;
    END LOOP;
    COMMIT;
    CLOSE CUR_RECEIPT;
    return(TRUE);
    end;
    .....................................................................................................................

  • Parameter not being set in before parameter form trigger

    I am running 10g reports over the web and have a problem with some parameters. I have a User parameter which I set in the BEFORE-PARAMETER-FORM trigger. This parameter is not displayed on the parameter form because it shouldn't ever be changed by a user. It is supposed to be displayed on the report output to show who ran the report, but it is appearing blank.
    I've found that if I physically display the parameter on the parameter form it works, but this isn't a realistic option. It looks like it gets cleared out if it isnt displayed on the parameter form. Can anyone explain why and offer any help?

    Assign value to the parameter in the After Parameter Form Trigger, not Before.

  • Difference between After parameter Form Trigger and before Report Trigger

    hi,
    Can some one tell me difference between After parameter form Trigger and Before parameter trigger.
    Why do we need both these trigger , why can't we use any one of them because after parameter trigger will obviously fire before report trigger and similarly before report trigger will fire after parameter form.
    Thanks
    Ram

    Hi,
    i will make it clear..!
    Actually, we have four type of triggers in reports..!
    Before Parameter -- fires before params are suppied to the calling report..
    After Parameter -- fires after params are suppied to the calling report..
    Before Report -- fires before report is generated..
    After Report. -- fires after report is generated..
    Before Report and After Report triggers are used for formatting the report design..
    like u can specify a report to be displayed based on a condition in the Before
    Report trigger and u can specify some backend updations in the after report trigger
    which fires after report is generated..

  • Trouble with calling a stored procedure with VARCHAR parameter from trigger

    Hi everybody,
    today I ran across a problem with stored procedures and triggers that try to call them. Background info: I want to log changes in certain tables to another table in a trigger, so I can replicate the changes to another (non-Oracle) database in an asynchronous way. As an example I have the first data table "bak_s3_berufliste" and the table to store the changes in is "bak_s3_change_request".
    DROP TABLE BAK_S3_BERUFLISTE;
    CREATE TABLE bak_s3_berufliste (
    id_bl NUMBER(27,0) NOT NULL,
    berufsbez VARCHAR2(255),
    CONSTRAINT PK_BAK_S3_BERUFLISTE PRIMARY KEY (id_bl) ENABLE);
    DROP TABLE bak_s3_change_request;
    CREATE TABLE bak_s3_change_request (
    ID_CR NUMBER(27,0) NOT NULL,
    TABELLE_NAME VARCHAR2(50) NOT NULL,
    TABELLE_ID_ALT NUMBER(27,0),
    TABELLE_ID_NEU NUMBER(27,0),
    CONSTRAINT PK_BAK_S3_CHANGE_REQUEST PRIMARY KEY (ID_CR) ENABLE);
    DROP SEQUENCE seq_bak_s3_change_request;
    CREATE SEQUENCE seq_bak_s3_change_request;
    For testing purposes I created the following stored procedure and trigger:
    CREATE OR REPLACE PROCEDURE schreibe_cr (t_id_alt IN NUMBER, t_id_neu IN NUMBER) IS
    BEGIN
    INSERT INTO bak_s3_change_request(ID_CR, TABELLE_NAME, TABELLE_ID_ALT, TABELLE_ID_NEU)
    VALUES (seq_bak_s3_change_request.NEXTVAL, t_name, t_id_alt, t_id_neu);
    END;
    CREATE OR REPLACE TRIGGER trg_bak_s3_berufliste
    BEFORE INSERT OR UPDATE OR DELETE ON bak_s3_berufliste
    FOR EACH ROW
    call schreibe_cr(:old.id_bl,:new.id_bl)
    *... and everything worked perfectly - except from the fact that I need to know which table had changed of course. So I added another parameter to the stored procedure:*
    CREATE OR REPLACE PROCEDURE schreibe_cr (t_name IN VARCHAR2, t_id_alt IN NUMBER, t_id_neu IN NUMBER) IS
    BEGIN
    INSERT INTO bak_s3_change_request(ID_CR, TABELLE_NAME, TABELLE_ID_ALT, TABELLE_ID_NEU)
    VALUES (seq_bak_s3_change_request.NEXTVAL, t_name, t_id_alt, t_id_neu);
    END;
    and tested it:
    CALL schreibe_cr('Test',1,2);
    *... successfully. So I also added the parameter to the trigger:*
    CREATE OR REPLACE TRIGGER trg_bak_s3_berufliste
    BEFORE INSERT OR UPDATE OR DELETE ON bak_s3_berufliste
    FOR EACH ROW
    call schreibe_cr('Tabellenname',1,2)
    and what i get is:
    Error starting at line 31 in command:
    CREATE OR REPLACE TRIGGER trg_bak_s3_berufliste
    BEFORE INSERT OR UPDATE OR DELETE ON bak_s3_berufliste
    FOR EACH ROW
    call schreibe_cr('Tabellenname',1,2)
    When I try to insert something into that table I get the following error:
    insert into bak_s3_berufliste (id_bl, berufsbez) values (seq_bak_s3_change_request.NEXTVAL, 'tueduelue');
    Error report:
    ORA-00911: Ungültiges Zeichen
    00911. 00000 - "invalid character"
    Cause: identifiers may not start with any ASCII character other than
    letters and numbers. $#_ are also allowed after the first
    character. Identifiers enclosed by doublequotes may contain
    any character other than a doublequote. Alternative quotes
    (q'#...#') cannot use spaces, tabs, or carriage returns as
    delimiters. For all other contexts, consult the SQL Language
    Reference Manual.
    Action:
    I tried everything that came to my mind, like using double-quotes (") instead of quotes (') in the trigger code or escaping the quotes (\'), but nothing worked. Can anybody help my and tell me what's wrong? After googling for hours I'm outta ideas :-(
    Any ideas appreciated!
    Thanks in advance,
    Jens

    Why?
    Are you looking for this?
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    Elapsed: 00:00:01.61
    satyaki>
    satyaki>
    satyaki>create table aud_dup_emp
      2     as
      3       select empno, ename
      4       from dup_emp
      5       where 1=2;
    Table created.
    Elapsed: 00:00:01.86
    satyaki>
    satyaki>select * from dup_emp;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          9999 SATYAKI    SLS             7698 02-NOV-08      55000       3455         10
          7777 SOURAV     SLS                  14-SEP-08      45000       3400         10
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-81       4450                    10
          7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
          7839 KING       PRESIDENT            17-NOV-81       7000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
          9999 SATYAKI    SLS             7698 02-NOV-08      55000       3455         10
          7777 SOURAV     SLS                  14-SEP-08      45000       3400         10
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
    18 rows selected.
    Elapsed: 00:00:00.10
    satyaki>
    satyaki>
    satyaki>create or replace procedure ins_aud_dup(eno in number, enm in varchar2)
      2     is
      3     begin
      4       insert into aud_dup_emp(empno,ename) values(eno,enm);
      5     end;
      6  /
    Procedure created.
    Elapsed: 00:00:03.36
    satyaki>
    satyaki>
    satyaki>
    satyaki>ed
    Wrote file afiedt.buf
      1  create or replace trigger trg_aud_dup
      2  before insert on dup_emp
      3     for each row
      4     begin
      5       ins_aud_dup(:old.empno,:new.ename);
      6*    end;
    satyaki>/
    Trigger created.
    Elapsed: 00:00:01.47
    satyaki>
    satyaki>
    satyaki>select * from aud_dup_emp;
    no rows selected
    Elapsed: 00:00:00.10
    satyaki>
    satyaki>
    satyaki>insert into dup_emp(empno,ename,deptno) values(8855,'BILLY',40);
    1 row created.
    Elapsed: 00:00:00.19
    satyaki>
    satyaki>commit;
    Commit complete.
    Elapsed: 00:00:00.03
    satyaki>
    satyaki>
    satyaki>select * from dup_emp;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          9999 SATYAKI    SLS             7698 02-NOV-08      55000       3455         10
          7777 SOURAV     SLS                  14-SEP-08      45000       3400         10
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-81       4450                    10
          7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
          7839 KING       PRESIDENT            17-NOV-81       7000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
          9999 SATYAKI    SLS             7698 02-NOV-08      55000       3455         10
          7777 SOURAV     SLS                  14-SEP-08      45000       3400         10
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          8855 BILLY                                                                   40
    19 rows selected.
    Elapsed: 00:00:00.20
    satyaki>
    satyaki>select * from aud_dup_emp;
         EMPNO ENAME
               BILLY
    Elapsed: 00:00:00.09
    satyaki>Regards.
    Satyaki De.

  • Pass parameter to trigger

    Hi
    Here is my scenario:
    I have a UI that calls stored procedure to do an update or a delete and an insert in a table. I need a trigger on update or delete to insert records in the audit table. This is clear to me. What is not clear to me is that:
    I need to store the name of the user who updated/deleted/inserted the table. However how can I pass that to the trigger such that I can store the user name who performed the operation in the audit table?
    The sequence is:
    UI --> Stored procedure --> updates/Deletes-Inserts in Table1 --> Trigger fired --> Insert the old record into the audit table
    The audit table has a column user. Even if I pass the user name to the stored procedure, how can I pass it further down to the trigger?

    Hi,
    Try to Call the procedure in trigger. from trigger body try to send get the user name who had done the inser/delete/update and pass it on as a parameter to procedure.
    you can get the current by the following
    SYS_CONTEXT('USERENV','SESSION_USER');
    UI --> Stored procedure --> updates/Deletes-Inserts in Table1 --> Trigger fired (call to procedure with parameter) --> Insert the old record into the audit table
    - Pavan Kumar N

  • After Parameter Form trigger failed

    REP-0771. I have the trigger returning to false on a condition, however, this is when I get the error. All I want to do is return to the parameter form, and it's giving me an error. Is there any way to suppress this error?

    Hi Maggie
    To validate a parameter value at runtime:
    1. In the Object Navigator, expand the Data Model node, then the System Parameters or User Parameters node.
    2. Double-click the PL/SQL icon for the parameter for which you want to add a PL/SQL validation trigger.
    3. In the PL/SQL Editor, define the PL/SQL to be triggered at runtime
    Validation triggers are used to validate the Initial Value property of the parameter. Depending on whether the function returns TRUE or FALSE, the user is returned to the Runtime Parameter Form.
    Thanks
    Rohit

  • Reports 10g problem: Before parameter form trigger(BPFT) problem

    In report bilder there is no problem - I get parameter form wit all the parameters, I initialized in BPFT
    function BeforePForm return boolean is
    s_date date;
    begin
    s_date := Trunc(SYSDATE);
    if :PAR_TEM_OD is null then
         :PAR_TEM_OD := '1';
    end if;     
    if :PAR_TEM_DO is null then
         :PAR_TEM_DO := '9';
    end if;     
    if :PAR_DAT_OD is null then
         :PAR_DAT_OD := s_date ;
    end if;     
    if :PAR_DAT_Do is null then
         :PAR_DAT_Do := s_date ;
    end if;     
    return (TRUE);
    end;
    PAR_DAT_... is data type DATE wit input mask DD.MM.YYYY.
    REPORT crashes when I run it from forms - no parameter form is displayed. When I initialize only CHAR PARAMETERS IN BPFT then I get result - parameter form is displayed. . The problem is when I want to initailize DATE parameters.
    Any idea?
    Gordan

    Why are you using srw.do_sql here? You are just performing some sql and pl/sql statements here. This is an explanation of do_sql in the Report Builder Help:
    "Since you cannot perform *DDL statements* in PL/SQL, the SRW.DO_SQL packaged procedure is especially useful for performing them within Report Builder, instead of via a user exit."
    So, your code would simply be:
    function BeforePForm return boolean is
      segment2 varchar2(10);
    begin
      select segment1
      into segment2
      from xxmssl_po_headers_all
      where rownum<2;
    ... etc. ...
    end;

  • Trigger with parameter

    Hi
    I have a trigger which should execute when a particular field is updated.That trigger should call a procedure which has a parameter.I am facing some problems in this.
    This is the trigger
    create or replace trigger test_trig after update of acc_status on user_details
    for each row
    begin
    Inbox_limit(login_id varchar2);
    end;
    Is is possible to pass parameter to trigger
    Regards
    Rose

    If you are talking about updating the same row, you should use BEFORE UPDATE trigger and change the value of :new record. Something likes
    :new.avgcost := :old.avgcost * ...
    If you are talking about updating rows other than the one fired the trigger, Oracle does not allow. And you will receive error talking about violation on accessing a mutating table.
    Steve

  • Need to display a value before the header based on a user parameter.

    I have a select on the user parameter list of values.
    SELECT DISTINCT GROUP_ROWID, STR_GROUP_NAME
    FROM TBL_COMPANY_GROUP;
    I select the option hide the first column in order to show only a list of values and not the row_ids.
    I need to display the str_group_name within the header as a title. I insert a field in the header and in source select the name of the parameter p_groupid but the only thing that I get is the row_id value not the name. I use the row_id to pass it on my queries but I need the name value in the header. Any ideas? Please help.
    Thanks.

    create a parameter called p_header.
    in the after parameter form trigger
    select str_group_name into :p_header
    from tbl_company_group
    where group_id = :p_groupid;Have the header field source be p_header.

  • Lexical parameter in select statement showing null or column name in xml tag instead of value

    Hi,
    i am using lexical parameter in report select statement as
    Select &order value from oe_order_headers_all a where order_number ='7889'
    and setting  : order:='a.order_number';  in after parameter form trigger.
    lexical parameter intial value set to null
    when i run this report , its not showing order number in output ,its showing null or a.order_number as text.
    Please help.

    try this
    Select &order data_show
    from oe_order_headers_all
    where order_number ='7889'
    and setting  :order:='order_number';  in after parameter form trigger.
    Hope this helps
    Hamid

  • REP-50134 occurs when using the submit button on the Reports Parameter Form

    Good Morning,
    I get the "REP-50134: Cache subitem reports does not exist" error after clicking on the Submit Button from a Reports parameter form.
    I am using Forms/Reprots 9i.
    Using the source code given in the Whitepaper 'Oracle Forms Services - Using Run_Report_Object() to call Reports with a parameter form', all works well when paramform=no, but when I have a Form print a report with paramform=yes, the parameter form appears correctly, but generates the error after clicking the Submit Button.
    Any inputs as to causation or possible places to look to solving this problem would be greatly appreciated.
    Thank you

    Hello and thanks.
    The value in the tag is <form method=post action="reports?">
    Looking at this I suspect my problem is related to this setting. I am trying to follow all the instructions in the White Papers but they are a little confusing as they are not all exactly the same. Each attempts to explain a specific functionality without regards to the whole.
    For instance I believe I need to have the variables P_ACTION, P_USER_CONNECT and P_SERVER_NAME in the report being called and then add a Before Parameter Form trigger to reset the values. But this seems to duplicate and override what has already been sent via the REPORT_OTHERS property. It is a tad bit confusing.
    Can you confirm?
    Thanks for any clarification you can provide.

  • Rep-52005 error when running a report from form with parameter form

    I am trying to run a report from a web deployed form and this report has a parameter form. I am getting a Rep-52005: The specified key report does not exist in key map file.
    I am using Oracle Forms/Reports 10.1.2.0.2. My code is below. The first part works fine where I run a report with no parameter form, but the second part when I have a parameter form gets the about error.
    PROCEDURE call_report (
    p_report_name VARCHAR2,
    p_reportobj_name VARCHAR2 DEFAULT NULL,
    p_parameter_list paramlist DEFAULT NULL,
    p_parameter_string VARCHAR2 DEFAULT NULL
    IS
    repid report_object;
    v_rep VARCHAR2 (100);
    rep_status VARCHAR2 (100);
    v_report_url VARCHAR2 (240);
    v_interface VARCHAR2 (50);
    v_report_parameter VARCHAR2 (1);
    vc_user_name VARCHAR2 (100);
    vc_user_password VARCHAR2 (100);
    vc_user_connect VARCHAR2 (100);
    vc_connect VARCHAR2 (300);
    v_reportserv VARCHAR2 (30);
    v_job_number number;
    BEGIN
    /* Get the database to run the report against and
    find out if the report has any parameters */
    SELECT report_parameter_flag
    INTO v_report_parameter
    FROM program_list
    WHERE program_type = 'REPORTS'
    AND UPPER (screen_id) = UPPER (p_report_name);
    vc_user_name := get_application_property (username);
    vc_user_password := get_application_property (password);
    vc_user_connect := get_application_property (connect_string);
    v_reportserv := 'rep_xxxx_ias10g_home';
    v_report_url := 'http://xxxx.state.il.us';
    v_job_number := length(v_reportserv) +2;
    vc_connect :=
    vc_user_name
    || '/'
    || vc_user_password
    || '@'
    || vc_user_connect;
    v_interface := get_application_property (user_interface);
    IF ( v_interface = 'WEB'
    AND v_report_parameter = 'N'
    THEN
    repid := find_report_object(p_reportobj_name);
    set_report_object_property (repid, report_comm_mode, synchronous);
    set_report_object_property (repid, report_destype, cache);
    set_report_object_property (repid, report_desformat, 'pdf');
    -- v_reportserv := get_report_object_property (repid,report_server);
    set_report_object_property (repid, report_server, v_reportserv);
    set_report_object_property (repid, report_other, p_parameter_string);
    v_rep := run_report_object (repid);
    rep_status := report_object_status (v_rep);
    IF rep_status = 'FINISHED'
    THEN
    web.show_document (
    v_report_url
    || '/reports/rwservlet/getjobid='
    || substr(v_rep,v_job_number)
    || '?server='
    || v_reportserv
    ,'_blank'
    ELSE
    message ( rep_status
    || 'Report output aborted');
    END IF;
    ELSIF ( v_interface = 'WEB'
    AND v_report_parameter = 'Y'
    THEN
    repid := find_report_object (p_reportobj_name);
    set_report_object_property (repid, report_comm_mode, synchronous);
    set_report_object_property (repid, report_destype, cache);
    set_report_object_property (repid, report_desformat, 'pdf');
    set_report_object_property (repid, report_server, v_reportserv);
    set_report_object_property (
    repid,
    report_other,
    'paramform=yes P_USER_CONNECT='
    || vc_connect
    || ' P_SERVERNAME='
    || v_reportserv
    || ' P_ACTION='
    || v_report_url
    || '/reports/rwservlet'
    v_rep := run_report_object (repid);
    rep_status := report_object_status (v_rep);
    IF rep_status = 'FINISHED'
    THEN
    web.show_document (
    v_report_url
    || '/reports/rwservlet/getjobid='
    || substr(v_rep,v_job_number)
    || '?server='
    || v_reportserv
    ,'_blank'
    ELSE
    message ( rep_status
    || 'Report output aborted');
    END IF;
    ELSE
    run_product (
    reports,
    p_report_name,
    synchronous,
    runtime,
    filesystem,
    p_parameter_list,
    NULL
    END IF;
    EXCEPTION
    WHEN OTHERS
    THEN
    message (SQLERRM);
    END;
    My parameter form comes up and I enter the necessary information and hit submit query button. Then I get the Rep-52005: The specified key report does not exist in key map file.
    Any help will be greatly appreciated!!
    Shellie Bricker

    Your code seems to be implementing metalink note 139546.1 - Using Reports parameter forms with RUN_REPORT_OBJECT on the web.
    For what I can see, the P_ACTION parameter should end in ?...
    i.e.
    P_ACTION=http://<hostname.domain:port>/reports/rwservlet?'
    set_report_object_property (
    repid,
    report_other,
    'paramform=yes P_USER_CONNECT='
    || vc_connect
    || ' P_SERVERNAME='
    || v_reportserv
    || ' P_ACTION='
    || v_report_url
    || '/reports/rwservlet?'
    );If this does not fix your problem, then to troubleshoot further you would have to post the code in your Before Parameter Form trigger of your report.
    Hope this helps,
    UPDATE:
    If the above does not fix your problem, my guess is that report name is not being generated in the hidden runtime values build by the code in the Before Parameter Form trigger.
    i.e.
    http://localhost:8889/reports/rwservlet?report=&destype=cache&desformat=PDF
    The above code will throw error REP-52005: The specified key report does not exist in key map file.
    Edited by: Rodolfo Ferrari on Jul 8, 2009 9:43 PM

Maybe you are looking for

  • Jaccal first release

    A new post in this forum to let you know that we have just released Jaccal 1.0.0. Please check the website for more information. More exciting things to come in the coming months ! http://jaccal.sourceforge.net/ But what is Jaccal by the way ? Jaccal

  • Too many bugs to isolate a bug when swithching from Alt-F1 to Alt-F7

    First, I consider Linux to be the less buggy OS out there. Well, Windows would be less buggy, but it does not really exist, since you have to pay to use it. Still, I use to consider Linux very buggy. This opinion I hold true more than ever. Here is m

  • Setting up prefs for code view fonts and sizes

    using cs5 i copied some pages in from another computer... the fonts and sizes in code view are too small. in prefs - fonts - I made them bigger - then said apply source formatting but they don't always seem to stick - maybe the next day they are smal

  • HTML DB HTML (Anchor Tag)

    Hello everyone, I have a target of icon which enables me to open a Web page located in a repertory of my network. I would like to be able according to the place that I am in my application, to reach a place in page HTML (ANCHOR tag). I put in page HT

  • Can't see any more my messages from the differents mailbox

    I have 5 mailbox (see image screen at beginning) and usually I can go from one to another seing a navigation volet (french term sorry) and I don't know what happen, I'm in one of them, impossible to see the others (see screan now) and to go in the ot