Table of deployment without using triggers

Hi all

I am trying to run this script:
CREATE OR REPLACE PROCEDURE att20_procedure AS

CURSOR att20_update IS
SELECT attribute20
OF per_time_periods
WHERE attribute20! = periods_to_go (payroll_id, time_period_id, period_num) FOR the UPDATE;

att20 per_time_periods.attribute20%TYPE;


BEGIN

OPEN att20_update.
LOOP
SEEK att20_update INTO att20;
UPDATE per_time_periods
SET attribute20 = periods_to_go (payroll_id, time_period_id, period_num)
WHERE CURRENT OF att20_update;
dbms_output.put_line (' is the new value of the attribute 20 ' | att20);
END LOOP;
CLOSE Att20_update;

END;
/

exec att20_procedure;

To update the per_time_periods table.

But I get this error now:

Error at startup on line 28 of the command:
exec att20_procedure
Error report:
ORA-04091: table HR. PER_TIME_PERIODS is changing, function of triggering/can not see
ORA-06512: at the 'APPS '. PERIODS_TO_GO', line 7
ORA-06512: at the 'APPS '. PERIODS_TO_GO', line 29
ORA-06512: at the 'APPS '. ATT20_PROCEDURE', line 16
ORA-06512: at line 1
04091 00000 - "table %s.%s is changing, function of triggering/can not see.
* Cause: A trigger (or plsql user-defined function that is referenced in)
This statement) attempted to watch (or modify) a table that has been
in the Middle being modified by the statement that shot.
* Action: Rewrite the trigger (or function) so it does not read this table.

I am also using a stored function that was created with the following script:

CREATE OR REPLACE
FUNCTION periods_to_go (p_payroll_id in NUMBER,
p_time_period_id in NUMBERS
p_period_num in NUMBER) RETURN NUMBER IS
NUMBER of att20;

CURSOR get_remaining_time_periods IS
SELECT time_period_id, period_num
OF per_time_periods
WHERE time_period_id > = p_time_period_id
AND payroll_id = p_payroll_id
UNION
SELECT 99999999 'time_period_id', 'period_num' 99999999
OF the double
ORDER BY 1, 2;
c_grtp_row get_remaining_time_periods % ROWTYPE;

f_last_period_num NUMBER: = 0;
f_last_time_period_id per_time_periods.time_period_id%TYPE;
f_end_year_time_period_id per_time_periods.time_period_id%TYPE;
f_period_num per_time_periods.period_num%TYPE;


BEGIN

f_last_period_num: = p_period_num;
f_last_time_period_id: = p_time_period_id;
f_end_year_time_period_id: = 0;

FOR c_grtp_row IN get_remaining_time_periods LOOP

IF ((c_grtp_row.period_num < f_last_period_num OR))
c_grtp_row.period_num = 99999999) AND
f_end_year_time_period_id = 0) THEN

f_end_year_time_period_id: = f_last_time_period_id;

END IF;


f_last_time_period_id: = c_grtp_row.time_period_id;
f_last_period_num: = c_grtp_row.period_num;

END LOOP;

BEGIN
SELECT COUNT (*)
IN att20
OF per_time_periods
WHERE payroll_id = p_payroll_id
AND time_period_id > p_time_period_id
AND time_period_id < = f_end_year_time_period_id;
RETURN att20;
END;

END;
/

Any help would be greatly appreciated!

Published by: 841780 on March 4, 2011 04:41

Change your cursor for select payroll_id, time_period_id, period_num and remove the "updates". If none of those are the primary key, select the primary key as well. Then set a variable to periods_to_go (payroll_id, time_period_id, period_num), then update the table set nom_de_variable = attribute20 where primary_key = cursor_name.primary_key.

Tags: Database

