Query result set ordered incorrectly

Hallo,
I have this problem.
I have a table (lisitab) with a list of codes, for example:
A0001
A0002
AD063
AY064
In my java class I run a query (select lisi_codi from lisitab order by lisi_codi) and I expect the following order:
A0001
A0002
AD063
AY064
but I have this result:
AD063
AD064
A0001
A0002
What is strange it's that if I execute the query in SQL*Plus or other tools (PLSQLDeveloper for example) it works fine! When run my JDeveloper application I have the bad ordered result set.
My DB is Oracle 8.1.7 on Windows2000(SP2). The DB language is set as AMERICAN_AMERICA.WE8DEC.
The client is set with NLS_LANG AMERICAN_AMERICA.WE8DEC and I'm using Oracle OCI JDBC Drivers 8.1.7 deployed with JDeveloper 3.2.
I presume there's a bug (a BIG BUG!!!) into JDBC Drivers.
How can I work without trusting in order by ?
Could anyone help me?
Thanks
G.Grimoldi
null

<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Joaquin Sanchez Jimenez ([email protected]):
Hi:
Could you send table description and complete query?. What version of JDBC and database ...
J.<HR></BLOCKQUOTE>
The table (lisitab) is very simple:
lisi_codi varchar2(16) not null (PK)
lisi_desc varchar2(40)
The select is:
select lisi_codi from lisitab order by lisi_codi
I'm working on Oracle 8.1.7 on Windows 2000 and JDBC drivers are Oracle JDBC 8.1.7 deployed with Jdeveloper 3.2.
I also tried with an Oracle 8.1.7 DB with charset WE8ISO8859P1 and a client with the same charset, but the result is same: bad ordered result set!
Is there anybody at Oracle who could tell me why and how to resolve (or workaround) this tedious and dangerous problem?
Thanks
null

