1 2 Previous Next 16 Replies Latest reply: Feb 18, 2013 2:57 AM by BluShadow Go to original post RSS
      • 15. Re: GTT to pass data from one sp to another sp.
        793996
        Its like asking which one is good? Airbus or a private Jet? Both of them have their pros and cons. Had one been better in all aspects other would not have been existing at all (exception: backward compatability). Its equally applicable to cursors and collections. It all depends on the need of the time and offcourse other factors like data volumes, server configuration, etc.

        Coming to GTTs they are just session based tables and are generally either used to store some session specific temporary data or used as catalyst in complex DMLs.

        If you have some specific scenario please share so that experts on the forum can suggest accordingly.

        Vivek
        • 16. Re: GTT to pass data from one sp to another sp.
          BluShadow
          944768 wrote:
          as Mr jeneesh said there are scenarios to use GTT,cursors and collection

          1)please tel me senarios in general.

          2)to loop cursor, i show there are many loops avialable.

          please tel me which loop is used in which condition.( i mean good practice).
          Good practice is to not use loops at all, unless you can really justify a need to, and in most cases there is little justification.

          Based on what you described above, you want to read some data and for each row of data perform inserts, updates or deletes. SQL provides a MERGE statement which can insert, update and delete all in one statement, so that's usually the best practice for such a need.
          1 2 Previous Next