Similar Questions

  • Solution for the mutation of table of error when using triggers

    Hello

    Could you please give the solution for the error table mutation during the use of triggers. I'll give you the simple scenario here,

    I created a trigger on the employees table, whenever all DML operations takes place in the employees table, it must run the trigger body. I intentionally used also of the employees in the body of the trigger table. Please give me the solution.

    Triggering factor:

    create or replace trigger test_trigger

    before you insert or update or delete employees

    for each line

    declare

    an employees.first_name%type;

    Start

    Select first_name from people where job_id = "AD_PRES";

    end;

    DML statement:

    Update employees set salary = 20000 where job_id = "AD_PRES" (I run this query)

    Error message:

    ORA-04091: table HR. Is the transfer of EMPLOYEES, the function of triggering/can not see

    ORA-06512: at "HR. TEST_TRIGGER', line 4

    ORA-04088: error during execution of trigger ' HR. TEST_TRIGGER'

    Can anyone tell, in what other scenarios, we get this error or recursive table mutation?

    Thanks in advance

    Hello

    When you create a trigger on a table, you cannot edit/query this table the trigger is not completed.

    You can use

    (1) transaction of Pragma autonomous

    (2) instead of row-level trigger, you have statement-level trigger

    (3) to 11 g, try with COMPOSITE trigger

    Try below to avoid it (a solution):

    create or replace trigger test_trigger

    before you insert or update or delete employees

    for each line

    declare

    PRAGMA AUTONOMOUS_TRANSACTION;

    an employees.first_name%type;

    Start

    Select first_name from people where job_id = "AD_PRES";

    COMMIT;

    end;

  • Management key id primary auto increment without using triggers

    Hi, we have a lot of table in our database with the installation of key ID primary autoincrement than they are in MySQL since we are in the process of migrating to Oracle of MySQL. Now in oracle I learned recently that this application requires the creation of a sequence and a trigger on the id for each table in the type field. We have tables of 30-40 in our scheme and we want to avoid the use of database triggers in our product, as the management of database is out of reach for our device software.
    What are my options to implement the auto increment id feature in oracle... aside from manually specifying the id in the code and it management in the code that would change many existing insert statements. Some info about our application environment: groovy grails, hibernate, oracle, support for mysql

    It is NOT auto-increment, you can avoid manual entry. When executing the INSERT statement, you must use the value of the sequence.

  • Can change us line selected in ADF without using click to edit table feature.

    JDEV 12.1.3.0

    Hi Experts,

    Is there a way we can select a row in the table and click the button change the Panel collection. While the row becomes editable.

    Whatever row, we select and click on the edit button. This line becomes editable thattime only. Otherwise always disabled.

    Without using click to modify the ADF table feature.

    Thank you

    AR

    I had similar usecase

    Maybe you can tweek this blog to meet your needs

    Born in DeBug: press the Edit button to make editable line Table.

  • How replicates all records from one table to another table without using expdp, impdp

    Hi I have two database in a database, that I have a table called t1 and another base data, I have the second table .so, my first table have records, that I need to transfer all records second T2 without use of expdp and impdp in every 5 min... what I do

    ??

    The best solution for this scenario is to use Oracle Golden Gate

    However, it requires a license, and you must pay for it.

    If this is not possible, you can create a job scheduler that uses a link DB in order to reproduce the recordings of the target database, but it will take the entire table to the target database and then INSERT AS SELECT truncate the data of the entire table every time that the job is running (because you can't follow only the records that have been changed or modified).

    In addition, read here on the replication of data using materialized views.

  • I have the table of 3 columns A, B, C. I want to store the sum of columns A B in the C column without using the DML statements. Can anyone help please how to do. ?

    I have the table of 3 columns A, B, C. I want to store the sum of columns A B in the C column without using the DML statements. Can anyone help please how to do. ?

    11.1 and especially you have virtual column

    SQL> create table t
      2  (
      3     a number
      4   , b number
      5   , c generated always as (a+b) virtual
      6  );
    
    Table created.
    
    SQL> insert into t (a, b) values (1, 2);
    
    1 row created.
    
    SQL> select * from t;
    
             A          B          C
    ---------- ---------- ----------
             1          2          3
    

    Before that, a front insert - trigger

    SQL> create table t
      2  (
      3     a number
      4   , b number
      5   , c number
      6  );
    
    Table created.
    
    SQL> create or replace trigger t_default before insert on t for each row
      2  begin
      3    :new.c := :new.a+:new.b;
      4  end;
      5  /
    
    Trigger created.
    
    SQL> insert into t (a, b) values (1, 2);
    
    1 row created.
    
    SQL> select * from t;
    
             A          B          C
    ---------- ---------- ----------
             1          2          3
    
  • Insert data into the table without using the insert or select the command

    Hello

    Is there anyway to insert data from one table to another table, without using insert, and then select the command in the same pattern.
    Note: the two tables have the same structure.

    ALTER table... Swap partition...

  • Extracting data from table without refreshment and without using the tab key.

    Hi friends,

    I have a problem I want to extract data from table without discount in the text field without using the Tab key. When I enter a field value any value then the text corressponding should enter into corressponding textfield without using the Tab key.

    for example. When I get back emp_id 101 in a text field then first_name and last_name, address would come in to the text fields corressponding without refresh and use the Tab key.

    How can I do that.

    Thank you
    Maury

    Hi Maury,

    I guess it's similar to: retrieving data without refreshing rather than Re: value of a textfield should enter into an another textfield without using the TAB ?

    If so, the only change you want to bring on the first is to use the parameter "Onkeyup" instead of "onchange" in the 'HTML Form attributes of the element' element.

    Note, however, that the user must move away from the issue at some point (for example, to click on a button), so the onchange will fire anyway.

    Andy

  • Error during deploy Homeless using veristand 2010 API

    Hello

    I developed a few screws to connect and download "in4" and it worked fine with VS 2009.

    Now I am migrating to VS 2010 and I got error-307658 when I try to connect for the second time.

    If I cancel the deployment by using the Project Explorer, I still had no error.

    I tried to undeploy using logout of the system, but I still get the same error.

    With VS 2009 it has been possible to deploy the Homeless several times without error, but it seems that the same is not allowed with VS 2010, is this good?

    I forgot something?

    I enclose the screws and the Homeless.

    See you soon,.

    Claudio H.

    If the status is active, this means that the connection between the gateway
    (host) and the target is already active. These calls will result:

    1. Connect with deploy the false value - it will be 307658 with error saying that the system is currently running (already connected), and you can reconnect.

    2. Connect to deploy true value - it will be 307658 with error saying that the system is running and you cannot deploy.

    3. Disconnect with put false - undeploy it will cut the target (host) bridge but let the defintion of running system.

    4. Disconnect with undeploy true set - this cancel the deployment of the current definition of system and disconnect the gateway of the target.

    So for a robust application, you probably should handle error

  • How can I pass an array to an another vi without using the Subvi

    Hi all

    Is there a way to pass a 1 d table go a VI to another without using the Subvi?

    Mmehrabin wrote:

    I need to store data of FPGA. I can write them to a file on FPGA or should I transfer to the host VI and then store them in a file?

    The FPGA has no access to a disk.  You will need to pass data to the host (preferably with a FIFO DMA) and then the host can save data to a file.

  • How to increase the size of our C drive of 40 GB to 100 GB and the rest as logical drive D without using any third party tool, it is possible in the environment of windows 7 ent

    My dear, we are usning a custom image for our environment with win 7 ent deployed for all our computer network, in our customization take us C 40 GB and D drive 425GB space now, we are facing problem with the most complete C drive we had to move, and increasing the size of our disk of 40 GB to 100 GB and the rest as logical drive D without using any tool from third party , it is possible in windows 7 environment ent if so how please send procedure

    Original title: move/resize

    You will have to go on Support of Windows 7 forums on the following link to help solve your problem: http://social.technet.microsoft.com/Forums/en/category/w7itpro/

  • Can I develop the online Admission application without using the AAWS feature?

    People,

    Hello. I have implemented PeopleSoft Campus Solution 9.0 revision 5 for a University.

    I need to develop an application for Admission online for future student to apply for admission.

    My installations of PeopleSoft are below:

    Server machine: Oracle Linux 5.10 (64-bit)

    Client computer: Windows XP Professional (64 edition) with the Internet Explorer browser

    Architecture Internet Oracle Linux 5.10 Server:

    (1) database server: Oracle Database 11 g version 11.1.0.6.0 is

    (2) the server application: Tuxedo 11 g

    (3) web Server: Web Logic 10.3.6.0 and JDK 1.7.0_09

    (4) browser: Firefox Mozila

    (5) two Instances of huge database on the database server: 8.53 PeopleTools and Campus Solution 9.0.

    To develop the application for Admission online, I made the 4 parties with WebLogic 10.3.6 and JDK 1.7.0_09 as below:

    (1) install ADR (Application Development Runtime) 11.1.1.6.0 (64-bit)

    (2) install the RCU 11.1.1.6.0 to create the scheme of OWSM_MDS (32 bit)

    (3) create a WebLogic 'Domain_CS' domain in WebLgoic 10.3.6.0 in support of MARC 11.1.1.6.0.

    (4) install JDeveloper 11 g 11.1.1.6.0 Studio Edition including WebLogic 10.3.5.0.

    The application for Admission online is developed in JDeveloper 11g 11.1.1.6.0 Studio Edition and WebLogic Server 10.3.5.0.

    His EAR file will be deployed in Production WebLogic Server 10.3.6.0 in PeopleSoft Internet Architecture.

    As a general rule, Web Application is connected directly with database Tables.

    But in PeopleSoft, application for Admission online does not connect with database Tables directly. He must connect with AAWS (Admission Application Web Service) and through AAWS gets to the DB tables.

    From my point of view, we can connect directly the admission application online with its Instance Tables of database and do not need to connect with AAWS. It is easier to connect with DB directly to AAWS. In other words, do not use characteristic AAWS.

    My question is:

    May I develop the application for Admission online linking directly with database Tables and do not use the feature of AAWS?

    Thanks in advance.

    People,

    Hello. The problem is solved by myself. We use AAWS because constraints are built. Thank you.

  • How to ignore the first row of the table when VO is used as a dvt:pieGraph?

    Hello

    I have a VO object read-only. I use this VO datacontrol object to display a table and pieGraph to my jspx page. When removed from the datacontrol as a pieGraph in page jspx, it gives the graph to 50% of the total (which is the first line) and all other lines at 50%. Here, my problem is that the first line of a column in the table is total of all other lines in this column. Now, I have to show the pieGraph with slices of all lines except the first row.  Is there a way I can do this without using programmatically. Or any other simple solution for program help. Help, please.

    Thank you

    Ashok Laura.

    Hello

    Assuming that we have a table that displays the details of the Department. We will build a dynamic pie chart to display the employee details for departments that are displaced from the Department table. Please check below blog.

    https://blogs.Oracle.com/ADF/entry/dynamic_pie_graph_generation_by

    Thank you

    Amey

  • SDO_NN cannot be assessed without using the index when put inside subquery

    Hi all

    I met a problem when you use the function sdo_nn to find the nearest neighbor. Here is my scenario:

    _ I have 2 customer and store tables.

    Customer table _ a client_ID and a 2D sdo_geom point

    _ Store table has store_ID and a 2D polygon sdo_geom.

    In the beginning, I have this query to find the nearest store to each customer as below:

    Select s.STORE_ID, c.CLIENT_ID

    store customer, s c

    where sdo_nn (s.MYPOLYGON, c.MYPOINT, 'sdo_num_res = 1', 1) = "TRUE";

    _It works as expected when it returns a table showing the nearest store each customer.

    _Now I want to count the number of customers who have the same nearest store:

    Select / * + INDEX (store store_spatial_idx, client_spatial_idx client) * / count (nearest_store. CLIENT_ID)
    from (select s.STORE_ID, c.CLIENT_ID
    store customer, s c
    where sdo_nn (s.MYPOLYGON, c.MYPOINT, 'sdo_num_res = 1', 1) = "TRUE") nearest_store
    Group of nearest_store. STORE_ID;

    This query generates the following error:

    Error report-
    SQL error: ORA-13249: SDO_NN cannot be assessed without using the index
    ORA-06512: at the 'MDSYS. MD", line 1723
    ORA-06512: at the 'MDSYS. MDERR", line 17
    ORA-06512: at the 'MDSYS. PRVT_IDX', line 9
    13249 00000 - '%s '.

    I'm pretty new to spatial databases and hope get help to go further. Thank you in advance!

    Hello Pinball,

    Oracle space tends to be a quite complex with many variables and moving parts.  We chatted about the group to a sort of FAQ or guidelines to help people like you submit questions that actually answers.  First of all, you really have to tell us the version of Oracle you are using.  Particularly the problems involving the optimizer, version down to the exact defined patch number is a good idea.  Secondly, you took the time to submit the question so I guess you want a response.  If you really want to see the answer and then providing an example is one of the most important things that you can do.  I'm going to do here for you, but in general people on this forum come and go and are often pushed into lurkitude, so if you want the coax to provide you with an example of work is the key.

    DROP TABLE store1 PURGE;
    CREATE TABLE store1(
        store_id INTEGER NOT NULL
       ,shape    MDSYS.SDO_GEOMETRY
       ,PRIMARY KEY(store_id)
    );
    
    DROP TABLE client2 PURGE;
    CREATE TABLE client2(
        client_id INTEGER NOT NULL
       ,shape    MDSYS.SDO_GEOMETRY
       ,PRIMARY KEY(client_id)
    );
    
    CREATE OR REPLACE PROCEDURE seeder(
        p_client_count IN NUMBER
       ,p_store_count IN NUMBER
    )
    AS
      sdo_foo MDSYS.SDO_GEOMETRY;
      int_counter NUMBER;
      FUNCTION random_point
      RETURN MDSYS.SDO_GEOMETRY
      AS
          num_x1 NUMBER;
          num_y1 NUMBER;
    
      BEGIN
          num_x1 := dbms_random.value(-179,179);
          num_y1 := dbms_random.value(-89,89);
    
          RETURN MDSYS.SDO_GEOMETRY(
              2001
             ,8265
             ,MDSYS.SDO_POINT_TYPE(
                  num_x1
                 ,num_y1
                 ,NULL
              )
             ,NULL
             ,NULL
          );
    
      END random_point;
    
    BEGIN
      int_counter := 1;
      FOR i IN 1 .. p_client_count
      LOOP
          -- Create a client point
          sdo_foo := random_point();
          INSERT INTO client2
          VALUES (
              int_counter
             ,sdo_foo
          );
          int_counter := int_counter + 1;
    
      END LOOP;
    
      int_counter := 1;
      FOR i IN 1 .. p_store_count
      LOOP
          -- Create a store polygon of some kind
          sdo_foo := MDSYS.SDO_GEOM.SDO_ARC_DENSIFY(
              MDSYS.SDO_GEOM.SDO_BUFFER(
                  random_point()
                 ,5000
                 ,0.05
              )
             ,0.05
             ,'arc_tolerance=0.05'
          );
          INSERT INTO store1
          VALUES (
              int_counter
             ,sdo_foo
          );
          int_counter := int_counter + 1;
    
      END LOOP;
    
      COMMIT;
    
    END seeder;
    /
    
    BEGIN
      seeder(10000,200);
    END;
    /
    
    BEGIN
      INSERT INTO user_sdo_geom_metadata(
          table_name
         ,column_name
         ,diminfo
         ,srid
      ) VALUES (
          'STORE1'
         ,'SHAPE'
         ,MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',-180,180,.05),MDSYS.SDO_DIM_ELEMENT('Y',-90,90,.05))
         ,8265
      );
    
      COMMIT;
    
    EXCEPTION
      WHEN OTHERS
      THEN
          NULL;
    
    END;
    /
    
    BEGIN
      INSERT INTO user_sdo_geom_metadata(
          table_name
         ,column_name
         ,diminfo
         ,srid
      ) VALUES (
          'CLIENT2'
         ,'SHAPE'
         ,MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X',-180,180,.05),MDSYS.SDO_DIM_ELEMENT('Y',-90,90,.05))
         ,8265
      );
    
      COMMIT;
    
    EXCEPTION
      WHEN OTHERS
      THEN
         NULL;
    
    END;
    /
    
    CREATE INDEX store1_spx ON store1
    (shape)
    INDEXTYPE IS MDSYS.SPATIAL_INDEX
    NOPARALLEL;
    
    CREATE INDEX client2_spx ON client2
    (shape)
    INDEXTYPE IS MDSYS.SPATIAL_INDEX
    NOPARALLEL;
    
    /* Works as expected */
    SELECT
    s.store_id
    ,c.client_id
    ,MDSYS.SDO_NN_DISTANCE(1)
    FROM
    store1 s
    ,client2 c
    WHERE
    MDSYS.SDO_NN(
        s.shape
       ,c.shape
       ,'sdo_num_res=1'
       ,1
    ) = 'TRUE';
    
    /* No worky? Works for me */
    SELECT
    ns.store_id
    ,COUNT(ns.client_id)
    FROM (
       SELECT
        s.store_id
       ,c.client_id
       FROM
        store1 s
       ,client2 c
       WHERE
       MDSYS.SDO_NN(
           s.shape
          ,c.shape
          ,'sdo_num_res=1'
          ,1
       ) = 'TRUE'
    ) ns
    GROUP BY
    ns.store_id
    ORDER BY
    ns.store_id;
    

    So I wrote this about 12 c (12.1.0.2.0) and everything works fine for me.  Then I moved back from 11 GR 2 (11.2.0.4.0) and of course, there are questions.  So I guess that you don't use flavor of 11g.  So at this point we can look at the docs and see for 11g, have you often need to specify which table is the head and that is the one that has the spatial index to use.
    http://docs.Oracle.com/CD/E11882_01/AppDev.112/e11830/sdo_operat.htm#SPATL1032

    Its rather interesting that the optimizer of 12 c knows what you want, when I had to squint myself at your request and to play a little with the refining.  Note that SDO_NN is sensitive, because the geometry of the main table should come second in the operator.  I did not know that on the top of my head.

    
    SELECT
    /*+ LEADING(c) INDEX(s store1_spx)  */
     s.store_id
    ,c.client_id
    ,MDSYS.SDO_NN_DISTANCE(1)
    FROM
     store1 s
    ,client2 c
    WHERE
    MDSYS.SDO_NN(
        s.shape
       ,c.shape
       ,'sdo_num_res=1'
       ,1
    ) = 'TRUE';
    
    SELECT
     ns.store_id
    ,COUNT(ns.client_id)
    FROM (
       SELECT
       /*+ LEADING(c) INDEX(s store1_spx)  */
        s.store_id
       ,c.client_id
       ,MDSYS.SDO_NN_DISTANCE(1)
       FROM
        store1 s
       ,client2 c
       WHERE
       MDSYS.SDO_NN(
           s.shape
          ,c.shape
          ,'sdo_num_res=1'
          ,1
       ) = 'TRUE'
    ) ns
    GROUP BY
    ns.store_id
    ORDER BY
    ns.store_id;
    

    So I think that is your answer.  Give it a shot and see if this fits the Bill.  Of course, moving to 12 c would be useful for such things.  It would be interesting to collect more examples of this kind of space thing where 12 c is the answer. Also, would be nice if we could mark somehow this discussion as applying only to 11g and earlier versions.

    See you soon,.

    Paul

  • retrieve id WCS jsp site without using ics. SQL

    Hello

    Is it possible that I can get my current site in JSP siteId without using ics. SQL tags and recovering from the publishing table

    We are trying to apply a search lucene for loading the assets in the current site only.

    Thanks in advance for your help.

    Use the code to do so below.

    Don't forget to import publication.tld

    Kind regards

    Ravi G

Maybe you are looking for

  • Satellite P755 - how to recover user data from recovery

    I used Toshiba Recovery Wizard, but with save data option c:\Users[user-name]\Music\iTunes\iTunes. Now how can I recover?

  • Pavilion Dv6-7010us: help

    Need help please I have a Hp Pavilion Dv6 with the administrator password or power on system disabled password code is 62615432 thanks in advance

  • Front Panel hangs after the beginning of the routine

    Hello I am writing an application that looks a bit like that fixed. The idea is to have a Setup mode after the beginning of the program, where you can enter all the data to specify a test routine. In the first loop representing the configuration mode

  • hold time

    my computer keeps rite time. any suggestion?

  • Generation .opvn file

    I activated the option of LRT 214 Open VPN Server using certificate authentication. I also installed the Open VPN client software on my Android. Allows you to only import a .ovpn file. (1) how to generate a LRT-214 .ovpn which, if I understand correc