DBAsupport.com Forums - Powered by vBulletin
Results 1 to 5 of 5

Thread: VB6, ADO resultsets and Oracle 8 sequences

  1. #1
    Join Date
    Jan 2000
    Location
    Chester, England.
    Posts
    818
    I'm using VB6 and creating resultsets using ADO. It works fine except when I select from a sequence.

    My SQL is a straightforward "Select testseq.nextval from testseq" which gives correct results when run in SQL*Plus but from inside VB I get gaps in the sequence. The sequence reads 18-20-22-24 etc.

    I create the ADO resultset
    populate it using the query
    Copy the value from the rsSeqResults(0) into a text field on the screen.
    Close the resultset

    Seems simple enough - so what am I doing wrong?

    John

  2. #2
    Join Date
    Oct 2000
    Location
    Germany
    Posts
    1,185
    It probably won't help, but check the properties of the sequence in the DBA_SEQUENCES view.

    It is possible that the sequence is not incremented by 1.

    Another possibility is that the sequence is shared by more than one column or table.

    Hope that helps.
    David Knight
    OCP DBA 8i, 9i, 10g

  3. #3
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    Originally posted by JMac
    My SQL is a straightforward "Select testseq.nextval from testseq" which gives correct results when run in SQL*Plus ...
    This can't run from SQL*Plus either. TESTSEQ is the name of the sequence, so it can't also be the name of the table/view you are selecting from. Usualy you select from the table DUAL, so maybe your real select is:

    "Select testseq.nextval from DUAL;"?

    ...but from inside VB I get gaps in the sequence. The sequence reads 18-20-22-24 etc.
    Are you sure you are not selecting from the table that contains two rows? If you are selecting from DUAL, check how many rows there is in it:

    SELECT COUNT(*) FROM dual;
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  4. #4
    Join Date
    Jan 2000
    Location
    Chester, England.
    Posts
    818
    No,
    when I SELECT from the sequence in SQL*Plus the results are perfectly correct.

    I'm wondering if there's a bug with ADO/Oracle sequences.

    John

  5. #5
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    Our developers use ADO with Oracle extensively and we haven't experienced any problems with sequences whatsoever.

    BTW, I still claim that the example you provided ("Select testseq.nextval from testseq") is imposible to work even in theory, no matter what tool you are using. Is there a typo in that example or is there some other "mystery" that you can reveal if you assert it is working for you in SQL*Plus?
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

Posting Permissions

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


Click Here to Expand Forum to Full Width