Data360 Analyze

 View Only
  • 1.  Execute Stored Procedure oddity

    Posted 07-11-2023 12:23

    I am baffled...

    I have a stored proc, that the first thing it does is insert a row into a table (which creates an ID from a sequence)

    When I run it from D360 the sequence jumps by 20... 

    When I run it in SQL Dev it increases by 1 as it supposed to do.

    I cannot determine why?? anyone have ANY clue?



    ------------------------------
    Geoff Geoff
    Windstream Communications
    Little Rock AR
    ------------------------------


  • 2.  RE: Execute Stored Procedure oddity

    Posted 07-12-2023 03:26

    If this is Oracle, then there are some strange cache behavior, even when you have nocache set in the sequence definition, especially when different users are used to insert rows. The default sequence cache for oracle is 20.

    In a developer session, you will probably always have the sequences cached and then you will see mostly incremental behavior. If its really bothering you, you can implement your own sequence allocation on a trigger, but there are pitfalls in doing this. Another thing to try would be to use identity columns instead. It works mostly the same but means that you have less objects to manage, and might have different cache behaviors. 

    Good luck.



    ------------------------------
    Peter Sykes
    Vontobel Holding AG
    Zurich
    ------------------------------



  • 3.  RE: Execute Stored Procedure oddity

    Posted 07-12-2023 10:12

    it is Oracle, and I did see the cache was set to one, so I turned off the cache. It STILL did it lol

    so get this.. for fun, I created a 2nd stored proc. that simply calls the stored proc that I want to run.. In 360 i call that one, and it works. It only increases by one now as it should!

    So, Im leaving this post here to share the workaround.



    ------------------------------
    Geoff Geoff
    Windstream Communications
    Little Rock AR
    ------------------------------



  • 4.  RE: Execute Stored Procedure oddity

    Posted 10-16-2023 09:22

    Hi Geoff, how do you call the stored proc in D360?



    ------------------------------
    clef andrin
    Knowledge Community Shared Account
    ------------------------------



  • 5.  RE: Execute Stored Procedure oddity

    Posted 10-17-2023 09:06

    sqlNonSelect("
    BEGIN
      
    schema.procedure;
      
    END;

    ")



    ------------------------------
    Steve Michalecki
    Systems Manager
    Windstream Communications
    ------------------------------