Similar Messages

  • Select query result set order

    Hi,
    Can I know the order in which Oracle outputs the result set of a simple SELECT query ? Will the output always be same as the order in which rows got inserted ?
    Please advise,
    Thanks,
    Smitha

    If you include an ORDER BY than the order of the result set is known.
    It will not always be the same as the order in which rows got inserted.

  • Create a CF Query Result Set in Java

    I'd like to programatically build a ColdFusion query resultset inside of a Java class and return it to the calling application.  See the Java psudocode below to see what I'm talking about:
    public class MyClass {
         public coldfusion.sql.QueryTable getQuery() {
              // Create a query table object
              QueryTable myTable = ..?
              // Loop through some set of instance data for my class
              for(int c = 0; c < this.myWigets.length; c++) {
                   int row = c+1;
                   myTable.setField(row, nameCol, this.myWigets[c].name);
                   myTable.setField(row, colorCol, this.myWigets[c].color);
              return myTable;
    I've had stuff like this partially working in the past but had issues with things like query of queries and such probably due to the hacks used to create the QueryTable object.  I'm mainly just checking in to see if there has been any progress made in this area.  To me this seems like such an obvious thing for a Java developer working within CF to want to do.  I'm surprised Adobe doesn't have an officially supported API for doing this sort of thing (or maybe I'm just too dumb to find it.)    A few other notes... I'm not using CFX, and I'm not starting with a java.sql.ResultSet otherwise I would use the QueryTable(java.sql.ResultSet) constructor.  I need to build this thing from scratch programatically.
    Thanks for your time.  I hope this question makes sense to someone out there.
    - Mike

    I appologize.  I wasn't very clear with my original question.
    I'm creating an instance of my Java class from within CF using createObject("java", "com.example.MyClass").  So based on the sample code in my original post on the CF side I'd like to do something like this:
    <cfscript>
         myObj = createObject("java", "com.example.MyClass");
         myObj.doSomeStuff();
         myCFQuery = myObj.getQuery();  // Return a CF query from my java class
    </cfscript>
    ... then do stuff like ...
    <cfquery name="mySortedQuery" dbtype="query">
         select     *
         from       myCFQuery
         order      by color
    </cfquery>
    I appriciate your suggestions so far.  I have other solutions working already but they are not ideal.  I was just hoping someone had a clean and as-hack-free-as-possible way of creating a ColdFusion query result set in Java and passing it back to CF.
    Thanks again,
    Mike

  • Limit on Query result set

    Limit on Query result set
    Is there anyway in Oracle9i to limit query result
    I.e.: we can limit query result in MySQL
    SELECT * FROM EMP LIMIT 2;
    Will return only top 2 records
    Thanks in advance

    SELECT * FROM EMP WHERE ROWNUM <= 2;

  • Xcelsius with XMLA or XML Query Result Set

    Hi Experts,
    I want a direct connection from Xcelsius to my BW-Data. Because the new connection, coming with Fix Pack 2.1 is only avaiable for EHP 1 for NW 7.0 I tried to configure with XMLA and XML Query Result Set.
    This Document tells the necessary steps: How to integrate Xcelsius 2008 with SAP NetWeaver BI without Integration Kit.pdf.
    When I test my XML connection over http://<host>:<port>/TXmla/srvlet/TestXmla my Cubes will display.
    So I do a Webservice-Connection with WSDL-URL. At Input-Values there are some entries like CUBE_NAME, CATALOG_NAME...
    Output values arent avalible. How do I use these elements to show my Data in Xcelsius?
    My Problem with the XML Query Result Set Connection is, that when I Log On to VC the following error appears:
    You are not authorized to view the requested resource.
    So I get the authorisationobjects: S_DEVELOP and S_RS_COMP as describe in 'How To... Resolve Visual Composer Issues'.
    What values have I to enter by S_RS_COMP? And how can I enter my External Service in S_SERVICE. At the type WS the service isnt't avaiable.
    Regards,
    Jan

    To use XMLA web service you need a wrapper function build to convert the XMLA output to the Xcelsius format. There are some documents available in SDN on how to do this.
    You can use Live Office or Query as a Web service option to connect from Xcelsius to BW.
    S_RS_COMP is the query ID which you are trying to access, S_SERVICE you can either give * or try to set up authorization log and see the expected value.

  • Error in testing XML query result set web service

    Hi
    I was trying to test a <b>XML query result set web service</b> in BW system with tcode wsadmin but getting error like
    <b>Cannot download WSDL from http://ibmbtsb02.megacenter.de.ibm.com:8070/sap/bw/xml/soap/queyview?sap-client=001&wsdl=1.1&mode=sap_wsdl: F:\usr\sap\W70\DVEBMGS70\j2ee\cluster\server0\apps\sap.com\com.sap.engine.services.webservices.tool\servlet_jsp\wsnavigator\root\WEB-INF\temp\ws1139464945296\wsdls\wsdlroot.wsdl (The system cannot find the path specified)</b>
    I had tried it first time few days ago and was able to test it successfully with the same configuration settings.
    Could any one of you please provide any suggestion on this?
    Thanks in advance
    Sudip

    hi
    check this links it may help u.
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/e3072e65f04445a010847aa970b68b/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/d8/3bfc3f8fc2c542e10000000a1550b0/frameset.htm
    Regards,
    Manoseelan

  • Downloading Query result set

    Hi forum,
    We have a requirement to download query result set and distribute it as a periodic job. Can open hub be used for this purpose?
    Thanks in advance.
    Regards,

    Hai i beleive your using BI 7 you can meet your objective by using broadcast and schedule the same hope you have the right EP access too .
    Goodday

  • Stepping through a query result set, replacing one string with another.

    I want to write a function that replaces the occurance of a string with another different string.  I need it to be a CF fuction that is callable from another CF function.  I want to "hand" this function an SQL statement (a string) like this:   (Please note, don't bother commenting that "there are eaiser ways to write this SQL..., I've made this simple example to get to the point where I need help.  I have to use a "sub_optimal" SQL syntax just to demonstrate the situation)
    Here is the string I want to pass to the function:
    SELECT
      [VERYLONGTABLENAME].FIRST_NAME,
      [VERYLONGTABLENAME].LAST_NAME,
      [VERYLONGTABLENAME].ADDRESSS
    FROM
      LONGTABLENAME [VERYLONGTABLENAME]
    Here is the contents of the ABRV table:
    TBL_NM,  ABRV    <!--- Header row--->
    VERYLONGTABLENAME, VLTN
    SOMEWHATLONGTALBENAME, SLTN
    MYTABLENAME, MTN
    ATABLENAME, ATN
    The function will return the original string, but with the abreviations in place of the long table names, example:
    SELECT
      VLTN.FIRST_NAME,
      VLTN.LAST_NAME,
      VLTN.ADDRESSS
    FROM
      LONGTABLENAME VLTN
    Notice that only the table names surrounded by brackets and that match a value in the ABRV table have been replaced.  The LONGTABLENAME immediately following the FROM is left as is.
    Now, here is my dum amatuer attempt at writing said function:  Please look at the comment lines for where I need help.
          <cffunction name="AbrvTblNms" output="false" access="remote" returntype="string" >
            <cfargument name="txt" type="string" required="true" />
            <cfset var qAbrvs="">  <!--- variable to hold the query results --->
            <cfset var output_str="#txt#">  <!--- I'm creating a local variable so I can manipulate the data handed in by the TXT parameter.  Is this necessary or can I just use the txt parameter? --->
            <cfquery name="qAbrvs" datasource="cfBAA_odbc" result="rsltAbrvs">
                SELECT TBL_NM, ABRV FROM BAA_TBL_ABRV ORDER BY 1
            </cfquery>
         <!--- I'm assuming that at this point the query has run and there are records in the result set --->
        <cfloop index="idx_str" list="#qAbrvs#">      <!--- Is this correct?  I think not. --->
        <cfset output_str = Replace(output_str, "#idx_str#", )  <!--- Is this correct?  I think not. --->
        </cfloop>               <!--- What am I looping on?  What is the index? How do I do the string replacement? --->
            <!--- The chunck below is a parital listing from my Delphi Object Pascal function that does the same thing
                   I need to know how to write this part in CF9
          while not Eof do
            begin
              s := StringReplace(s, '[' +FieldByName('TBL_NM').AsString + ']', FieldByName('ABRV').AsString, [rfReplaceAll]);
              Next;
            end;
            --->
        <cfreturn output_txt>
        </cffunction>
    I'm mainly struggling with syntax here.  I know what I want to happen, I know how to make it happen in another programming language, just not CF9.  Thanks for any help you can provide.

    RedOctober57 wrote:...
    Thanks for any help you can provide.
    One:
    <cfset var output_str="#txt#">  <!--- I'm creating a local
    variable so I can manipulate the data handed in by the TXT parameter.
    Is this necessary or can I just use the txt parameter? --->
    No you do not need to create a local variable that is a copy of the arguments variable as the arguments scope is already local to the function, but you do not properly reference the arguments scope, so you leave yourself open to using a 'txt' variable in another scope.  Thus the better practice would be to reference "arguments.txt" where you need to.
    Two:
    I know what I want to happen, I know how to make it happen in another programming language, just not CF9.
    Then a better start would be to descirbe what you want to happen and give a simple example in the other programming language.  Most of us are muti-lingual and can parse out clear and clean code in just about any syntax.
    Three:
    <cfloop index="idx_str" list="#qAbrvs#">      <!--- Is this correct?  I think not. --->
    I think you want to be looping over your "qAbrvs" record set returned by your earlier query, maybe.
    <cfloop query="qAbrvs">
    Four:
    <cfset output_str = Replace(output_str, "#idx_str#", )  <!--- Is this correct?  I think not. --->
    Continuing on that assumption I would guess you want to replace each instance of the long string with the short string form that record set.
    <cfset output_str = Replace(output_str,qAbrs.TBLNM,qAbrs.ABRV,"ALL")>
    Five:
    </cfloop>               <!--- What am I looping on?  What is the index? How do I do the string replacement? --->
    If this is true, then you are looping over the record set of tablenames and abreviations that you want to replace in the string.

  • Query Result Column Order

    I'm working with an embedded db query that specifies columns
    by name in the result set, i.e., no *. However, the order of the
    columns in the result set seem to be quite random - or at least
    dependent on which column is being searched. I'm showing the
    results via "resultsGrid." How do I enforce a consistent column
    order in query results?
    Thanks,
    Al

    What you describe boils down to a reinvention of materialized views.
    Did you consider using them?
    Sybrand Bakker
    Senior Oracle DBA

  • Query result set...

    I'm having trouble determining a good way to word my question. So, I believe my pseudo code below will be sufficient in doing so.
    Oracle version: 11.2g
    Data set
    WITH temp AS
    SELECT 1 col1, 1 day FROM dual UNION ALL
    SELECT 2 col1, 1 day FROM dual UNION ALL
    SELECT 3 col1, 1 day FROM dual UNION ALL
    SELECT 4 col1, 1 day FROM dual UNION ALL
    SELECT 5 col1, 1 day FROM dual UNION ALL
    SELECT 6 col1, 1 day FROM dual UNION ALL
    SELECT 7 col1, 2 day FROM dual UNION ALL
    SELECT 8 col1, 2 day FROM dual UNION ALL
    SELECT 9 col1, 2 day FROM dual UNION ALL
    SELECT 10 col1,2 day FROM dual
    SELECT *
      FROM temp
    Result of the query above:
    COL1     DAY
    1     1
    2     1
    3     1
    4     1
    5     1
    6     1
    7     2
    8     2
    9     2
    10     2
    DESIRED result set:
    DAY COL_TOTAL
    1   21 
    2   55   -- 21 + 33 (the sum of day 1 + the sum of day 2)I realize that I can get the desired result set from above with the code below. However, for my actual issue I have several other data points and 100 of distinct days that I need to do this for. So doing a 100 UNION statement isn't exactly going to work.
    WITH temp AS
    SELECT 1 col1, 1 day FROM dual UNION ALL
    SELECT 2 col1, 1 day FROM dual UNION ALL
    SELECT 3 col1, 1 day FROM dual UNION ALL
    SELECT 4 col1, 1 day FROM dual UNION ALL
    SELECT 5 col1, 1 day FROM dual UNION ALL
    SELECT 6 col1, 1 day FROM dual UNION ALL
    SELECT 7 col1, 2 day FROM dual UNION ALL
    SELECT 8 col1, 2 day FROM dual UNION ALL
    SELECT 9 col1, 2 day FROM dual UNION ALL
    SELECT 10 col1,2 day FROM dual
    SELECT SUM(col1) AS col_total
      FROM temp
    WHERE day <= 1
    UNION ALL
    SELECT SUM(col1) AS col_total
      FROM temp
    WHERE day <= 2Edited by: user652714 on Aug 13, 2012 9:55 PM

    Hi,
    I see now what you want . You can use this:
    select *
    from tt
    order by col_1;
         COL_1        DAY
             1          1
             2          1
             3          1
             4          1
             5          1
             6          1
             7          2
             8          2
             9          2
            10          2
    10 rows selected.
    select day, sum(total) over  (order by  day) COL_TOTAL
    from
    (select day, sum(col_1) TOTAL
    from tt
    group by day
        DAY  COL_TOTAL
             1         21
             2         55
    2 rows selected.

  • How to order SQL query results in order given in IN Clause

    Hi,
    I Need to construct a query, which takes a string as input and results for those should be sorted in the order in which request was made.
    Say, we have a couple of students, and the grades in different subjects to be the result of the query.
    If John and Jane are the two students,
    and if input is John,Jane
    my output should be listing John, his subjects and grades
    and then Jane, her subjects and grades.
    I read somewhere in other posts, that i could use a query combined with regular expression to split a string into a temp table/array and use this as my input for my select query. Then use the rownum or level from this temp table to sort the data in order sent in.
    But am not able to put together a query which would work for me.
    Anyone with any pointers on this would be highly appreciated.
    Thanks

    Hi,
    [This thread|http://forums.oracle.com/forums/thread.jspa?threadID=702891&tstart=0] is about splitting up delimited lists. You'll want to keep the n-th value from the user-supplied list, as well as n itself, in a result set, so you can use it in both your WHERE- and your ORDER BY clause.
    If you're using SQL*Plus, you can also keep the whole list in a substriution variable, and use INSTR to see where individual values appeard in that list. Personally, I'd trust the first method (split and store) more.

  • Help assigning a   calculated arbitrary  ID to a query result set

    Given the sample query result..
    (sorry about the formatting of the output)
    GROUPID LAST_NAME FIRST_NAME INITIALS EMAIL PHONE count(PHONE)
    GP2001 Troy Diana s [email protected] 123-456-7890 2
    GP2001 Troy Diana s [email protected] 123-456-7890 2
    GP2006 Thomas Carl p [email protected] 789-100-1112 1
    GP2007 Riker William T [email protected] 866-908-6654 1
    GP3001 Laforge Jody m jlaforge@enterprisenet 456-789-9000 3
    GP3001 Laforge Jody m [email protected] 456-789-9000 3
    GP3001 Laforge Jody m [email protected] 456-789-9000 3
    GROUP_ID is a calculated field from a select statement.
    Individuals with one phone number (ph_cnt = 1)
    is assigned an arbitrary unique GROUP_ID.
    Individuals, appearing more than once, with more than one phone (ph_cnt > 1)
    are giving the same GROUP_ID.
    I was thinking of using a case statement in this case...but got stuck on generating the GROUP_ID based
    on the phone count.
    select case
    when ph_cnt = 1 then select 'GP'||to_char(sysdate,'hhmisssss') from dual)
    when ph_cnt > 2 then <assign a unique group_id to each set of duplicates/triplicate...etc>
    end GROUP_ID,
    last_name,
    first_name,
    initials,
    email,
    phone
    (select last_name,
    first_name,
    initials,
    email,
    phone,
    count(phone) ph_cnt
    from my tab
    group by
    last_name,first_name,initials,email,phone)
    Edited by: ch**** on Apr 25, 2011 7:20 AM

    Try this,
    SELECT 'GP' || 1000 + DENSE_RANK () OVER (ORDER BY phone ASC) groupid,
           last_name,
           first_name,
           initials,
           email,
           phone,
           COUNT (1) OVER (PARTITION BY phone) ph_cnt
      FROM my tab;G.

  • Large query result set

    Hi all,
    At the moment we have some java classes (not ejb - cmp/bmp) for search in
    our ejb application.
    Now we have a problem i.e. records have grown too high( millions ) and
    sometimes query results in retrieval of millions of records. It results in
    too much memory consumtion in our ejb application. What is the best way to
    address this issue.
    Any help will be highly appreciated.
    Thanks & regards,
    Parvez

    you can think of following options
    1) paging: read only few thousands at a time and maintain a index to page
    through complete dataset
    2) caching!
    a) you can create a serialized data file in server to cache the result set
    and can use that to browse through. you may do on the fly
    compression/uncompression while sending data to client.
    b) applet based solution where caching could be in client side. Look in
    http://www.sitraka.com/software/jclass/cs_ims.html
    thanks,
    Srinivas
    "chauhan" <[email protected]> wrote in message
    news:[email protected]...
    Thanks Slava Imeshev,
    We already have search criteria and a limit. When records exceeds thatlimit
    then we prompt user that it may take sometime, do you want to proceed? If
    he clicks yes then we retrieve those records. This results in lot ofmemory
    consumtion.
    I was thinking if there is some way that from database I can retrieve some
    block of records at a time rather the all records of a query. I wander how
    internet search sites work, where thousnds of sites/pages match criteriaand
    client can move back & front on any page.
    Regards,
    Parvez
    "Slava Imeshev" <[email protected]> wrote in message
    news:[email protected]...
    Hi chauhan,
    You may want to narrow search criteria along with processing a
    limited number of resulting records. I.e. if the size of the result
    is bigger than a limit, you stop fetching results and notify the client
    that search criteria should be narrowed.
    HTH.
    Regards,
    Slava Imeshev
    "chauhan" <[email protected]> wrote in message
    news:[email protected]...
    Hi all,
    At the moment we have some java classes (not ejb - cmp/bmp) for
    search
    in
    our ejb application.
    Now we have a problem i.e. records have grown too high( millions ) and
    sometimes query results in retrieval of millions of records. It
    results
    in
    too much memory consumtion in our ejb application. What is the best
    way
    to
    address this issue.
    Any help will be highly appreciated.
    Thanks & regards,
    Parvez

  • Exporting query result set into CSV file using Forms

    Hi ,
    My requirement is
    -> I need to create a form where I have a Multi line text box and two button.
    -> When I enter a query in text box and click on Execute button, It should execute a select query.
    -> After execution, Result set needs to be exported into an Excel file.
    Please give a hint how to do this????
    Thanks,
    maddy

    as you are using text item to write SQL query by the user
    so for that you need to use the exec_sql package to parse the text items query and get definitions and values of the columns being
    resulted in the result set of the query.
    once your query is execute to the desired connection then you need to use fetch the result to the CSV file by use of the TEXT_io package
    which will open the text file with .csv extension and you have to pass the each line to that text file with comma separated values as "ss","rr" etc.
    or you can use the ole2 package to call the excel application and then fetch the data of exe_sql query to that.

  • How to - extract query result set in CSV and make multiple files if result set is huge.

    I have a query which returns millions of rows. I need to extract those rows in CSV files. Having said that i want to keep these files under a limit of 500 MB . Result set can be distributed among multiples files but each file can not be > 500 MB in size.
    How to achieve this?

    You may use this standard! procedure from Blushadow and produce something useful for your need. https://community.oracle.com/message/6499123#6499123

Maybe you are looking for

  • My iTunes library seems to have a problem. Help!

    My iTunes library seems to have a problem. I saw no way to "automatically" convert to the file structure that many others have (including my kids' macs) that separates under iTunes media, music, movies, tv shows, audiobooks, etc. So I did this manual

  • Doubt in SM59

    Hi Experts, While creating the RFC destination for IDOC Adapter we choose the connection type as " 3 " ( ABAP Connection ) But for the RFC adapter the connection type is " T " (TCP/IP) . What is the reason behind this ? And in the Sender RFC adapter

  • Alignment issues between timelines?

    I am stumped. I am not a newbie, but this is driving me crazy. (not my file, supplied by client) I have a movie clip in the main timeline, which in its own timeline has rollover buttons which coincide with popup panels in the main timeline. I need to

  • Adobe TV : 404 Error

    FYI when I login in my Adobe https://digitalpublishing.acrobat.com/ (still takes forever by the way ;-)) and clink on bottom right link for Adobe TV http://tv.adobe.com/show/undefined/#/show/learn-digital-publishing-suite/ it leads to "404 - Not Foun

  • Drawing a warped grid in perspective???

    Now...... i know how to use the perspective tool and i understand that i can draw a grid onto this but the grid always seems to be out of whack when i do and the line spacing isn't at all perfect.  What i want to be able to do is draw a grid with equ