Does Declare Dynamic Cursor Support with Order Clause?

Given a dynamic cursor like
     declare CUR_10 dynamic cursor for SQLSA;
     prepare SQLSA from :ls_SQL;
     open dynamic CUR_10;
     do while TRUE
          fetch CUR_10 into :ls_var1, :ls_var2
     loop
where ls_SQL is "select COL1, COL2 from TABLE_A order by COL2 desc"
can I fetch values in the exact DESCENDING order of COL2?

Hello Ronald,
Values will be fetched in the way you SQL statement has been defined for your dynamic cursor, so in the descending order.
I've tested your code with an Oracle connection and it works perfectly.
Just ensure to add a condition to your DO WHILE statement when the resultset is exhausted:
DO WHILE TRUE AND SQLCA.SQLCode <> 100
Kind regards,
Jacob

Similar Messages

  • NestedSlects In Select Staments with clubbing of 5 tables with Order Clause

    Hi Experts,
    I need to execute on Oracle Qurey in Receiver JDBC.
    The oracle select Query contains
    1. Many Select statments in the parent select statment
    2. In side child select stament there are standard SQL fiunctions like.. NVL()
    3. Parent select statements is operating on 5 tables...
    4. There is big where clause, in side the where clause thare are some more select statments and standard SQL functions
    5. It has order by caluse as well.
    On total, it was a full pledged SQL Select statment, which has all types and varieties of twists in side it.
    Clinet is not agreeing for Stored Procedure. He just want to execute Big Select statment form XI and get back the resltant rows.
    It is Sync scenario...
    Can this be achived using XI by using Recever JDBC adatper by passing XML SQL statment..
    Thanks
    Subbu

    Hi Raj,
    Thanks you very much for your quick link, and i have gone through all the links/blogs before i posted the question. I heave searched total SDN and I am not sure that XI has this capability.
    Do you have any experiences or suggestions on the limitations on XML SQL format, when we are doing to querying such a complex select statement form XI. Because i dont know how much impact
    Please share your thoughts. 
    Thanks
    Subrahmanyam

  • RichTable dynamic column support with sorting

    I have a table of data that has a list of custom properties which is dynamic. They could be text, integer, etc. I would like to display each custom property as a column in the table with the static list of properties as follows:
    Name Data Date CustomProp1 CustomProp2
    dataname some data 10/10/2010 my prop1 12345
    Since properties are dynamic, my collection for the table does not have a fixed set of columns.
    Before I get too far, has anyone had experience doing this such that the columns can be sorted and modified and are not part of a static list? For example, can I somehow override the sort function or what would I put for sortProperty for the column?
    So far I plan on my table being a collection of my data object, then when defining the columns, use a foreach to get the list of custom columns...for the data, I would call a custom tag function that gets the value for the property / row pair (not sure if this will work or if there's a better way)...however, I'm stuck on sorting for sure.
    Any help appreciated.
    Thanks,
    Kris

    Frank,
    Okay, you confirmed my plan. For displaying the dynamic column data, can I add a hashtable to the table's model as follows, sounds like this could work:
    <af:forEach ...>
    <af:column>
    <af:outputText value="#{tablevar.hashTable[foreachvar]}"> </af:outputText>
    </af:column>
    </af:forEach>
    At least this is what I'm going to try...
    Actually, my first roadblock is what to put into the sortable property or is there a way for me to override and use my own method for sort?:
    <af:column sortable="true" sortProperty="">
    </af:column>
    Thank you,
    Kris
    Edited by: KrisFromOhio on Dec 3, 2008 1:37 PM

  • ESQL/C: Difficulties with DECLARE CURSOR  and nested FROM CLAUSE

    Hello @All,
    i am trying to migrate an old esql-c-Application to Oracle 11g (on 64-Bit-AIX 7.1 - Platform)
    PreCompiling is OK, but during runtime the following DECLARE - Statement returns ORA-01001: invalid cursor :
    EXEC SQL
    DECLARE cur_xyz CURSOR FOR
    SELECT vPE, mPE, mZW, COUNT (*)
    FROM ( SELECT v.K_PE AS vPE, m.K_PE AS mPE, m.ZW AS mZW, v.VKG
    FROM ( SELECT K_NR, K_PE, u3.VKG, POS
    FROM u3, r
    WHERE u3.K_NR = '999999'
    AND     u3.LANG = 'F'
    AND SUBSTR (PRTCTRL, 5, 1) > '0'
    AND u3.VKG = r.VKG ( + )
    ) v, m
    WHERE
    v.K_NR = m.K_NR ( + )
    AND v.K_PE = m.K_PE ( + )
    AND POS is Null
    ) X
    WHERE not EXISTS (SELECT VKG FROM NP WHERE X.VKG = NP.VKG )
    GROUP BY vPE, mPE, mZW
    ORDER BY vPE
    When I run this statement without "EXEC SQL DECLARE cur_xyz CURSOR FOR" in SQL-Developer, there is no problem.
    What is my fault? I hope, that I don't have to redesign this.
    Thx in advance for anyonce help.

    Hey Billy,
    I work in a C/C++-Environment under AIX. I allready build a library with with more than x.000 Functions with ESQL-Statements.
    Most of them are running.
    If I need a CURSOR, I allways use constructs like this:
    EXEC SQL DECLARE CursorName [SCROLL]CURSOR FOR
    SELECT ...
    if (SQLC == 0) {
    EXEC SQL OPEN CursorName;
    while (SQLC == 0) {
    EXEC SQL FETCH ... CursorName INTO :<Structure or Fieldlist>;
    EXEC SQL CLOSE CursorName;
    At the Moment, I don't work with a cursor-variable in the DECLARE-Section.
    In the case i discribed above, it is the first, where the ORA-01001 occurs.
    Is it necessary to work with SQL_CURSOR - Variable in all or in special cases?
    Thx 4 answers.

  • Hosting company does not support SQL query with OUTFILE clause

    From my mysql database, I want to allow the user to run a query and produce a csv / text file of our membership database.   Unfortunately,  I just found out my hosting company does not support the SQL query with OUTFILE clause for MySQL database.
    Are there any other options available to produce a file besides me running the query in phpadmin and making the file available to users.
    Thanks.  George

    Maybe this external Export Mysql data to CSV - PHP tutorial will be of help
    Cheers,
    Günter

  • Is dynamic VLAN assignment supported with web-authentication?

    The 7.6.130.0 WLC configuration guides says this:
    "Dynamic VLAN assignment is not supported for web authentication from a controller with Access Control Server (ACS)"
    How should we interpret this, exactly? Does this mean that dynamic VLAN assignment is supported with web authentication from a controller if some other RADIUS server is used (Eg: FreeRadius, ISE)?

    It is not supported with any kind of radius server. The radius attributes ACS uses for pushing those settings (64,65,81) are the same for every other radius implementation. Pushing a QoS profile does work.

  • Report with Dynamic Cursor

    hi forum
    I need your help and I hope you can help me. In my job I need to do a Report, but the function that containts the cursor returns a ref cursor and this ref cursor doesn't return a special format 'cause the cursor that I use is Dynamic so when I try to do the report it is not generated.
    the documentation says that should return something for example
    type vref_cursor is ref cursor[b] return record;
    or
    type vref_cursor is ref cursor return depto%rowtype;
    but if I use this in a dynamic cursor it generates an Error and don't accpet this declaration only the following
    type vref_cursor is ref cursor;
    Do you Know how should I do the report with a dynamic cursor ?
    best regards
    thank's a lot

    That is not possible. From the online help:
    Each ref cursor query is associated with a PL/SQL function that returns a strongly typed ref cursor.

  • HT201493 Why when I try to sign in to Find my Friends does it tell me I cannot as my iPhone is not supported with free iCloud service? I do not use find my friends on another device.

    Why when I try to sign in to Find my Friends does it tell me I cannot as my iPhone is not supported with free iCloud service? I do not use find my friends on another device.

    So, have you created an iCloud account and is your device connected to iCloud?

  • What does this message mean Charging is not supported with this device?

    What does this message mean Charging is not supported with this device?

    You've gotten 2 good answers already, but there's a key assumption in both that you got the message when connecting the iPhone to some other device. If this is the case you can get an adapter in the Apple online store that will allow charging from older devices.
    If, however, this message appears when you are not connected to anything the problem is dirt or moisture in the dock connector at the bottom of the phone. Clean it with a dry toothbrush or air blast.

  • Why does my iPod(3rd gen) say charging is not supported with this accessory even though its not plugged in?

    I was eating breakfast one morning playing a game on my iPod and it slipped out of my hand and into my cereal bowl. So immediately I took off the case and put in a bag of rice for a day and a half to let it dry out. Then when it started working again (thankfully) a notification popped up saying charging is not supported with this accessory after I unplugged it from the wall. So I thought nothing of it and pressed dismiss. Now when ever I wake it up, instead of my wallpaper popping up in the lock screen that stupid notification does. How can I get rid of it? Also my home button doesn't work anymore so I have to use asisstive touch instead. How do I take a screen shot without the assisting touch menu in the way? Thank you.

    - Inspect the dock connector on the iPod for bent or missing contacts, foreign material, corroded contacts, broken, missing or cracked plastic.
    - Reset all settings      
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                 
    iOS: How to back up           
    - Restore to factory settings/new iOS device.
    If still problem, make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem.
    Apple Retail Store - Genius Bar          
    Apple will exchange your iPod for a refurbished one for this price. They do not fix yours.
      Apple - iPod Repair price

  • Does ALDSP 2.5 supports INOUT cursor??

    Hi,
    We are using ALDSP 2.5 and trying to connect to oracle stored procs. Some of these stored procs have INOUT Cursor, INPUT cursor and associate array types.
    Does ALDSP 2.5 supports this??
    If not please let me know whether other versions support this.
    Thanks in advance.

    Please post ALDSP/ODSI questions on the ODSI forum.
    Data Service Integrator
    cursor is not supported, array is not supported.

  • Has anyone got dynamic version support to work with the HTML converter?

    I have tried this for some time and followed all the guidelines, but it still don't work. Could someone post the HTML-code for a working applet that is converted with dynamic version support ?

    Using 1.4.1_03
    java -jar htmlconverter.jar -gui
    selected directory, "Standard" template file, "Use any Java 1.4, or higher"
    <html>
    <body>
    <!--"CONVERTED_APPLET"-->
    <!-- HTML CONVERTER -->
    <OBJECT
        classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
        WIDTH = 200 HEIGHT = 100 
        codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4-win.cab#Version=1,4,0,0">
        <PARAM NAME = CODE VALUE = Version.class >
        <PARAM NAME="type" VALUE="application/x-java-applet;version=1.4">
        <PARAM NAME="scriptable" VALUE="false">
        <COMMENT>
         <EMBED
                type="application/x-java-applet;version=1.4"
                CODE = Version.class
                WIDTH = 200
                HEIGHT = 100 
             scriptable=false
             pluginspage="http://java.sun.com/products/plugin/index.html#download">
                 <NOEMBED>
              </NOEMBED>
         </EMBED>
        </COMMENT>
    </OBJECT>
    <!--
    <APPLET CODE = Version.class WIDTH = 200 HEIGHT = 100>
    </APPLET>
    -->
    <!--"END_CONVERTED_APPLET"-->
    </body>
    </html>

  • First clause with order by

    Hi,
    I have a requirement where I need to display a list of employees, performance rating and manager id. I want to display the emplyees first whos manager is as manager_id as input parameter. So lets say a manager logs in, he should see his reportees first and then therest. How can I implemet this in SQL? I am trying first clause with order by but not sure how to do that here. A help on this would be appreciated.
    procedure
    display_list(manager_id in varchar2)
    Output is:
    emp_id
    manager_id
    performance_rating
    Edited by: Nandini on Apr 28, 2013 10:48 PM

    You can use a CASE statment, which will check the MANGER_ID column against the passed manager id value, as shown below..
    order by
      case when manager_id = :input_manager_id then 0
             else 1
      end,manager_id,performace_rating desc

  • Problem with order by clause

    Hai all,
    I have problem with order by clause,
    My query is
    "select number from table1 order by number asc "
    and the output is displaying as
    1
    10
    12
    13
    15
    17
    19
    2
    20
    21
    22
    But if we give order by it should display as below only right ?
    1
    2
    10
    12
    13
    15
    17
    19
    20
    21
    22 ........
    Please help me why it is not displaying like it. and how to make the statement to display like the second case. Thanks in advance.
    Regards,
    Uraja

    The column datatype that you are selecting is not of NUMBER datatype(might be char or varchar2) hence you are getting such result set.
    And for this purpose, it is recommended to set datatype of a column appropriately.
    For now you can add TO_NUMBER function to column in ORDER BY clause, only if it has data of number type.
    Edited by: Ora on 19 Nov, 2012 3:10 AM

  • Query with order by clause

    Hi,
    I found a query with order by clause in procedure which is taking long time.
    Stats are upto date.
    Total Rows :650000.
    It is ordered by primary key column.
    select * from table_name order by col1;
    col1 is a primary key.No of cpu's used is 4.
    can anyone suggest me a better solution to improve the performance of a query.
    Is it better to use parallel hint for above scenario.
    Any help really apprecaited.
    Thanks in advance.

    Hi,
    Thanks for ur immediate reply.
    It doesn't have where clause.
    below is the plan
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 619071987
    | Id  | Operation                   | Name                 | Rows  | Bytes | Cos
    |   0 | SELECT STATEMENT            |                      |   671K|   255M| 125
    |   1 |  TABLE ACCESS BY INDEX ROWID| FULL_ITEM_FACILITIES |   671K|   255M| 125
    |   2 |   INDEX FULL SCAN           | FIF_PK               |   671K|       |
    9 rows selected
    Executed in 0.094 secondsThanks in advance
    Edited by: unique on Jun 22, 2009 8:26 AM

Maybe you are looking for

  • 1:n Relationship with one EJB

    Hello, I want to create an EntityBean with a self-referencing relationship - for example one manager with many employees. OC4J V9.0.3 deploys my EAR-file correctly but doesn't build up the correct relationship-table, because the primary key fields ar

  • Cogi Errors due to Material Substitution

    Hello, In plant 0162 we have cogi errors that I can not explain. It is related to material substition and BOM changes.the COGI error comes from the component material 10085940 in order 100239889. this material 10085940 was set for material substituti

  • OPEN DATASET output to Tab delimited text file???

    Can anyone suggest the best way for downloading a TAB DELIMITED text file to the application server using open dataset. I'm currently downloading the file, but I find that it puts "#"'s in place of empty numeric fields. any help appreciated, Lee

  • Trackpad sensitivity?

    Greetings everyone! I have just stepped up to a MacBook Intel Duo from an older ibook dual USB and I seem to be having some growing pains with my new trackpad My Macbook's trackpad seems to be way more sensitive than my old one was. So sensitive in f

  • Converting .avi to .mp4: No audio

    I am trying to convert an avi to mp4 so I can play it on my ipod. I only plan on doing this 1 file so it makes no sense for me to purchase Quicktime Pro or VisualHub, so my options are iSquint and MPEG Streamclip. After trying within iSquint, the con