oracle function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • chripa

    oracle function

    Hi all

    I use php with oracle database and i need function like mysql_data_seek
    i need to set the result pointer to the row number I need.
    can anyone help me?

    Thank you

    Chripa
  • Andy Hassall

    #2
    Re: oracle function

    On 2 Apr 2004 01:00:41 -0800, chripa@volny.cz (chripa) wrote:
    [color=blue]
    >I use php with oracle database and i need function like mysql_data_seek
    >i need to set the result pointer to the row number I need.
    >can anyone help me?[/color]

    There isn't one. If you want to go backwards, save your rows in PHP array and
    use that instead.

    Oracle 9i's OCI supports "Scrollable Cursors" which would allow you to go back
    and forth through result sets, rather than the normal and more efficient
    forward-only streaming of rows as soon as they're available. But PHP hasn't
    implemented support for them, unless it's been added very recently.

    The Oracle manual also states:

    "Note:

    Do not use scrollable cursors unless you require the functionality, because
    scrollable cursors use more server resources and can have greater response
    times than non-scrollable cursors."

    What is the problem that you are trying to solve that requires seeking back
    through the result set?

    --
    Andy Hassall <andy@andyh.co. uk> / Space: disk usage analysis tool
    http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space

    Comment

    • chripa

      #3
      Re: oracle function

      Andy Hassall <andy@andyh.co. uk> wrote in message news:[color=blue]
      > What is the problem that you are trying to solve that requires seeking back
      > through the result set?[/color]

      I need to display, for example, ten rows of the result and after
      clicking on next display another ten.
      I used to do that with mysql using the mysql_data_seek ()
      Chripa

      Comment

      • Jan Pieter Kunst

        #4
        Re: oracle function

        In article <3557211a.04040 40153.44f1434f@ posting.google. com>,
        chripa@volny.cz (chripa) wrote:
        [color=blue]
        > I need to display, for example, ten rows of the result and after
        > clicking on next display another ten.
        > I used to do that with mysql using the mysql_data_seek ()
        > Chripa[/color]

        For what it's worth, after writing a few of these 'paging' functions
        myself (using MySQL 'LIMIT' in the query), I decided to standardize on
        the DB_Pager module from PEAR. It does all the tedious calculation
        needed to build next/previous/first/last/intermediate links.

        <http://pear.php.net/package/DB_Pager>

        JP

        --
        Sorry, <devnull@cauce. org> is een "spam trap".
        E-mail adres is <jpk"at"akamail .com>, waarbij "at" = @.

        Comment

        • Andy Hassall

          #5
          Re: oracle function

          On 4 Apr 2004 01:53:00 -0800, chripa@volny.cz (chripa) wrote:
          [color=blue]
          >Andy Hassall <andy@andyh.co. uk> wrote in message news:[color=green]
          >> What is the problem that you are trying to solve that requires seeking back
          >> through the result set?[/color]
          >
          >I need to display, for example, ten rows of the result and after
          >clicking on next display another ten.
          >I used to do that with mysql using the mysql_data_seek ()[/color]

          It sounds like you're fetching the entire result set then only using some of
          it - this isn't very efficient.

          You should limit the result set to just those records you want. For Oracle,
          you could look into using ROWNUM or the ROW_NUMBER() analytic function.

          --
          Andy Hassall <andy@andyh.co. uk> / Space: disk usage analysis tool
          http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space

          Comment

          • cjbj

            #6
            Re: oracle function

            Andy Hassall <andy@andyh.co. uk> wrote in message news:<d8r070hmb e5eunfpqe0bvieg 2d6hg61ms8@4ax. com>...[color=blue]
            > On 4 Apr 2004 01:53:00 -0800, chripa@volny.cz (chripa) wrote:
            >[color=green]
            > >Andy Hassall <andy@andyh.co. uk> wrote in message news:[color=darkred]
            > >> What is the problem that you are trying to solve that requires seeking back
            > >> through the result set?[/color]
            > >
            > >I need to display, for example, ten rows of the result and after
            > >clicking on next display another ten.
            > >I used to do that with mysql using the mysql_data_seek ()[/color]
            >
            > It sounds like you're fetching the entire result set then only using some of
            > it - this isn't very efficient.
            >
            > You should limit the result set to just those records you want. For Oracle,
            > you could look into using ROWNUM or the ROW_NUMBER() analytic function.[/color]

            If you decide not to use DB_Pager, perhaps the query under the
            "and we said..." heading in

            will be useful. Lower down there is also some interesting
            discussion about how to be innaccurate to save time.


            -- CJ

            Comment

            Working...