This discussion is archived
7 Replies Latest reply: Jan 17, 2013 3:30 AM by Bawer RSS

Inline function vs Cursor

BS2012 Newbie
Currently Being Moderated
Hi Everyone,
Please read the article by clicking on the link.

http://www.toadworld.com/KNOWLEDGE/KnowledgeXpertforOracle/tabid/648/TopicID/POP7B/Default.aspx

Now whatever an inline function is doing, a cursor is doing the same. The program mentioned in it is also using a cusor inside it.

So what's the exact difference between these objects?



Regards,
BS2012
  • 1. Re: Inline function vs Cursor
    Mihael Pro
    Currently Being Moderated
    Now whatever an inline function is doing, a cursor is doing the same. The program mentioned in it is also using a cusor inside it.

    So what's the exact difference between these objects?
    For each 'location' function users cursor only once, then just return data from memory that is much faster than to use cursor each time.
    But the same result can be achieved using 11g result cash.
  • 2. Re: Inline function vs Cursor
    Karthick_Arp Guru
    Currently Being Moderated
    What the program does is, Its trying to eliminate the SQL call (The cursor operation) by manually caching the data in a Array.

    I personally feel that is a very bad approach for the following reason

    1. PL/SQL is used in SQL. There is going to be lot of context switch which is going to cost a lot.
    2. Array are used to store value. Arrays use PGA a private memory area which could be expensive.
    3. Lot of code, i don't like to write lot of code.

    The simplest way would be to do a Join with the look up table. This would be the most efficient way of achieving the requirement. Always remember SQL is the fastest way to process your data.
  • 3. Re: Inline function vs Cursor
    BluShadow Guru Moderator
    Currently Being Moderated
    Karthick_Arp wrote:
    What the program does is, Its trying to eliminate the SQL call (The cursor operation) by manually caching the data in a Array.

    I personally feel that is a very bad approach for the following reason

    1. PL/SQL is used in SQL. There is going to be lot of context switch which is going to cost a lot.
    2. Array are used to store value. Arrays use PGA a private memory area which could be expensive.
    3. Lot of code, i don't like to write lot of code.

    The simplest way would be to do a Join with the look up table. This would be the most efficient way of achieving the requirement. Always remember SQL is the fastest way to process your data.
    Agree with that.
  • 4. Re: Inline function vs Cursor
    Bawer Journeyer
    Currently Being Moderated
    BluShadow wrote:
    Karthick_Arp wrote:
    What the program does is, Its trying to eliminate the SQL call (The cursor operation) by manually caching the data in a Array.

    I personally feel that is a very bad approach for the following reason

    1. PL/SQL is used in SQL. There is going to be lot of context switch which is going to cost a lot.
    2. Array are used to store value. Arrays use PGA a private memory area which could be expensive.
    3. Lot of code, i don't like to write lot of code.

    The simplest way would be to do a Join with the look up table. This would be the most efficient way of achieving the requirement. Always remember SQL is the fastest way to process your data.
    Agree with that.
    look at this video and their assertions :-)

    http://www.youtube.com/watch?v=ecNP8KBX_sc
  • 5. Re: Inline function vs Cursor
    BluShadow Guru Moderator
    Currently Being Moderated
    Bawer wrote:
    BluShadow wrote:
    Karthick_Arp wrote:
    What the program does is, Its trying to eliminate the SQL call (The cursor operation) by manually caching the data in a Array.

    I personally feel that is a very bad approach for the following reason

    1. PL/SQL is used in SQL. There is going to be lot of context switch which is going to cost a lot.
    2. Array are used to store value. Arrays use PGA a private memory area which could be expensive.
    3. Lot of code, i don't like to write lot of code.

    The simplest way would be to do a Join with the look up table. This would be the most efficient way of achieving the requirement. Always remember SQL is the fastest way to process your data.
    Agree with that.
    look at this video and their assertions :-)

    http://www.youtube.com/watch?v=ecNP8KBX_sc
    Can't access youtube at work I'm afriad, and I don't do work at home. ;)
  • 6. Re: Inline function vs Cursor
    Karthick_Arp Guru
    Currently Being Moderated
    Can't access youtube at work I'm afriad, and I don't do work at home. ;)
    Same..Same..!! :)
  • 7. Re: Inline function vs Cursor
    Bawer Journeyer
    Currently Being Moderated
    BluShadow wrote:
    ...
    Can't access youtube at work I'm afriad, and I don't do work at home. ;)
    cool. I do my work too and am not at home ;-)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points