Results 1 to 12 of 12
  1. #1
    Join Date
    Sep 2002
    Posts
    17

    Unanswered: Why do I get no results?

    This is a literal cut and past from the docs

    -- Set up and use a cursor:

    BEGIN WORK;
    DECLARE liahona CURSOR FOR SELECT * FROM films;

    -- Fetch first 5 rows in the cursor liahona:
    FETCH FORWARD 5 IN liahona;

    -- Fetch previous row:
    FETCH BACKWARD 1 IN liahona;

    -- close the cursor and commit work:

    CLOSE liahona;
    COMMIT WORK;

    It says that it runs ok but how do I view the results?

    Thanks

    Dave

  2. #2
    Join Date
    Sep 2001
    Location
    Vienna
    Posts
    400

    Cursors

    This cannot be.
    I have tested this.
    Do you have a table named films?

    Are there rows in it?

    I was testing this on 7.2.1 in RH7.2
    http://www.postgresql.org
    --Postgresql is the only kind of thing--

  3. #3
    Join Date
    Sep 2002
    Posts
    17

    Re: Cursors

    Originally posted by eperich
    This cannot be.
    I have tested this.
    Do you have a table named films?

    Are there rows in it?

    I was testing this on 7.2.1 in RH7.2
    The table is users ( I forgot to edit this post ) and yes there are 9 records.

  4. #4
    Join Date
    Sep 2001
    Location
    Vienna
    Posts
    400

    strange

    Is there a script that executes this statemtns or do you type it manuallly in psql?
    http://www.postgresql.org
    --Postgresql is the only kind of thing--

  5. #5
    Join Date
    Sep 2002
    Posts
    17
    I am running it through pgadmin II SQL query screen. I will try it from the command prompt.

    Thanks

    Dave

    EDIT: Ok it works fine at the psql level.

    So now my question is how do I return that recordsetup to the calling application level?
    Last edited by dwilliams; 09-11-02 at 17:08.

  6. #6
    Join Date
    Sep 2001
    Location
    Vienna
    Posts
    400

    Querry

    What do you want exactly?

    begin work;
    declare cursor ...

    FETCH FORWARD 5 cursor;

    commit;

    get the rows of the fetch?
    http://www.postgresql.org
    --Postgresql is the only kind of thing--

  7. #7
    Join Date
    Sep 2002
    Posts
    17

    Re: Querry

    Originally posted by eperich
    What do you want exactly?

    begin work;
    declare cursor ...

    FETCH FORWARD 5 cursor;

    commit;

    get the rows of the fetch?
    Yes. Ideally I would like to contain the entire thing in a function and return a pointer to a cursor that contains the recordset but failing that yes that is exactly what I want to do.

  8. #8
    Join Date
    Sep 2001
    Location
    Vienna
    Posts
    400

    suggestion

    I don't know how you can achieve this but I think only way is that this fetch is the same as a select and you can get the data in the same way as you can get it from select.

    I'm no ASP and ODBC guru so I can't test this theory
    http://www.postgresql.org
    --Postgresql is the only kind of thing--

  9. #9
    Join Date
    Sep 2002
    Posts
    17
    ok so at the psql level how do I make this a function and return only the cursor object.

    The crux of the problem is a limited amount of data that ODBC will pass ( 2K I think ) and my queries would exceed that.

    Thanks again.

    Dave

  10. #10
    Join Date
    Sep 2001
    Location
    Vienna
    Posts
    400

    rettype

    now I understand you want to return the referenc of the cursor from the function

    Sorry. I don't know if this is possible.

    The only chance you have is to post an entry in the pgsql-sql list.
    Josh Berkus may know this. I think he is the pl/pgsql expert
    http://www.postgresql.org
    --Postgresql is the only kind of thing--

  11. #11
    Join Date
    Sep 2002
    Posts
    17

    Re: rettype

    Originally posted by eperich
    now I understand you want to return the referenc of the cursor from the function

    Sorry. I don't know if this is possible.

    The only chance you have is to post an entry in the pgsql-sql list.
    Josh Berkus may know this. I think he is the pl/pgsql expert
    Ok. great thank you for all your help.

    One last question

    Where do I find the pgsql-sql list? I have been all over the web and postgresql documentation is all over the place but mostly redundant. So just to avoid me finding 3000 identical locations calling themselves a pgsql-sql list could you give me a primary url to register and post at.

    Thanks again.

    Dave

  12. #12
    Join Date
    Sep 2001
    Location
    Vienna
    Posts
    400

    pgsql-sql

    usenet below
    comp.databases.postgresql.sql

    or the mailing list

    Lists near the bottom of the page
    http://www.postgresql.org
    --Postgresql is the only kind of thing--

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •