Returning a PLSQL Cursor

I have a table which contains schedule information. Depending on the situation I may wish to select all schedule information for a driving serial or I may want to select based on start and end dates. This is quite a generic thing to want to do.

I then have a function which requires said schedule information but something inside the method will decide whether a start date is required or not.

So I want something like this:

    getCursor(serial, startdate, enddate)

Inside my function:

    if something or other:
      cursor = getCursor(serial, null, null)
      cursor = getCursor(serial, start, null)

    Loop around cursor

Any idea about how to get this behaviour? I have looked around and seen various different methods but haven’t been able to get any of them to work. Is what I want to do event the right approach in PL/SQL? It’s not a language I often use…

Source: oracle

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.