Simple cursor selection problem

Hi,
I have a cursor which takes a supplier id to calculate totat sales for that particular supplier. How would i modify this cursor so that if the b_sup_id is null it calculates the total for ALL suppliers??
CURSOR c_totals(b_tim_id number, b_sup_id number) IS
SELECT SUM(unmatched_count) count
FROM sales
WHERE sup_id = b_sup_id;
Many thanks

Please do keep in mind that cursor loops are obsolete and, at least from your description, any looping structure is unnecessary and inefficient.
First try to use SQL
If you can not then, and only then, use array processing.
http://www.psoug.org/reference/array_processing.html
Try the slow_way demo then any one of the first fast_way demos.
There is no value in saving one line of code and writing something that is hopelessly slow and inefficient.

Similar Messages

  • Black MacBook cursor/selection problems

    Having a few problems.
    When I hover the cursor over a link or application, the item will be selected very quickly before I actually click on it myself. Other times when I click on a tab or link the cursor will drag the item around as if I was holding down the trackpad button.
    Other times I open the mac from sleep mode and I won't be able to click on anything at all!
    Please help!

    Hi Phil2412 and welcome to Apple Discussions!
    It sounds like the trackpad and/or button itself is failing. Is your MacBook still under warranty or an AppleCare plan? Regardless, you will probably need to have it repaired. Contact Apple using the appropriate phone number on [this page|http://www.apple.com/support/contact/phone_contacts.html] or carry it in to an Apple retail store for repair. Be sure to [make an appointment|apple.com/retail] first or you may spend a long time waiting to talk to a Mac Genius.
    Best of luck.

  • Print only cursor-selected area of a PDF in Acrobat Pro, just as it is psbl to do in a browser

    Hi
    I want to print only cursor-selected area of a PDF in Acrobat Pro. That could be both text and images, which are in my selection. Just as it is psbl to do in a browser. Is it possible in Acrobat PRO?
    I am using the latest Acrobat Pro 11.0.9

    Thanks for your effort but this again clearly does NOT answer my question. I do see a particular problem and that is that I might want to select text and images over a range of multiple pages. In a doc of 20 pages I might want to make a single selection of the text starting PRECISELY at the MIDDLE of page 2 and then continue dragging my selection all the way to PRECISELY the MIDDLE of page 15, thereby selecting all text and images within the precise range of my selection. That is some 13 pages there and I want to print out ONLY THAT selection of text and images. And in that case I cannot use your suggestion with the marquee zoom. Do you get me?

  • DBMS_XMLQuery behavior when using stored function within cursor select

    Consider the following SQL Statement
    select t1.id
    , t1.name
    , cursor ( select t2.id
    from tab t2
    where t2.t1_id
    = t1.id
    and validate(t2.xyz,:bd1)
    = 1
    from tab t1
    where t1.id = :bd2
    DBMS_XMLQuery is used to create a context and to bind the appropriate values. In this case 'validate' is a stored function. I get the following error message upon execution:
    ORA-29532: Java call terminated by uncaught Java exception:
    java.sql.SQLException: Missing IN or OUT parameter at index:: 1
    Issuing a similar statement in SQL*Plus works fine. I was wondering whether this is a known issue when using a stored function in the cursor select statement in the context of DBMS_XMLQuery or whether I'm doing something wrong.

    Hi Jan,
    This problem has been identified and fixed. The fix should be available in the next release. Thank you for bringing this up to our attention.
    visar

  • Cursor selection not working-bu​g?

    hi i've the following problem. if u can find out please try the same
    created 3 cursors for an XY graph
    select one or many cursors from the legend. try to move the cursors using the '' tool. repeat this again
    the cursor selection is unpredictable!!
    Renn
    LV 12.0f1 (64 bit)
    Kudos always welcome for helpful posts

    Hi Dan,
    i have selected Cursor 0
    then i clicked near 7, then using the navigation button (on the right side), i've increased the Y value. Cursor 0 is selected but, the Y value of Cursor 2 is incremented.
    Many Customers are having problem with this. Please help.
    Thanks
    RENN
    Kudos always welcome for helpful posts
    Attachments:
    TestCursorLV2012.vi ‏8 KB
    TestCursorLV8.0.vi ‏11 KB

  • Reg. cursor-selection in module pool....have ur points.

    Hi all,
    Pleas. help me with  a simple example of at cursor-selection in module pool programming.
    with simple code & steps
    <b>Have ur points.</b>
    Regards,
    [email protected]

    Hi Pradeep,
    The Best explanation with example comes from our help.sap.com....
    <i><b>http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbabbd35c111d1829f0000e829fbfe/content.htm</b></i>
    Also this might help...
    <b>MODULE mod [ AT {EXIT-COMMAND|CURSOR-SELECTION} ]
    [ ON {CHAIN-INPUT|CHAIN-REQUEST} ]
    [ SWITCH switch ].
    ... AT CURSOR-SELECTION</b>
    The AT CURSOR-SELECTION addition at the event PAI causes the module mod to be called only if
    The function used to trigger event PAI has function code "CS" and function type "S"
    The cursor is placed on a single input or output field of the screen at the moment of the user action
    The call occurs within the usual PAI processing, meaning that the automatic input checks defined in the system or in the ABAP Dictionary are executed and the MODULE statement is called according to its position in the event block. You can use the addition in connection with the FIELD statement.
    If the PAI event is triggered under the above circumstances, the function code is not passed to sy-ucomm and the OK field. They keep their previous values.
    <b>Note</b>
    The function type and function code of a function are determined in the Screen Painter or in the Menu Painter. We recommend to assign function code "CS" in the Menu Painter to function key F2 in order to simultaneously assign the double-click function of the mouse to it. This allows you to assign dialog modules to the selection of input or output fields.
    <b><u>Refer thread:</u></b> <i><b>Re: MODULE REQUEST
    Hope that helps!!
    <i><b>*Reward useful answers*</b></i>
    Regards,
    Naveenan.

  • SIMPLE Database Design Problem !

    Mapping is a big problem for many complex applications.
    So what happens if we put all the tables into one table called ENTITY?
    I have more than 300 attributeTypes.And there will be lots of null values in the records of that single table as every entityType uses the same table.
    Other than wasting space if I put a clustered index on my entityType coloumn in that table.What kind of performance penalties to I get?
    Definition of the table
    ENTITY
    EntityID > uniqueidentifier
    EntityType > Tells the entityTypeName
    Name >
    LastName >
    CompanyName > 300 attributeTypes
    OppurtunityPeriod >
    PS:There is also another table called RELATION that points the relations between entities.

    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    check the coloumn with WHERE _entityType='PERSON'
    as there is is clustered index on entityType...there
    is NO performance decrease.
    there is also a clustered index on RELATION table on
    relationType
    when we say WHERE _entityType ='PERSON' or
    WHERE relationType='CONTACTMECHANISM'.
    it scans the clustered index first.it acts like a
    table as it is physically ordered.I was thinking in terms of using several conditions in the same select, such as
    WHERE _entityType ='PERSON'
      AND LastName LIKE 'A%' In your case you have to use at least two indices, and since your clustered index comes first ...
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Have you ever thought of using constraints in your
    modell? How would you realize those?
    ...in fact we did.We have arranged the generic object
    model in an object database.The knowledge information
    is held in the object database.So your relational database is used only as a "simple" storage, everything has go through your object database.
    But the data schema is held in the RDBMS with code
    generation that creates a schema to hold data.If you think that this approach makes sense, why not.
    But in able to have a efficent mapping and a good
    performance we have thought about building only one
    table.The problem is we know we are losing some space
    but the thing is harddisk is much cheaper than RAM
    and CPU.So our trade off concerated on the storage
    cost.But I still wonder if there is a point that I
    have missed in terms performance?Just test your approach by using sufficiently data - only you know how many records you have to store in your modell.
    PS: it is not wise effective using generic object
    models also in object databases as CPU cost is a lot
    when u are holding the data.I don't know if I'd have taken your approach - using two database systems to hold data and business logic.
    PS2: RDBMS is a value based system where object
    databases are identity based.we are trying to be in
    the gray area of both worlds.Like I wrote: if your approach works and scales to the required size, why not? I would assume that you did a load test with your approach.
    What I would question though is that your discussing a "SIMPLE Database Design" problem. I don't see anything simple in your approach when it comes to implementation.
    C.

  • Getting ORA-01000 : maximum open cursors exceeded  problem

    I am getting ORA-01000 : maximum open cursors exceeded problem in my piece of java code when the
    load is high .Open cursors is set to 1000 still getting the same problem .
    Basically i have to select some rows from a table which i am doing in A() function and process it and insert into
    another table which i do it in another function B() there is a update statement also in this fun.
    There is a particular business logic for which i need to call B() from the A() function
    which happens to be in the select result set like below
    A()
    query ="Select * from temp";
    while(rs.next)
    B();
    All the result sets are properly being closed that too in finally block.
    I dont see any other problem with code .Still I am gettin this cursor problem.
    Is some thing wrong with the design like calling a
    insert from a result set while loop or the update statement

    The code below is deleting fine. Check your $id is valid. I wonder if ADOdb has some quirks with binding and variable creation/destruction, similar to #1 in http://www.oracle.com/technology/tech/php/htdocs/php_troubleshooting_faq.html#bindvars
    <?php
    See ADOdb Tutorial for Oracle: http://phplens.com/lens/adodb/docs-oracle.htm
    drop table mytab;
    create table mytab (city varchar2(20), country_id varchar2(20));
    insert into mytab values ('SF', 'US');
    insert into mytab values ('Sydney', 'AU');
    insert into mytab values ('London', 'UK');
    commit;
    require_once("/home/cjones/public_html/php/adodb5/adodb.inc.php");
    $db = ADONewConnection("oci8");
    $db->Connect("//localhost/XE", "hr", "hrpwd");
    echo "Before:\n";
    $rs = $db->Execute("select city from mytab");
    while ($arr = $rs->FetchRow()) {
        echo $arr['CITY'] . "\n";
    $s = $db->Prepare("delete from mytab where country_id = :ci");
    $db->Parameter($s, $ci, 'ci');
    foreach (array('US', 'AU') as $ci) {
         $db->Execute($s);
    echo "After:\n";
    $rs = $db->Execute("select city from mytab");
    while ($arr = $rs->FetchRow()) {
        echo $arr['CITY'] . "\n";
    ?>There's another sample in the ADOdb OCI8 driver:
              Usage:
                   $stmt = $DB->Prepare("insert into table (col0, col1, col2) values (:0, :1, :2)");
                   $DB->Bind($stmt, $p1);
                   $DB->Bind($stmt, $p2);
                   $DB->Bind($stmt, $p3);
                   for ($i = 0; $i < $max; $i++) {     
                        $p1 = ?; $p2 = ?; $p3 = ?;
                        $DB->Execute($stmt);
                   }For queries I know this works. I haven't seen any examples that prepare once.
    $rs = $db->Execute("select city from mytab where country_id = :ci", array('ci' => 'UK'));
    while ($arr = $rs->FetchRow()) {
        echo $arr['CITY'] . "<br>\n";
    }

  • NON Cursor Select

    Does anyone know how to prepare and execute a select statement w/out using a cursor. My query is only ever going to return one row and I do not want the overhead of a cursor. I tried a simple "SELECT * INTO :stRec WHERE key = :key1" but the execute does not understand the INTO clause. Thanks in advance.

    A NONVURSOR SELECT WILL HAVE MORE OVERHEAD
    WHEN COMPARED TO CURSOR SELECT BECAUSE
    IT HAS TO IMPLICTLY CHECK WHETHER NUMBER
    OF RETRIEVED < 2
    null

  • R : Fetch Cursor - Select Cursor

    Scenario I
    - use an OPEN Cursor, Fetch Cursor and specify the MAXROWS parameter as
    200, FORTE returns me only 1 row.About Scenario I: you MUST surround your open-fetch-close cursor cycle by a
    begin transaction - end transaction statement.
    That is, your code should appear as follows:
    begin transaction
    open cursor...
    fetch cursor...
    do what you want...
    close cursor...
    end transaction.
    Hope this helps.
    Greetings.
    Cristina Tomacelli - CSI Piemonte
    Corso Unione Sovietica, 216 - 10134 TORINO - ITALY
    E-mail address: [email protected]
    Telephone Number: +39-11-4618387
    Da: Bala Cuddalore
    A: blunda; chiaberto; tamietti; tomacelli; forte-users
    Oggetto: Fetch Cursor - Select Cursor
    Data: gioved 13 marzo 1997 19.42
    Hi Folks,
    I am using a PREPARE to dynamically create a SELECT statement. when I
    Scenario I
    - use an OPEN Cursor, Fetch Cursor and specify the MAXROWS parameter as
    200, FORTE returns me only 1 row.
    Scenario II
    - use a SELECT using the prepared select statment, the number of rows in
    the Dataset returned by FORTE is 0.
    Am I doing something wrong here ? missing any step? We are running
    on ver 2.0.h.0.
    Any help is greatly appreciated.
    Thanks a bunch,
    Bala Cuddalore
    [email protected]
    Sage Solutions
    1360 Sacramento
    Suite 1360
    San Francisco CA 94111

    I had this problem and solved it by wrapping the OPEN, FETCH, & CLOSE
    cursor statements in an explicit transaction. I'm sure this is related to
    the dialog duration for the dbSession object you are using.
    Dennis Wetzel
    C/Soft, Inc
    Carmel, IN
    Hi Folks,
    I am using a PREPARE to dynamically create a SELECT statement. when I
    Scenario I
    - use an OPEN Cursor, Fetch Cursor and specify the MAXROWS parameteras
    200, FORTE returns me only 1 row.
    Scenario II
    - use a SELECT using the prepared select statment, the number of rowsin
    the Dataset returned by FORTE is 0.
    Am I doing something wrong here ? missing any step? We are running
    on ver 2.0.h.0.
    Any help is greatly appreciated.
    Thanks a bunch,
    Bala Cuddalore
    [email protected]
    Sage Solutions
    1360 Sacramento
    Suite 1360
    San Francisco CA 94111

  • I have purchased Mountain Lion to correct the gray cursor square problem, and I cannot get Mountain lion to download

    I purchased Mountain Lion from 10.7.5 on my Imac to correct the gray cursor square problem, now Mountain Lion will not fully download. Any recommendations?

    Upgrading to a newer OS X does not often correct pre existing problems. MIght be a disk space issue, or the startup disk needs repairing.
    Make sure there's enough free space on the startup disk.
    Control click the MacintoshHD icon on your Desktop then click Get Info.
    In the Get Info pane you will see:  Capacity & Available
    Make sure there's at least 15% available disk space.
    For the gray cursor issuee, startup your Mac in Safe Mode
    A Safe Mode boot takes longer then a normal boot so be patient. Once you are in Safe Mode, click Restart from the Apple menu.
    If that didn't help the cursor issue, launch Disk Utility located in HD > Applications > Utilities
    Select the startup disk on the left then select the First Aid tab.
    Click:  Verify Disk
    If Disk Utility reports errors, since v10.7 Lion is the currently installed OS, restart your Mac while holding down the Command + R keys so you can access OS X: About OS X Recovery.
    From there you can access the built in utilities to repair the startup disk.
    message edited by:  cs

  • Selection Problem with JTable

    Hello,
    i have a selection problem with JTable. I want to allow only single cell selection and additionally limit the selection to the first column.
    I preffered the style from MS Outlook Express where you can select the email accounts to edit.
    It is a table like this:
    Account name  |   Type  |   ...
    --------------|---------|---------------------
    Hotmail       |   POP3  |
    GMX           |   IMAP  |The selection should be only avaibable at 'Hotmail' or 'GMX' - not at 'POP3', 'IMAP' or as complete row selection.
    Please help me!
    Thanks.
    Warlock

    Maybe this will helpimport java.awt.*;
    import javax.swing.*;
    public class Test3 extends JFrame {
      public Test3() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container content = getContentPane();
        String[] head = {"One", "Two"};
        String[][] data = {{"R1-C1", "R1-C2"}, {"R2-C1", "R2-C2"}};
        JTable jt = new JTable(data, head);
        jt.getColumnModel().setSelectionModel(new MyTableSelectionModel());
        content.add(new JScrollPane(jt), BorderLayout.CENTER);
        jt.setCellSelectionEnabled(true);
        jt.setRowSelectionAllowed(false);
        jt.setColumnSelectionAllowed(false);
        setSize(300, 300);
        setVisible(true);
      public static void main(String[] arghs) { new Test3(); }
    class MyTableSelectionModel extends DefaultListSelectionModel {
      public void setSelectionInterval(int index0, int index1) {
        super.setSelectionInterval(0, 0);
    }

  • Select Problem For 'Back Menus' - Zen V P

    Just got the Zen V Plus and tried to set the time/date. Followed the 'guide' and after the time/date screen pressed the 'back button'. Got the Set Alarm/Date/Time (etc) menu but when I selected an option (moved joystick down to desired option then pressed the joystick) the time/date display came up and I was NOT ABLE to set the date. Same thing occurred trying to set the date (tried it several times and it worked once .... then attempted again - several times (4) but it only worked once). Turns out I have the same problem with any option in ANY 'back' menu. Suggestion?
    Do I have a defecti've unit (can't be the 'operator' who is defecti've! haha)? Should I return it and try another?
    Actually not that interested in playing music .... it's more for playing .wma(DRM) book files.

    Latest ... updated my firmware (to ZENVPlus_PCFW_P4S_L2___0.exe) and it fixed the select problem for SET DATE/TIME etc however
    the SELECT procedure doesn't always work for 'back button' menus. Example: tried to set a bookmark... following procedure in 'guide', pressed 'back button' and held it, from 'NOW PLAYING' screen - works 2 out of 5 times. Most of the time, pressing and holding takes you back to the previous menu - not to the 'back' (or in this case the SET BOOKMARK) menu. Sounds like something for the next version of firmware ... the code doesn't always set an internal timer correctly (am a programmer of 30 years ... part of that time pgmmng firmware).

  • Print selection problem

    when i select a page to be print from my pc the page select in

    Hello. I feel your pain and frustration with the print selection problem in safari, especially in Snow Leopard. I have spent hours trawling help pages and forums etc. BUT YEE HAA (sorry got a bit excited, but it really was hours) I found the answer. So here goes.
    Click on Safari
    Scroll down to services then slide to right
    Scroll down to services preferences and click
    Scroll down to the Text section
    If you Tick the Text box it will choose all options for you. Or if you don't want all options in the Text list, then untick Text box and tick options you do want.
    BUT for your print selection problem make sure you tick NEW TEXT EDIT WINDOW CONTAINING SELECTION.
    Then when you want to select something in a web page you want to print (including pictures etc) then highlight it, then Right click. And low and behold, in the list is NEW TEXT EDIT WINDOW CONTAINING SELECTION. Click that, Then press cmd+p and your printing.
    I really hope that helps with your problem
    I can now go to sleep.

  • At Line selection problem

    hi,
    iam stuck up with AT LINE-SELECTION problem ie i designed a screen where they need month list on clicking F4. i got the month list using month_names_get in the screen but while clicking the relevant month no.it's not entering into the required parameter. i have attached the codings,
    MODULE MONTH_DIS OUTPUT.
      SUPPRESS DIALOG.
      LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
      SET PF-STATUS SPACE.
      NEW-PAGE NO-TITLE.
      WRITE:/ 'SELECT MONTH' COLOR COL_HEADING.
      ULINE.
      DATA: T_MNTH LIKE T247 OCCURS 12 WITH HEADER LINE.
      refresh t_mnth.
      CALL FUNCTION 'MONTH_NAMES_GET'
       EXPORTING
         LANGUAGE                    = SY-LANGU
    IMPORTING
      RETURN_CODE                 =
        TABLES
          MONTH_NAMES                 = T_MNTH
       EXCEPTIONS
         MONTH_NAMES_NOT_FOUND       = 1
         OTHERS                      = 2
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      loop at t_mnth.
        write:/ t_mnth-mnr, t_mnth-ltx.
      endloop.
      CLEAR T_MNTH-MNR.
    ENDMODULE.                 " MONTH_DIS  OUTPUT
    AT LINE-SELECTION.
      p_period = t_mnth-mnr.
      CHECK NOT p_period IS INITIAL.
      LEAVE TO SCREEN 0.
    here in the AT LINE-SELECTION, the selected month is not coming to the required parameter.
    pls help me in this issue,
    Thanks in advance,
    Premnath.

    You need to set a "Hide" after the write... I suggest you also set your own dialog PF-STATUS too so you can have just a PF2 "pick" button and a Cancel button ( this will look better to the user).
    loop at t_mnth.
      write:/ t_mnth-mnr, t_mnth-ltx.
      hide: t_mnth.  "needs this
    endloop.
    clear: t_mnth.

Maybe you are looking for

  • White fringe appears around text in exported images?

    Hey all, I'm having some problems when I export an image that has no background and antialiased text. No matter what format I save it in or in what way I save it (Save for web and devices, Save as), this white outline always comes up. However, in pho

  • Printing in Tiger

    I recently relocated and am looking for a job. I transferred all my resumes from my floppies to a USB flash disk which would be better in my situation. Unfortunately I am still using Office98 on my ibook G4 with Tiger. Whenever I print (and in this c

  • Audio on the internet

    My speakers are working, when I have tested them they seem to be working fine. When I go to watch a video or clip on the internet, there is no sound. As my speakers are working and the volumes are all turned up to max, I am not sure why the sound is

  • Font name containing parenthesis causes BIP exception

    Just FYI, When embedding font name containing parenthesis (eg: CurrierNew(screen).ttf) to a RTF template and then previewing the output in the BI Publisher Plug-In for MS Word the following error comes up: java.lang.NumberFormatException: For input s

  • Adobe Reader problem [edited by host]

    All of a sudden when adobe reader is utilized the logo comes up and below is 4 lines of asian writing and everything stops. I have uninstalled and reinstalled 3 times to no a vale, any ideas?