Stored procedure or Tigger in order to update to 20,000 records every night?

Hello world

I have a question about stored procedure or trigger.

Here's the situation:

I need to empty 20,000 records in table A in the database of progress to a B in Oracle table, every night. This is done by a planner and it's fine. Now, I need to update the table C for these 20,000 records in table B, either during the discharge of A to B, or after the dump is done.

Which way you think it's better in terms of performance for 20,000 records to be updated in table C.

1 - Update table C in the discharge of A to b: specify a trigger for each record added to table B, do the update in table c. (meaning it will unleash 20,000 times)

2 - Update table C after the dump from A to B is done: specify a stored procedure and call it by a scheduler to do the update to table C (which means that the cursor must navigate 20,000 files and do the update for each of them in table C)


Any ideas would be greatly appreciated.

Mona

I agree that the second option is better, but it took me by surprise:

user2372480 wrote:
2 - Update table C after the dump from A to B is done: specify a stored procedure and call it by a scheduler to do the update to table C (* which means that the cursor must navigate 20,000 files and do the update for each of them in table C *)

I interpreted that as a record by the other treatment as in:

OPEN CURSOR
LOOP
-- update a single record here
END LOOP

If this is the case, try and combine all the updates in a single SQL statement if you can. If this is not the case, try treatment in bulk.

HTH!

Tags: Database

Similar Questions

  • Execution of the stored procedure Oracle EF6 error.

    Hello

    Need help with the oracle error

    {"ORA-06550: line 1, column 8:"}

    PLS-00306: wrong number or types of arguments in the call to "sp_name".

    ORA-06550: line 1, column 8:

    {"PL/SQL: statement ignored '}

    This error occurs when the code runs the line in Vb.net application in Model Designer

    MyBase.ExecuteFunction ("sp_name" para1, para2, para3, dOBpara4, para5)

    I create the SSDL and CSDL, MSL files for oracle to MS SQL connection by the method mentioned in the link JasonShort - professional profile - CodeProject it worked perfectly fine without the stored procedures. I managed to insert, update, and delete records. Then, I created stored procedures for Insert, Update, Delete. It worked fine with MS SQL. I copied and updated oracle files respectively. I gives me the error mentioned above.

    I executed stored procedures in Oracle SQL Developer, and it works without error. But when it is executed via the model there is light of the error. Can anyone let me know the solution for this error. I'm using VS2010, EF6, Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production

    Thank you

    Prachin Soparkar

    Hello

    Sorry for the inconvenience. After I posted this question I took a break and saw that the error was nothing, but I had given FNAME as parameter name in MS SQL. In oracle when I created the sp I created the parameter with p_FNAME. Where the schema defined in the language SSDL and CSDL, MSL had to be changed to MS, but since I want to that it would be same in different databases, I choose to have changed it in oracle stored procedure. The error msg is confusing, it should be something not found parameter or incompatibility etc.

    Thank you

    Prachin Soparkar

  • Release of stored procedure after UPDATE

    Hello
    I've written a LOOP that calls a second stored procedure.
    In the second stored procedure, I have 3 INSERTS the values of each SELECT limited with a WHERE clause.

    Example:
    begin
    
    dynsql:=INSERT INTO destinationtable (ID,DATE,NAME)
    SELECT src.ID,src.DATE, dest.NAME FROM sourcetable src INNER JOIN destinationtable dest ON dest.ID=src.ID WHERE dest.date between '01.JAN.2012 and '03.JAN.2012' --if not condition not met, no insert
    execute immediate dynsql;
    dynsql:=UPDATE destinationtable SET DATE = dest.DATE FROM sourcetable src INNER JOIN destinationtable dest ON dest.ID=src.ID WHERE dest.date between '01.JAN.2012 and '03.JAN.2012'
    execute immediate dynsql;
    
    
    dynsql:=INSERT INTO destinationtable (ID,DATE,NAME)
    SELECT src.ID,src.DATE, dest.NAME FROM sourcetable src INNER JOIN destinationtable dest ON dest.ID=src.ID WHERE dest.date between '01.APR.2012 and '01.MAY.2012'  --if not condition not met, no insert
    execute immediate dynsql
    dynsql:=UPDATE destinationtable SET DATE = dest.DATE FROM sourcetable src INNER JOIN destinationtable dest ON dest.ID=src.ID WHERE dest.date between '01.APR.2012 and '01.MAY.2012'
    execute immediate dynsql;
    
    
    dynsql:=INSERT INTO destinationtable (ID,DATE,NAME)
    SELECT src.ID,src.DATE, dest.NAME FROM sourcetable src INNER JOIN destinationtable dest ON dest.ID=src.ID WHERE dest.date between '01.JUN.2012 and '01.JUL.2012'  --if not condition not met, no insert
    execute immediate dynsql;
    dynsql:=UPDATE destinationtable SET DATE = dest.DATE FROM sourcetable src INNER JOIN destinationtable dest ON dest.ID=src.ID WHERE dest.date between  '01.JUN.2012 and '01.JUL.2012'
    execute immediate dynsql;
    
    end;
    
    
    
    commit;
    What should I do?
    I update the existing line of 'old' with a new date, and then I'm basically duplicate this line but add a new DATE, the NAME and the ID is 'copied' as it is.
    The big problem is that the lines of recursive updates. If the first statement updates a date, it could become a 'true' conditions for the second and the first update
    That is not what I want. Initially, only one of the instructions is true, never. The problem with my code, is that after the first update and the setting of the date, the other "could" become reality.
    This should stop. After the update has occurred, I need to stop the stored procedure.

    How can I stop put an after?

    Use sql % rowcount after an immediate execution.

    If sql % rowcount = 0, no line have been set to day/insert/selected.
    If sql % rowcount > 0 then lines have been updated/inserted/selected day.

  • Insert or update trigger by passing the value to the stored procedure

    My task is to write a trigger that will pass a value for an insert or update to a stored procedure.

    It's Friday and I am not clear thinking, forgive me...


    Create or replace trigger < name of the trigger >

    After you insert or update table XXX
    for each line


    Run the Just_Do_It procedure
    (userid = new.user_id).


    If the table XXX has the userid column, and I want the trigger to get it and send it to Just_Do_It.
    what Miss me?

    Thank you.
    CREATE OR REPLACE TRIGGER trigger_name
      AFTER INSERT OR UPDATE ON table_name
      FOR EACH ROW
    BEGIN
      just_do_it( :new.user_id );
    END;
    

    Justin

  • Insert a record, call a stored procedure and execute a shell script

    Hello

    I am trying to build a page APEX do these three things in order.

    #1. Insert a new record in a database table (pk, donnees_xml, attr1 and attr2, etc.) and download the XML file to the donnees_xml column

    #2. Save this XML file on a file system

    #3. Parse the XML file on a file system and update the database with the parsed data table

    I can do #1 with a regular shape based on the database table. I can do #2 with a stored procedure.

    I can do #3 with a shell script.

    I wonder how these tasks can be combined into a single action in APEX.

    do #1;

    If successful, do #2;

    If successful, do #3;

    I'd appreciate comments on this.

    Thank you

    Define a process of PL/SQL page submit that runs after the record is inserted, if P1_FILE is not null.

  • Logic of tip insert - using a stored procedure?

    Here's my use case:

    • I have a table called TAGS that has two columns: id (number key, primary) and text (string)
    • the table has a constraint of database set that each text must be unique
    • the table also has a fixed sequence back next id available
    • I created an entity of the DB object and its default View object
    • I also created a page where I display a table read-only based on the View object
    • Finally, I added a text field and a button to the page
    • What I want to achieve is to insert all tags entered in the entry in the table fields, when the button is clicked. Note, however, that the entry field is a comma-separated list of tags, moreover, I have to insert only those tags that are new (to respect the constraint of database), and finally, I would like to use the sequence in insert or orders. Once completed, the page should also be updated.

    My first question is whether a stored procedure is the right way to perform such a step insert logical. If not, what other means must be used in the ADF.

    My second question is to know how to call the stored procedure and pass it the value of the input as a parameter field. I found this article http://andrejusb.blogspot.cz/2011/04/invoking-stored-procedures-and.html, but miss me a few transition points:

    1. How the callGreetingsFunction method call (I just get it that it's a method of the EO generated Java class?) after that the button is clicked?
    2. How to pass the value of the input field in this method as a parameter?

    Thanks in advance for your help.

    Now, what happens if I run it like this:

    A. the procedure is executed after a click on the button

    (B) the page is not updated (I had to do the research to get the new lines are visible in the table)

    C. the constraint is ignored (after discounting there were several lines with unique identification number, but pr is - empty)

    D. nothing has been committed to the database - if I closed the application window and it start again, the lines have disappeared from the table, but addition of new lines used number of increased seq

    E. Similarly, if I did directly inserts into the database, these lines did not appear until I transferred the application

    B. told it page to refresh. And that's usually enough to refresh your ViewObject with: viewObject.executeQuery)

    C. Si the constraint is not enforced for null values. And this has nothing to do with the adf, this is related to oracle db.

    D. you're calling commit.

    E. you must re-run your view object (viewObject.executeQuery ())

    Nevertheless, here is my rookie questions:

    There there a simple way to refresh the page (or just the table containing the data)?

    -How to validate changes (immediately after execution of the procedure)?

    -How is the constraint has been ignored? I am sure it would fail on validation, but I thought that it will be considered even for adding data to the table.

    -Are there a way to update the original Version of the database every time that the page is opened or refreshed?

    -Drag and drop operation Execute like button on your page (or call vo.executeQuery () by program)

    -Drag and drop the operation of posting as a button on your page (or invoke it by programming on the DBTransaction object)

    -ignored for what values? for null values? It is expected, because each null is "unique."

    -Yes, but you probably shouldn't do that for performance reasons, see this: Andrejus Baranovskis Blog: Cache results for ADF iterator property

    Read also this: Andrejus Baranovskis Blog: job ADF and PL/SQL Invocation changes side effect

    Dario

  • Entity Framework stored procedure Mapping - OUT unrecognized parameter

    I use the following software:

    • ODP.NET 12 c Release 3
    • Entity Framework 6
    • Visual Studio 2013, SP3
    • Oracle 11g Server

      I created a package containing a stored procedure to update a row in a table.  The procedure is an OUT parameter (named ROWS_AFFECTED) which returns the number of rows affected.

      CREATE OR REPLACE PACKAGE BODY TST. Customer_Procs
      AS
      PROCEDURE Update_Customer
      (
      CUST_ID IN NUMBER,
      WHAT IN VARCHAR2,
      L_NAME IN VARCHAR2,
      EMAIL IN VARCHAR2,
      LAST_UPDATE TIMESTAMP IN
      ROWS_AFFECTED NUMBER
      )
      AS
      BEGIN
      UPDATE
      TST. CUSTOMER
      SET
      NAME = WHAT,.
      LAST_NAME = L_NAME,
      EMAIL_ADDR = EMAIL,
      LAST_UPDT_TIME = CURRENT_TIMESTAMP
      WHERE
      CUSTOMER_ID = CUST_ID
      AND LAST_UPDT_TIME = LAST_UPDATE;

      ROWS_AFFECTED: = NUMBER OF ROWS SQL %;

      END Update_Customer;


      I executed successfully the stored procedure in SQL * more.  The ROWS_AFFECTED OUT parameter is filled with the good

      value.

      I imported the stored procedure in my Entity Framework model using the function successfully import.

      I then traced the parameters of the stored procedure to my entity properties. The ROWS_AFFECTED parameter is shown in the stored procedure mappings, but the "rows affected parameter" check box is cleared.

      Attempt to run my results in the following exception being throw:
      "CustomerModel.msl (22,12): error 2047: a mapping liaison function specifies a function.

      CustomerModel.Store.CUSTOMER_PROCS_UPDATE_CUSTOMER with a parameter not supported: ROWS_AFFECTED. Output parameters cannot

      be mapped through the RowsAffectedParameter property. Use the result links to return values from a function call.

      I am trying to determine what I need to do in order to have the Entity Framework to recognize the ROWS_AFFECTED OUT parameter in the

      stored procedure chart for concurrency control.

      I found a solution: try to declare ROWS_AFFECTED such as 'PLS_INTEGER' instead of 'NUMBER '.  This solved it for me.

    • [BC] Call a stored procedure taking parameters of table

      Hello!

      I currently have a request of the OIC that makes thousands of calls per second stored procedure. The stored procedure runs a business logic that I want my client application to stay informed.  I want to reduce the cat of the database and instead to call the stored procedure from thousands of times per second, call the procedure (for example) once per second, but with values of one mile.

      I used OCIBindArrayOfStruct successfully to perform inserts bulk, where my OCI application executes a () INSERT INTO using the function "iters" and it might be possible to do something similar with the stored procedure, but I want to do something slightly different, because the procedure stored something like this:

      * If a specific condition is set, call a secondary stored procedure

      * If another special condition is set, insert a row into a table of some

      I so wanted to do was to pass a table (or a series of tables) in the stored procedure, then the stored procedure to use optimal methods that are available, such as FORALL, to perform each of the tasks, the more effectively.

      So I thought to create a type, such as a TABLE OF VARCHAR2, or a VARRAY and possessing of the parameters for the stored procedure based on this type, something like:

      create or replace TYPE 'NTT_VARCHAR2' AS TABLE OF VARCHAR2 (32700);

      create or replace FUNCTION bulk_process_values)

      p_error_message OUT NOCOPY VARCHAR2,

      p_module_context_name OUT NOCOPY VARCHAR2,

      p_sql_error OUT NOCOPY VARCHAR2,

      p_count in NUMBERS

      p_non_array_var_1 IN VARCHAR2,

      p_non_array_var_2 IN VARCHAR2,

      p_array_var_1 IN NTT_VARCHAR2,

      p_array_var_2 IN NTT_VARCHAR2,

      p_array_var_3 IN NTT_VARCHAR2

      < etc. for all the variables in table >)

      RETURN NUMBER

      .. .but I am struggling to find an example of how call the procedure "bulk_process_values" stored, and even if I use a TABLE OF VARCHAR2 or a VARRAY as a parameter type.

      I searched the Internet and found this: OIC - how to bind an array to a stored procedure? - and binding table of the structs (OCIBindArrayOfStruct) sample code

      - but they take different approaches and a bit confused (the second example spoke of OTT).

      I think that the first approach is more likely to be the solution I need - but I can't help thinking - it is a bunch of stuff to move if it does not end up significantly improve performance!

      My questions are:

      * Moves to a call-SP-thousands-of-times-per-second to call-SP-fewer-times-but-with-array-parameters sensitive?

      * Should the table or VARRAY, TABLE OF VARCHAR2 parameters or something else?

      * Should I use for my case OTT?

      Samples I found are both very old - and the second example indicators that the optimal approach evolves with the OCI versions - I'm on 11.2, what is the optimal approach these days?

      * < added later > why is there no official useful example?

      Thank you very much

      Much appreciated. https://community.oracle.com/message/4528528#4528528 has actually worked, with VARRAY, with a proof of concept. Now I just need to shake a little and then get my PL/SQL for optimal PC experts. I think I was really discouraged by the lack of official documents, with the Community (Paradise) is the only way to get real results.

      Thank you JJ.

      I intend me to use the binding enforcement of the table and the table and avoid N back and forth, but I do not then get the opportunity to do something clever in the PL/SQL.

      In the PL/SQL, there is no logic occurring - I don't call the same SP tons of times, but then I want to be able to use PL/SQL optimizations such as FORALL, BULK COLLECT, reduce the number of validations and others.  There is a commit after each SP run, because otherwise the nature of demand means that the application hangs occur; However, there is a way (I think) be smart on the part that is likely to deadlock (making a shape on the Bay First, then applying the updates in the order sorted and then failed to get a blocking theoretically), and then FORALL insert for the second part of the stored procedure.

      I guess I may apply the single return, passing a table (to a commit in the SP)-which will reduce back and forth, so gain in performance, but it will not reduce the number of validations that I do - and Oracle said that commits too frequent is not good for performance. I already have code in my framework that does - by making a simple INSERT INTO.

      Good to hear that OTT is not explicitly required - and VARRAY resembles the approach to try first.

    • Required stored procedure

      Hello

      I need to create a stored procedure based on the requirements of the customer. Any body can help me...
      create table SAMPLE
      (
        WEB_LOGIN    VARCHAR2(30),
        WEB_PASSWORD VARCHAR2(30),
        PWD_EXP_DT   DATE
      );
      
      insert into SAMPLE (WEB_LOGIN, WEB_PASSWORD, PWD_EXP_DT)
      values ('[email protected]', 'abc', to_date('10-12-2010', 'dd-mm-yyyy'));
      insert into SAMPLE (WEB_LOGIN, WEB_PASSWORD, PWD_EXP_DT)
      values ('[email protected]', 'abc', to_date('01-01-2011', 'dd-mm-yyyy'));
      insert into SAMPLE (WEB_LOGIN, WEB_PASSWORD, PWD_EXP_DT)
      values ('[email protected]', 'def', to_date('10-02-2011', 'dd-mm-yyyy'));
      commit;
      
      conditions
      *********
      if web_login = web_login and web_password = web_password and 
      sysdate - pwd_exp_dt > 180 days 
      message " your password has been expired"
      
      if web_login = web_login and web_password = web_password and 
      sysdate - pwd_exp_dt > 165 days and sysdate-pwd_exp_dt <180 days then
      message " your password has been expired very soon..pls update ur old password"
      Please help me in this regard...!

      Concerning
      SA

      Hello

      845299 wrote:
      ...

      create table SAMPLE
      ( ...
      

      Thanks for posting the CREATE TABLE and INSERT statements; It's very useful!

      conditions
      *********
      if web_login = web_login and web_password = web_password and 
      

      Is not web_login always equal to web_login (unless its NULL value)?
      Did you mean you want to pass an argument to the procedure and test if argument equals web_login?

      sysdate - pwd_exp_dt > 180 days
      message " your password has been expired"
      
      if web_login = web_login and web_password = web_password and
      sysdate - pwd_exp_dt > 165 days and sysdate-pwd_exp_dt <180 days then
      message " your password has been expired very soon..pls update ur old password"
      

      I think that a function would be better than a procedure in this case. You probably want your front-end to display the message, and a function call is a logical way for the front-end information as necessary for the back-end.
      Here's one way:

      CREATE OR REPLACE FUNCTION     password_warning
      (     in_web_login     IN     sample.web_login%TYPE
      ,     in_web_password     IN     sample.web_password%TYPE
      ,     in_check_dt     IN     DATE     DEFAULT SYSDATE
      )
      RETURN     VARCHAR2
      IS
           password_age     NUMBER;          -- Days from pwd_exp_date to in check date
           return_txt     VARCHAR2 (100);     -- Message to be returned (may be NULL)
      BEGIN
           SELECT     in_check_dt - pwd_exp_dt
           INTO     password_age
           FROM     sample
           WHERE     web_login     = in_web_login
           AND     web_password     = in_web_password;
      
           IF    password_age > 180
           THEN
                return_txt := 'Your password has expired.';
           ELSIF password_age > 165
           THEN
                return_txt := 'Your password will expire very soon.  Please change your password.';
           END IF;
      
           RETURN     return_txt;
      EXCEPTION
           WHEN NO_DATA_FOUND
           THEN
                RETURN     NULL;     -- Or return 'Incorrect web_login/password.'
      END     password_warning
      ;
      /
      
      SHOW ERRORS
      

      This assumes that sample.web_login is unique.

      Here's some code to test. In addition to your actual data, I made some incorrect data, to see what the function returns when you give a bad web_login or web_password.

      WITH     expanded_sample     AS
      (
           SELECT     web_login
           ,     web_password
           FROM     sample
          UNION
           SELECT     CASE
                     WHEN  MOD (ROWNUM, 3) = 1
                     THEN  web_login
                     ELSE  '? ? ?'
                END     AS web_login
           ,     CASE
                     WHEN  MOD (ROWNUM, 3) = 2
                     THEN  web_password
                     ELSE  '? ? ?'
                END     AS web_login
           FROM     sample
      )
      SELECT       web_login
      ,       web_password
      ,       password_warning (web_login, web_password)     AS warning_now
      ,       password_warning (web_login, web_password, DATE '2011-06-19')
                                         AS warning_june_19
      FROM       expanded_sample
      ORDER BY  web_login
      ,       web_password
      ; 
      

      Output:

      WEB_LOGIN    WEB_PASSWORD WARNING_NOW                WARNING_JUNE_19
      ------------ ------------ -------------------------- --------------------------
      ? ? ?        ? ? ?
      ? ? ?        abc
      [email protected]  ? ? ?
      [email protected]  abc          Your password will expire  Your password has expired.
                                very soon.  Please change
                                your password.
      
      [email protected]  def
      [email protected]  abc                                     Your password will expire
                                                           very soon.  Please change
                                                           your password.
      

      As you can see, this function returns NULL when the password is aged less than 165 days, or when the web_login and/or the password does not match what is in the table. You can easily change this, if you wish, so that there is a separate message in each case.

      You can encrypt the passwords in the table. Oracle provides a package for encryption, called dbms_crypto.
      http://download.Oracle.com/docs/CD/B28359_01/AppDev.111/b28419/d_crypto.htm#i1005082

    • Forms - calls to rather than shares of standard database stored procedures

      After seeing the reports, I now start with shapes in the APEX. :)

      While I like the basic features offered by different Assistants, there is one thing that bothers me. After you create your form, you get basically 3 buttons (not counting cancel them) for different actions, each corresponding to an Action of database (SQL INSERT/UPDATE/DELETE). That's nice, but is not exactly what I want. I would replace the actions of database directly by the calls of stored procedures (in a package), one for each action. Would be nice, of course, to keep the benefits of the wizard, in particular in view of the fact that I would like to find a simple way to create standard forms. So, basically, I would create my forms in this way, but instead of linking the button action predefined database, do call a stored procedure. It's somehow possible and what would be the best way to achieve this?

      I am running 4.0.1.00.03 on an Oracle XE database APEX.

      Erwin

      Unfortunately it is only three as a limit.

      Instead (to link a page), you can change your link (s) to the form via a URL using the following syntax:

      f?p=App:Page:Session:Request:Debug:ClearCache:itemNames:itemValues:PrinterFriendly
      

      Use substitution variables, as in that above syntax and ItemNames and ItemValues through comma lists of names and values in the respective order and in this way you can send more than three on the next page.

    • stored procedures, newbie question

      I am at the point with my Web site where I need to think about the optimization of the query and have started looking at stored procedures for the first time.

      1. am I right in thinking the benefit of the execution of stored procedures is that it is a pre-compiled query?

      2. I'm trying to use the query cache as my 'normal' queries go, but is it possible to cache the results of a stored procedure?

      In practice, using 1 & 2 would provide a significant increase in performance.

      Personally, I use it only for large heavy updates or deletions. For example, I have an Oracle package with a bunch of procedures that run when a person completes an order - this process involves many tables, deletions, updates and a relatively simple logic. I think that the ideal candidate for a stored procedure.

      I use CF as an alternative if, for example, I have to repeat a load of complex business logic in a stored procedure that I have already written in a CFC.

      Keep in mind the benefits of a stored procedure - basically precompiled code. Don't forget that if you are using well trained cfqueries with cfqueryparams, execution plan gets compiled to the top in the first round * anyway *, so if you call a stored procedure or run your query really there is no difference.

      And Yes - do not underestimate the additional time it takes for a developer to do everything in the stored procedures rather than ColdFusion, they don't call it rapid development of applications for anything

      Don't forget as well as someone can write a stored procedure to poorly coded as well as they can write a wrong encoded query. At least if the developer has its application in front of him, he can see instantly what he needs of the index and locate errors, you could go years before realizing a person made a mistake inside a stored procedure, as no one can see the code.

      Regarding security Yes - if you really want to limit security then sprocs will do that for you. However in most of the applications I've seen the right developer has the possibility to write a query, as they see fit.

      Once I use stored procedures while I think of it - if you have more than one application that needs to do the same thing: this should * definitely * be a stored procedure.

      Basically, the same rules apply to them as any other aspect of programming; security of the duplication of code, efficiency, ease of maintenance - it's all a matter of their maximum weight and decide what is best.

    • Question packets and stored procedures

      Been working with Oracle for a month now and I have a question about stored procedures/packages. I created 3 stored procedures and a search function to do some work as follows:
      1 load the initial set of data into a table.
      2. turn to day of the preceding table columns by using a specific search function.
      3. put to update a single column with a value based on grouped subsets of the data in the table.

      I divide the latter in separate proceedings to facilitate debugging and validation of each step, but now I want to put them all together and run them sequentially. In my view, there are two ways to do this:
      1. create another stored procedure that will run the three in the right order.
      2 create a package and move all procedures and functions and call each in the right order.

      Don't know which approach is preferable, although I'm leaning towards the first option, any actual experience would be appreciated. Thanks in advance!

      Dave

      How about option 3:

      3 create a package and move all procedures and functions, and then add an additional procedure in the package that calls each in the correct order and call this procedure.

      PS. only this last procedure must be in the package spec. All others must be put into the body (and can remain hidden for the code outside the package).

      Published by: Toon Koppelaars February 26, 2010 21:07

    • the command - stored procedure support

      Hi all

      I'm having a lot of trouble getting my head around an update command / stored procedure, I took out all my books and has spent the last two days on Google which has aggravated my confusion. In simple terms what I try to do is to update a field in a table with the ordered there, but according to certain criteria. So my table contains the fields - following

      JBAID
      JBASiteID
      JBADatePosted
      JBAPostFor
      JBANotified

      What I want to do is to update the value of the JBANotified field for all records that meet the following requirements for Y

      The criterion is-

      WHERE the DATEADD(d,JBAPostFor,JBADatePosted) BETWEEN DATEADD (d,-7, GETDATE() AND GETDATE() AND JBANotified = ' AND JBASiteID = MMColParam n (where MMColParam is Session("SITEID")))

      So I just tried to build a command procedure / stored - which reads (see attached code) (more than probably all bad)

      I can't get my head around things-

      First rethink code in the first place, execution of the command on the loading of the page and then when the command run the redirection to the next page.

      I would really appreciate help with this-

      Thank you all

      Do you use the CS3 with ASP/VBScript? There is a bug in the implementation of the order which has this broken feature.

      I asked about it in this forum several months ago, but now I can't find my original post, but I found another post that talks about the same thing: http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=12&catid=263&threadid = 1281539 & enterthread = y

      My solution is to fall back to DW8 for the edition of the command, but use CS3 for the rest. I don't know what you're supposed to do if you do not have a previous version.

      It seems that your sql is correct, but the bug prevents the second block of code updated with the correct values.

      I hope that a solution is coming...

    • Mutex in the oracle stored procedure... How to get there?

      Hello

      I have the series of insert/update statements in an oracle stored procedure. The stored procedure is called composite Oracle SOA.

      The procedure works like this:

      a. download a request and checks to see if the file is already in the database. If she's here, we update, elsewhere insert.

      b. that I check for 10 tables and make the necessary inserts/updations.

      But sometimes, when I get the huge volume of transactions in the stored procedure, I see this violation of unique constraint violated due to lack of appropriate controls to ensure that no other parallel forum is trying to update the same record.

      How to do this so that no two execution of stored procedure doesn't work on the same record in the same table?

      Thank you!!

      Hello

      you might consider something like this

      create table t1(
        id number primary key,
        action varchar2(10),
        who varchar2(10)
      )
      ;
      
      declare
        p_id number           := 1;
        p_action varchar2(10) := 'Insert';
        p_who varchar2(9)     := 'Session 1';
        --
        procedure update_t1(p_id number, p_action varchar2, p_who varchar2) is
        begin
          update t1 set action = p_action, who = p_who where id = p_id;
        end;
      begin
        -- try to insert or update row for PK p_id
        merge into t1 d using (
          select
            p_id     id,
            p_action action,
            p_who    who
          from dual
        ) s on (d.id = s.id)
        when matched then
          update set d.action = 'Update', d.who = s.who
        when not matched then
          insert values (s.id, s.action, s.who)
        ;
      exception when dup_val_on_index then
        -- insert is no option, update when lock is released
        update_t1(p_id, 'Update', p_who);
      end;
      /
      
      drop table t1 purge
      ;
      

      Scenario (two sessions trying to insert/updated updated for id 1):

      session 1 inserts ("1" "insert" "Session 1") and the data is not visible to the session 2

      session 2 inserts same id but crashes because of the locking session 1

      validation of the session 1

      session 2 insert fails but who manages updating instead

      session 2 commits, values for the id 1 is now ('1' 'Update' "Session 2")

    • Transaction in stored procedure not treated as Atomic?

      Hello

      I have a stored procedure that inserts a line in a table called reservations and also decrement the places available for an event.

      For example: at an event, there are 100 places available. After you add a reservation, it will be left only 99 seats.

      I also have a Java program that sends 100 concurrent transactions to the database.

      After 100 transactions, there are 100 reservations, but there are still about 60 free places.

      So, I guess that the transaction he has not treated as atomic. I don't know why some transactions fail?

      The code of the stored procedure:

      create or replace PROCEDURE procedureOne (s_price, NUMBER, NUMBER, of s_customer)

      s_event NUMBER, DATE, s_movie NUMBER of s_dat)

      IS

      s_ev NUMBER;

      s_free NUMBER: = 0;

      BEGIN

      commit;

      Set transaction read write;

      Start

      SET TRANSACTION ISOLATION LEVEL READ COMMITTED;

      Select Event_ID, Free_seats EN s_ev, s_free

      events

      where ID_Movie = s_movie;

      If s_free > 0 then

      Start

      update events set Free_seats = s_free-1;

      insert into values of reservations (seqa_seq. NEXTVAL, s_dat, s_customer, s_event, s_price);

      commit;

      end;

      on the other

      Start

      Rollback;

      end;

      end if;

      end;

      commit;

      end procedureOne;

      invatacelul wrote:

      So, I guess that the transaction he has not treated as atomic. I don't know why some transactions fail?

      You said: "I also have a Java program that sends 100 concurrent transactions to the database. Atomicity applies to a single transaction - it says transaction executes all or nothing. Is what you run in isolation. If you want isolation unless you serialize, transaction 2 sees no uncommitted transaction 1 results because the READ COMMITTED isolation level indicates that a transaction can read only the data that has been committed to the database. And since you wrote your code as SELECT + UPDATE you get results you never expected. Use:

      UPDATE OF EVENTS

      SET FREE_SEATS = FREE_SEATS - 1

      WHERE ID_Movie = s_movie

      AND FREE_SEATS > 0;

      SY.

    Maybe you are looking for

    • Looking for HP calculators Forum

      Hi all. While I can always bookmark in Firefox and in my brain, what is the Web Forum of Calculators site/page? Thank you

    • Program seems to work in virtual environment but wrote no tension

      I have a program I want to use for an alternative output voltage that allows to change the size with the push of a button. I joined the program. Everything seems to work fine (judging by the graph of the voltage!) But when I try to run this program w

    • Cannot perform a hard reset

      Experts in the community I'm the one who help friends and family on this from the unit for the first time that I came across a compact Z5 which has an error which may or may not associate with defective finger print registry. I was unable to perform

    • walking for windows 7 and no sound

      Someone please help I am pulling my hair out there.  I have an old HP pavillion a1410n desktop and I just upgraded Windows vista to windows 7 and I have no sound.  I already downloaded the driver software from the HP site updated and still no sound. 

    • How can I change the information Document Dimensions resolution units to the LCM Panel?

      In the Info Panel Options, I 'Dimensions of the Document' checked under "informationof State. It displays the size of the document in px (pixels) and resolution in ppi (pixels/inch); I would like to change that to the ppcm (pixels/centimeter). How ca