SPONSORS:






User Tag List

Results 1 to 8 of 8
  1. #1
    Super Member
    Join Date
    Jul 1999
    Location
    Rancho Santa Margarita, CA
    Posts
    1,439
    Post Thanks / Like
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)

    Re: DB_FetchNext confusion

    No wonder Michael Jordan does not want to come out of Retirement...Kevin could not spell his name right (as in Micheal) : )

    Try reversing your PWD and UID.
    Are you sure your UID = uid?
    Try putting your DB_FetchNext in a while loop --- just to see what rows are being returned.

    Also try the Online Help...


    ------------------


    [This message has been edited by Gilbert (edited 04-05-2001).]

    [This message has been edited by Gilbert (edited 04-05-2001).]

  2. #2
    Junior Member
    Join Date
    Apr 2001
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    DB_FetchNext confusion

    Hi all,
    I am having a problem simply geting information from an Oracle database using the DB tester APIs. The following is my code segment:

    ============================================
    HDATABASE hdbc
    HSQL hstmnt
    INTEGER id

    hdbc = DB_Connect("dsn=oracle_dsn;PWD=password;UID=uid")

    hstmnt = DB_ExecuteSql (hdbc, "SELECT memb_id FROM m_table WHERE first_name='Micheal' AND last_name='Jordan' ")

    DB_FetchNext (hstmnt,id)

    print("memb_id = {id}")

    DB_FinishSQL(hstmnt)
    DB_Disconnect (hdbc)

    ==========================================

    There are two problems that I am facing:

    1 - The wrong information is returned
    2 - No matter how I change the where clause, I get the same result.

    Now, I have tried this query using Oracle's SQLplus program, with several where clause changes and received the expected output.

    I am sure that it is something simple but I can't find it in the reference.

    Thanks in advance.

    Kevin


    ------------------

  3. #3
    Senior Member
    Join Date
    Aug 1999
    Location
    Cambridge, UK
    Posts
    470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: DB_FetchNext confusion

    What were the values (the returned value you were expecting, and the value it actually returned)?

    ------------------

  4. #4
    Junior Member
    Join Date
    Apr 2001
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: DB_FetchNext confusion

    Hey all,
    Seems as if there is some peculiarity with fields that have been defined as type NUMBER. I have been able to retrieve the correct results from data of type VARCHAR and DATE.

    Is there somethign special about the NUMBER type?

    Thanks,

    Kevin

    ------------------

  5. #5
    Junior Member
    Join Date
    Mar 2001
    Location
    S.F
    Posts
    1
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: DB_FetchNext confusion

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>You need to format the data to the same type in your silk SQL, than it will work<HR></BLOCKQUOTE>



    ------------------

  6. #6
    Junior Member
    Join Date
    Apr 2001
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: DB_FetchNext confusion

    Ha Ha on the Jordan comment :-)

    I tried reversing the UID and PWD paramters, to no success.

    I am pretty sure that the UID and PWD are correct because I used them when I logged into the database via SQLplus and got back the expected data when executing the select statement.

    The id that I received was 1040300. What I expected was 1040266. The funny thing is that no matter what valid last name and first name search criteria I choose, I still get 1040300.

    I even put the fetch in a while loop but I only got the same ole value back. I wonder if it is an Oracle issue when connecting to the server?

    Thanks for the suggestions. Any other leads will be greatly appreciated.

    Thanks again,

    Kevin

    ------------------

  7. #7
    Senior Member
    Join Date
    Aug 1999
    Location
    Cambridge, UK
    Posts
    470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: DB_FetchNext confusion

    There is a bug in DB_FetchNext fetching numeric values (integer or floating-point). There is a loss of precision - normally at about five or six significant figures. For example, 123.456 might be returned as 123.45598 or 123.456001. The incorrect value returned will be returned consistently in repeated queries.
    I have logged this with segue tech support - including sending over an example script and a small database table so they could easily reproduce the problem. I haven't yet heard whether they have diagnosed the problem, or when they're going to fix it. The case number is 33634.

    If this problem is what is affecting you (and it does sound like it), and you want a workaround to get the right result, then there is usually a way of converting the numeric amount to a string, within the sql query. The syntax varies according to the implementation of sql; for an Oracle driver, you use to_char(fieldname), while on a FoxPro driver you use Str(fieldname, [iWidth, iDec]), exactly the same as the Str function in 4Test.
    So for example the query:
    "select fieldname from tablename"
    is replaced by:
    "select Str(fieldname, 10, 4) from tablename".
    Or in your case, you will want to use the query:
    "SELECT to_char(memb_id) FROM m_table WHERE first_name='Micheal' AND last_name='Jordan' "
    This will return a string to silktest, and you can then use Val() to convert this string to the relevant numeric value.
    This is not a very satisfactory workaround, because for one thing it's slower, and secondly you can't do much about queries where you want to do "select * from tablename"; but it's better than nothing.

    ------------------


    [This message has been edited by vincebowdren (edited 04-09-2001).]

  8. #8
    Junior Member
    Join Date
    Apr 2001
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: DB_FetchNext confusion

    Vince,
    U R the MAN!!!!! :-) That worked!!!

    Thanks a lot,

    Kevin

    ------------------

 

 

Posting Permissions

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

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 02:29 AM.

Copyright BetaSoft Inc.