Question on cursors

Hello,
I want to retrieve all names and salaries from an employee table based on the number of records shown of what the user inputs and retrieve all names of the salaries that is included in the top n if it matches other employee salaries. For example in the accept command, if a user entered 5 it should show 5 records plus the names of people who have the same record.
Another example in the table there are 3 records:
Sue 2000
Blake 2000
Mary 1000
I enter 2 in the accept command, it should bring back all three records because one of the salaries of the employee matches another employee.
I think the problem I'm having is I do not know what to initialize salary to.
Here's what I got:
ACCEPT p_number PROMPT 'Please enter the number of top money makers: '
DECLARE
v_number NUMBER(4) := &p_number;
v_sal emp.sal%TYPE;
v_count NUMBER;
CURSOR sal_cursor IS
SELECT ename, sal from emp
where sal = v_sal; --I think this is the problem.  What do I initialize v_sal to?
sal_rec sal_cursor%ROWTYPE;
BEGIN
OPEN sal_cursor;
DBMS_OUTPUT.PUT_LINE('Name' || chr(9) || 'Salary');
v_count := 0;
LOOP
FETCH sal_cursor INTO sal_rec;
v_count + 1;
EXIT WHEN v_count > v_number OR
sal_cursor%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(sal_rec.ename || chr(9) || chr(9) || chr(9) || sal_rec.sal);
END LOOP;
CLOSE sal_cursor;
INSERT INTO top_dogs values (sal_rec.ename, sal_rec.sal);
END;
Any help would be greatly appreciated.

I think you are probably looking for DENSE_RANK, or possibly RANK, depending on how you feel about ties.
SQL> WITH emp AS (SELECT 'Sue' emp_name, 2000 sal FROM dual UNION ALL
  2               SELECT 'Blake', 2000 FROM dual UNION ALL
  3               SELECT 'Mary', 1000 FROM dual UNION ALL
  4               SELECT 'Steve', 900 FROM dual)
  5  SELECT emp_name, sal, rnk, drnk
  6  FROM (SELECT emp_name, sal,
  7               RANK() OVER (ORDER BY sal DESC) rnk,
  8               DENSE_RANK() OVER (ORDER BY sal DESC) drnk
  9        FROM emp)
EMP_N        SAL        RNK       DRNK
Sue         2000          1          1
Blake       2000          1          1
Mary        1000          3          2
Steve        900          4          3Note that you can do this without PL/SQL something like:
SQL> !cat t.sql
ACCEPT p_number PROMPT 'Please enter the number of top money makers: '
WITH emp AS (SELECT 'Sue' emp_name, 2000 sal FROM dual UNION ALL
             SELECT 'Blake', 2000 FROM dual UNION ALL
             SELECT 'Mary', 1000 FROM dual UNION ALL
             SELECT 'Steve', 900 FROM dual)
SELECT emp_name, sal, rnk, drnk
FROM (SELECT emp_name, sal,
             RANK() OVER (ORDER BY sal DESC) rnk,
             DENSE_RANK() OVER (ORDER BY sal DESC) drnk
      FROM emp)
WHERE drnk <= &p_number;
SQL> @t
Please enter the number of top money makers: 2
old  10: WHERE drnk <= &p_number
new  10: WHERE drnk <= 2
EMP_N        SAL        RNK       DRNK
Sue         2000          1          1
Blake       2000          1          1
Mary        1000          3          2John

Similar Messages

  • Question Mark cursor keeps appearing

    After my computer has been on for some time, the 'help' list from any program that might be active pops up on the screen. I can't get rid of it. The question mark cursor stays active and all I can do to get rid of it is to restart the computer, but shortly the problem arises again. This has been happening for about a week now.
    Hope someone has a helpful answer. I did try typing my problem into the 'help' search menus, but it didn't work. I know MACs aren't suppose to get viruses.... but this sure sounds like one.
    I have the newest G5 power Mac

    respond please...:-(

  • Question about cursors in a function and how to return the results

    Hi all,
    Some tech info:
    I'm using Oracle 11G database and APEX 4.0.2.00.06
    I use three cursors in a function. My function is called in an APEX standard report, like this by example:
    SELECT fnc_exp(tab.arg1, tab,arg2) FROM table_exp tab;
    My question is: how can I return the values calculated from my function to a standard APEX report? Before, this function was used like this by Oracle Forms to fetch the cursors in the right table columns:
    open c_a;
    fetch c_a into :loc.arg1;
    close c_a;
    open c_b;
    fetch c_b into :loc.arg2, :loc.arg3, :loc.arg4, :loc.arg5;
    close c_b;
    Thanks for your advices!
    Maybe my solution is not right, if you have better ideas, please suggest :)
    PS: If you need more details, please ask which you need.

    Hi,
    I don't think you can do exactly like that in APEX.
    Go for a pipelined function if you want the value be returned from the function.

  • Question regarding cursor variables, while using table functions

    Hi,
    I created a procedure and when i'm try'g to call it. now i'm getting this error.
    CREATE OR REPLACE TYPE TAB_EMP_REC IS OBJECT(
    EMP_ID NUMBER(9),
    EMP_NAME VARCHAR2(30));
    CREATE OR REPLACE TYPE T_EMP_TMP IS TABLE OF TAB_EMP_REC ;
    CREATE OR REPLACE PROCEDURE USP_CREATE_DATA(
    p_Input IN NUMBER,
    V_EMP_CUR OUT sys_refcursor) IS
    T_EMp T_EMP_TMP := T_EMP_TMP( );
    BEGIN
    t_emp.extend();
    t_emp(1) := TAB_EMP_REC(p_input, 'jack');
    OPEN V_EMP_CUR FOR SELECT * from TABLE(t_emp);
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('ERROR '||SQLERRM);
    END USP_CREATE_DATA;
    calling procedure::
    DECLARE
    type O_RESULT_CUR is ref cursor return TAB_EMP_REC;
    V_EMP_REC TAB_EMP_REC;
    BEGIN
    USP_CREATE_DATA(99, O_RESULT_CUR);
    LOOP
    FETCH O_RESULT_CUR INTO V_EMP_REC;
    EXIT WHEN O_RESULT_CUR%NOTFOUND;
    DBMS_OUTPUT.PUT_LINE(V_EMP_REC.EMP_ID);
    END LOOP;
    CLOSE O_RESULT_CUR;
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('ERROR '||SQLERRM);
    END;
    Now i'm getting an error PLS-00362: invalid cursor return type; 'TAB_EMP_REC' must be a record type.
    My question is i already declared it as a database object. What do i need to do ?
    thank you

    but t_emp(1) := TAB_EMP_REC(p_input, 'jai');
    is correct, since.. i'm passing a record into t_emp(1)(this is the first column in this table)No it is not, since TAB_EMP_REC is just an object, when used as a collection, it can be a VARRAY, a PL/SQL table(associative array), nested table etc. As mentioned in my earlier post, if you want to use a collection of the same structure (with subscript n, as you have done here), then you need to declare a collection of type TAB_EMP_REC.In this case you have already declared a table of type TAB_EMP_REC - +CREATE OR REPLACE TYPE T_EMP_TMP IS TABLE Also, t_emp is of type T_EMP_TMP - T_EMp T_EMP_TMP := T_EMP_TMP( );*
    As for the error you are getting, try changing to -
    t_emp := T_EMP_TMP(TAB_EMP_REC(p_input, 'jai'));*
    Note : Not Tested.

  • Question about Cursor in Reports

    Hello I new in this forum
    I need some help, i've started using Reports and I need to show in a Jsp report the result of a stored Procedure this procedure returns a cursor , so my question is How I can to show this selection (result of the cursor) in the report? ' cause when creating a Report with the wizard or manually the application asks for the selection

    inolau :
    Thanks for the link, it's was very useful.
    Well a have another question I need to display a report but pl/sql sends an error because the sql sentece is dynamic and do not allow to use a record
    example
    type v_record is record (deptos.no_folio%type,deptos.dependencia%type,empleado.name%type);
    type depto_ref is ref cursor return v_record
    create or replace function fnc_depto (idempl in varchar2) return depto_ref
    is
    v_cursor depto_ref;
    v_select varchar2(2000);
    begin
    v_select ='select deptos.no_folio,deptos.dependencia,empleado.name
    from deptos join empleado on (deptos.no_folio=empleados.no_folio)
    where empleados.idempleado in (' || idempl || ' ) ';
    open v_cursor for
    v_select;
    return v_cursor;
    end;
    when I create the function it's good but when you execute it returns an error that says
    PL/SQL: Statement ignored
    PLS-00455: el cursor 'V_CURSORDETALLE' cannot use it in a sentece OPEN of Dynamic SQL
    Do you know some solution for it?
    thanks for your time
    cheers!
    best regards

  • Question Regarding Cursor

    I need to create a Cursor where in the SELECT clause I am using Replace function. The replace value is coming from a variable.
    declare
    cursor csr is select replace(col1,'{DATE}',v_date) from tab1;
    begin
    v_date := fun_get_date();
    for c in csr
    loop
    end loop;
    end;
    can i use variables in select clause?

    Hmm..
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Elapsed: 00:00:01.02
    satyaki>
    satyaki>
    satyaki>select * from emp;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO JOB1      DOB
          7521 WARD       SALESMAN        7698 22-FEB-81       1815        500         30 SALESMAN
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1815       1400         30 SALESMAN
          7788 SCOTT      ANALYST         7566 19-APR-87     4791.6                    20 ANALYST
          7839 KING       PRESIDENT            17-NOV-81       7260                    10 PRESIDENT
          7844 TURNER     SALESMAN        7698 08-SEP-81       2178          0         30 SALESMAN
          7876 ADAMS      CLERK           7788 23-MAY-87     159.72                    20 CLERK
          7900 JAMES      CLERK           7698 03-DEC-81     1379.4                    30 CLERK
          7902 FORD       ANALYST         7566 03-DEC-81    5270.76                    20 ANALYST
          7934 MILLER     CLERK           7782 23-JAN-82     1887.6                    10 CLERK
          7566 Smith      Manager         7839 23-JAN-82       1848          0         10 Manager   23-JAN-89
          7698 Glen       Manager         7839 23-JAN-82       1848          0         10 Manager   23-JAN-89
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO JOB1      DOB
             1 boock
    12 rows selected.
    Elapsed: 00:00:00.01
    satyaki>
    satyaki>
    satyaki>declare
      2    cursor c1(var in varchar2)
      3    is
      4      select ename,replace(ename,'E',var) mod_ename
      5      from emp;
      6     
      7    r1 c1%rowtype;
      8   
      9    str varchar2(20);
    10  begin
    11   
    12    str:= '&supp';
    13   
    14    for r1 in c1(str)
    15    loop
    16      dbms_output.put_line('Original :'||r1.ename);
    17      dbms_output.put_line('Modified :'||r1.mod_ename);
    18    end loop;
    19  end;
    20  /
    Enter value for supp: T
    old  12:   str:= '&supp';
    new  12:   str:= 'T';
    Original :WARD
    Modified :WARD
    Original :MARTIN
    Modified :MARTIN
    Original :SCOTT
    Modified :SCOTT
    Original :KING
    Modified :KING
    Original :TURNER
    Modified :TURNTR
    Original :ADAMS
    Modified :ADAMS
    Original :JAMES
    Modified :JAMTS
    Original :FORD
    Modified :FORD
    Original :MILLER
    Modified :MILLTR
    Original :Smith
    Modified :Smith
    Original :Glen
    Modified :Glen
    Original :boock
    Modified :boock
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:01.03
    satyaki>Regards.
    Satyaki De.

  • Question on cursor %NOTFOUND attribute

    Here is my PL/SQL:
    OPEN c_original_demo FOR
    'SELECT pro_flags, spo_flags, proemp_flags, spoemp_flags
    FROM test.original_demo
    WHERE id_number = '<any id>' ;
    FETCH c_original_demo
    INTO     v_pro_flags, v_spo_flags, v_proemp_flags, v_spoemp_flags ;
    IF c_original_demo%NOTFOUND THEN
    v_pro_flags := '0000000000000000000000000' ;
    v_spo_flags := '0000000000000000000000000' ;
    v_proemp_flags := '00000000000000000000' ;
    v_spoemp_flags := '00000000000000000000' ;
    END IF ;
    When that code runs, it bombs on an ID that does not have a record in the original_demo table, so its trying to fetch no data into my variables. But isn't that what the %NOTFOUND logic is supposed to prevent? Am I using it wrong?
    Thanks for the help,
    ivalum21

    >
    Walter Fernández wrote
    Hi,
    Try this code:
    >
    just complement your code
    DECLARE
      Cursor c_original_demo(pi_id Number) is
        SELECT pro_flags, spo_flags, proemp_flags, spoemp_flags
          FROM test.original_demo
         WHERE id_number = pi_id;
    BEGIN
        OPEN c_original_demo( < any id > );
        LOOP
            FETCH c_original_demo
                INTO v_pro_flags, v_spo_flags, v_proemp_flags, v_spoemp_flags;
            IF c_original_demo%FOUND THEN
                -- fetch succeeded
                -- your code
            ELSE
                v_pro_flags    := '0000000000000000000000000';
                v_spo_flags    := '0000000000000000000000000';
                v_proemp_flags := '00000000000000000000';
                v_spoemp_flags := '00000000000000000000';
                EXIT;
            END IF;
        END LOOP;
        CLOSE c_original_demo;
    END;Regards :)
    Christian Balz

  • Question on cursor

    Hi,
    Can anyone help me out with this query, I am planning to run the below query for all invoice_ID from invoice_table.
    There are actualy three blocks and they need to be run for all invoice_ID
    I guess using cursor can be an option, or else pl suggest what needs to be done.
    Please help me with exact query as I am bad at pl/sql
    Block 1:
    SELECT SUM (invoiced_amt) into vFinalTotal from           
    (SELECT invoiced_amt invoiced_amt FROM imt_inv_item b WHERE b.imt_invoice_id = inv_id
    UNION ALL
    SELECT inv_amt invoiced_amt FROM imt_adj_inv_item c WHERE c.imt_invoice_id = inv_id );     
    Block 2:
    select ii.INV_AMT into vInvoiceTotal from IMT_INVOICE ii where ii.IMT_INVOICE_ID = inv_id ;
    Block 3:
    if vFinalTotal != vInvoiceTotal
    then
    IMTTRIG.ADDUPDINVITEM( inv_id );
    END

    Vin wrote:
    Hi,
    Can anyone help me out with this query, I am planning to run the below query for all invoice_ID from invoice_table.
    There are actualy three blocks and they need to be run for all invoice_ID
    I guess using cursor can be an option, or else pl suggest what needs to be done.
    Please help me with exact query as I am bad at pl/sql
    Block 1:
    SELECT SUM (invoiced_amt) into vFinalTotal from           
    (SELECT invoiced_amt invoiced_amt FROM imt_inv_item b WHERE b.imt_invoice_id = inv_id
    UNION ALL
    SELECT inv_amt invoiced_amt FROM imt_adj_inv_item c WHERE c.imt_invoice_id = inv_id );     
    Block 2:
    select ii.INV_AMT into vInvoiceTotal from IMT_INVOICE ii where ii.IMT_INVOICE_ID = inv_id ;
    Block 3:
    if vFinalTotal != vInvoiceTotal
    then
    IMTTRIG.ADDUPDINVITEM( inv_id );
    ENDYou have to make relationship between all related blocks by using imt_invoice_id for all blocks that have ths column :)

  • Cursor will not stay in address bar even once I've started typing

    When I initially start FF I am able to click into the address bar and type a URL without problem. A few minutes later if I open a new tab or try and click into the url bar, the cursor jumps to any available text box on the page and refuses to stay in the url bar. Sometimes I manage to write the first letter in the bar then the cursor immediately jumps, and continues to happen each time I click back into the bar, so I can never type anything in it. The problem is solved if I restart FF but then starts again at soon after. I've tried disabling all my add-ons/extensions but this hasn't worked. I'm using FF 12 on a MacBook Pro. Any help appreciated, thanks.

    ''Any'' new tab (e.g., Ctrl+clicking a link), or a new tab containing your ''new tab page'' (e.g., Ctrtl+t)?
    There have been many threads about where the cursor should be after opening a new tab to the new tab page. Many users complained that after Firefox 17, instead of the cursor moving to the Google search box, it stayed in the address bar (e.g., [https://support.mozilla.org/en-US/questions/945511 Cursor focus is changed to address bar instead of google search box on new tabs in FF 17]). Recently a user complained about the opposite starting in Firefox 23 ([https://support.mozilla.org/en-US/questions/969927 Firefox update 23.0.1, no longer automatically highlights the address bar content when I open a new tab]).
    One complication is that "new tab" add-ons often have a feature to change Firefox's normal behavior and it's easy to forget about them and sometimes difficult to understand the description. In NewTabURL, look at the last checkbox in its options dialog.
    I could go on, but if you could clarify the scenario a bit more, I think that would be more efficient.

  • 100 %CPU utilizationis , cache buffers chains and cursor: pin S

    Hi every one ,
    we have incident causing system response very slow with very bad response time, below top 5 wait events from AWR (RAC database)
    Event Waits Time(s) Avg Wait(ms) % Total Call Time Wait Class
    latch: cache buffers chains 122,492 198,139 1,618 16.8 Concurrency
    gc buffer busy 119,903 83,248 694 7.1 Cluster
    cursor: pin S 18,674,280 72,651 4 6.2 Other
    log file sync 639,867 66,673 104 5.7
    Commit latch free 143,519 54,239 378 4.6 Other
    Oracle support clearly identified the issue with latch cache buffer chains as SQL statement executed around 35000 times which is too high based on execution plan . and they suggest to tune SQL statements .
    my question is cursor: pin S wait on X and library cache lock related ot it is just a symptoms , and is document 742599.1 applicable to us or not as we have 10.2.0.5 (suggest disable automatic memory management)
    As I know high CPU utilization as result of latch: cache buffers chains , the cursor Pin S Wait should not .
    Thank you in advance

    Hi,
    All these 4 top events (excluding log file sync) are quite unusual and in your case, if all these are comming atop, these quite well be related. So, you can't say that cursor pin s wait on x should not be dealt saperatly, but, still you can try out suggestion in the note. First find out from v$sgasta about current allocation of shared pool, then after disabling automatic memory management, increase shared_pool significantly as compared to current value, and then monito the system
    Definitely you should tune your SQL also, as suggested by support.
    Salman

  • Possible deadlock: transactions, cursors, and sequences...

    Hello,
    After making recent changes to our database in response to a previous issue (bug found and patched in BDB; local code fixed by removing both DB_TXN_SNAPSHOT and DB_MULTIVERSION) we've come across a possible deadlock.
    BACKGROUND:
    This database has been running for over a year in production and I've never seen a hard deadlock. We use the default deadlock detection engine internal to BDB, transactions, and our code supports the processing of deadlocks and subsequent retries and final abandonment when necessary. The transactions in question involve cursors and sequences; we're using cursors to flip through entries in an existing database, and should no match be found for an update, we insert a new record. Before doing so, we grab the "next ID" (primary key) from a sequence we have (attached, as all sequences are, to its own different DB, done on advice from online docs: "For this reason, it is often preferable for sequence objects to be stored in their own database.") and finally insert the new record.
    This is a 64-bit Linux machine. There were 4 operational threads at the time; all were waiting on pthread conditions. As I understand it, deadlocks should have been internally detected and returning DB_LOCK_DEADLOCK to us somewhere? Since we're using the default lock detection engine and firing it constantly, we should not require an Nth thread to monitor the lock tables and manually reject deadlocked transactions, etc?
    I wasn't sure what to do when the deadlock occured, but I found some forum posts referencing a db_stat -Co and ran it, along with grabbing a core dump which I still have available. I've reverted the DB binary to older DB_MULTIVERSION code as I work on figuring this out, but if there's something else crucial I should have done, I can run the new code again and wait for another deadlock to happen to run additional diagnostics.
    Any ideas or assistance is appreciated. Thank you.
    DEADLOCK INFORMATION:
    THREAD 2: Attempting to 'get' an asset.
    (gdb) bt
    #0 0x00002aec07e27496 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
    #1 0x00002aec078ddeed in __db_pthread_mutex_lock () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #2 0x00002aec078dda8b in __db_tas_mutex_lock () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #3 0x00002aec0795b8f1 in __lock_get_internal () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #4 0x00002aec0795bc42 in __lock_get () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #5 0x00002aec07987d94 in __db_lget () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #6 0x00002aec07914625 in __ham_get_meta () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #7 0x00002aec07908d4b in __hamc_get () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #8 0x00002aec07979e8a in __dbc_get () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #9 0x00002aec0797aa0d in __dbc_pget () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #10 0x00002aec0798654b in __dbc_pget_pp () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #11 0x00002aec078d4dd7 in Dbc::get () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    THREAD 5: Attempting to 'set' an asset.
    (gdb) bt
    #0 0x00002aec07e27496 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
    #1 0x00002aec078ddeed in __db_pthread_mutex_lock () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #2 0x00002aec078dda8b in __db_tas_mutex_lock () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #3 0x00002aec079d0c45 in __seq_get () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #4 0x00002aec078dd02e in DbSequence::get () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    THREAD 6: Attempting to 'set' an asset.
    (gdb) bt
    #0 0x00002aec07e27496 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
    #1 0x00002aec078ddeed in __db_pthread_mutex_lock () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #2 0x00002aec078dda8b in __db_tas_mutex_lock () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #3 0x00002aec0795b8f1 in __lock_get_internal () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #4 0x00002aec0795bc42 in __lock_get () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #5 0x00002aec07987d94 in __db_lget () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #6 0x00002aec079893ee in __db_new () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #7 0x00002aec0798bb7e in __db_poff () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #8 0x00002aec07918eb3 in __ham_add_el () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #9 0x00002aec07907fe1 in __hamc_put () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #10 0x00002aec0797b6e5 in __dbc_put () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #11 0x00002aec0796ecde in __db_put () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #12 0x00002aec07985e6c in __db_put_pp () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #13 0x00002aec078d395c in Db::put () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    THREAD 7: Attempting to 'set' an asset.
    (gdb) bt
    #0 0x00002aec07e27496 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
    #1 0x00002aec078ddeed in __db_pthread_mutex_lock () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #2 0x00002aec078dda8b in __db_tas_mutex_lock () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #3 0x00002aec0795b8f1 in __lock_get_internal () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #4 0x00002aec0795bc42 in __lock_get () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #5 0x00002aec07987d94 in __db_lget () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #6 0x00002aec07915b6a in __ham_lock_bucket () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #7 0x00002aec07915dc7 in __ham_get_cpage () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #8 0x00002aec079075f9 in __ham_lookup () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #9 0x00002aec07908f9f in __hamc_get () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #10 0x00002aec07979e8a in __dbc_get () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #11 0x00002aec07984045 in __db_get () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #12 0x00002aec079d0374 in __seq_update () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #13 0x00002aec079d0c29 in __seq_get () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    #14 0x00002aec078dd02e in DbSequence::get () from /usr/local/BerkeleyDB.4.7/lib/libdb_cxx-4.7.so
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    Lock REGINFO information:
    Lock Region type
    5 Region ID
    env/__db.005 Region name
    0x2b8dbff65000 Original region address
    0x2b8dbff65000 Region address
    0x2b8dbff65138 Region primary address
    0 Region maximum allocation
    0 Region allocated
    Region allocations: 225009 allocations, 0 failures, 0 frees, 1 longest
    REGION_JOIN_OK Region flags
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    Locks grouped by object:
    Locker Mode Count Status ----------------- Object ---------------
    808cfad0 READ 1 HELD db1 page 0
    808cfad3 READ 2 HELD db1 page 0
    808cfad5 READ 1 HELD db1 page 0
    33 READ 1 HELD db1 handle 0
    22 READ 1 HELD db2 handle 0
    18 READ 1 HELD db3 handle 0
    808cfad5 READ 1 HELD db1 page 3906
    808cfad3 READ 1 HELD db1 page 6300
    808cfad3 WRITE 1 HELD db1 page 6300
    808cfad0 READ 1 HELD db1 page 8272
    808cfabe WRITE 2 HELD db4 page 82387
    808cfad3 WRITE 1 HELD db4 page 42879
    808cfad3 WRITE 1 HELD db4 page 42878
    808cfad3 WRITE 1 HELD db4 page 42877
    808cfad3 WRITE 1 HELD db4 page 42874
    808cfad3 WRITE 1 HELD db4 page 42873
    808cfad3 WRITE 1 HELD db4 page 42872
    808cfad3 WRITE 1 HELD db4 page 42901
    808cfad3 WRITE 1 HELD db4 page 42897
    808cfad3 WRITE 1 HELD db4 page 42882
    808cfad3 WRITE 1 HELD db4 page 42881
    808cfad3 WRITE 1 HELD db4 page 42880
    808cfad3 WRITE 1 HELD db4 page 42894
    808cfad3 WRITE 1 HELD db4 page 43797
    1a READ 1 HELD db3sequence handle 0
    1c READ 1 HELD db5 handle 0
    20 READ 1 HELD db6 handle 0
    24 READ 1 HELD db7 handle 0
    808cfad3 READ 13 HELD db4 page 0
    808cfabe READ 2 HELD db4 page 0
    808cfabe WRITE 1 WAIT db4 page 0
    808cfad5 READ 1 WAIT db4 page 0
    26 READ 1 HELD db4 handle 0
    808cfabe READ 2 HELD db4sequence page 0
    808cfad0 READ 1 HELD db4sequence page 0
    28 READ 1 HELD db4sequence handle 0
    808cfabe READ 3 HELD db8 page 0
    2a READ 1 HELD db8 handle 0
    808cfabe READ 4 HELD db9 page 0
    808cfad0 READ 1 HELD db9 page 0
    808cfad3 READ 14 HELD db9 page 0
    808cfad5 READ 1 HELD db9 page 0
    808cfabe READ 1 HELD db4sequence page 2
    808cfabe WRITE 1 HELD db4sequence page 2
    808cfad0 READ 1 WAIT db4sequence page 2
    2e READ 1 HELD db9 handle 0
    808cfabe WRITE 2 HELD db9 page 1
    808cfad3 READ 2 HELD db1sequence page 0
    35 READ 1 HELD db1sequence handle 0
    808cfad3 READ 1 HELD db1sequence page 2
    808cfad3 WRITE 1 HELD db1sequence page 2
    808cfad5 READ 1 HELD db9 page 2833
    808cfad0 WRITE 1 HELD db9 page 7946
    808cfad3 WRITE 14 HELD db9 page 8250
    808cfabe WRITE 3 HELD db8 page 13301

    What else could be causing this in terms of the application having a resource locked? I can say that there are no other running threads doing anything related to BDB at all - they are all in similar "no work, sleep until we get some" calls, with the exception being the main thread which is sitting in sigwait(). What types of things could the application be doing that would prevent all 4 BDB threads from being able to obtain mutexes that are internal to them and not accessible to the application?
    Other thoughts:
    * On a fifth thread, from time to time, txn_checkpoint() is called. Could this have been left in an unclean state?
    * If DB_RMW is used incorrectly, could lock order be compromised? We are not using CDS, so do we need to specify DB_WRITECURSOR to our db->cursor() calls? We do not; we only provide DB_RMW to pget() calls at present.
    * Why is the thread attempting to call sequence->get also deadlocked? The sequence is in its own database - is it waiting on a more global "locker manager" mutex at a high level?
    As I don't see how anything we do can directly control BDB's locking strategies, my only thought is that we're making a programming error to force BDB to lock things in an incorrect order in a way that prevents deadlock detection from occuring. Is this possible? Mainly the only thing changing here was our replacing DB_TXN_SNAPSHOT with the appropriate DB_RMW flags when needed, which is why I'm thinking we did something wrong here, but I'm not sure what.
    I'll continue investigation, but any ideas you have in terms of appropriate directions would be helpful. I'll also work on reproducing this if I can by working backwards from the stack information. Thanks.
    Later thought: Why is 808cfad3 not waiting on anything even though stack clearly shows it (thread 5, I'm guessing) in pthread_cond_wait? Can a transaction enter a wait state without showing up in db_stat output?
    Thanks!
    Edited by: user10542315 on Sep 11, 2009 1:21 PM
    Edited by: user10542315 on Sep 11, 2009 2:52 PM

  • Cursor help and Max and min help

    hello I have a couple of simple questions on cursors.  I am gathering data from an oscilloscope to determine amplitude.  I would like to set a cursor for a reference point.  however, when I set the cursor to the specific number BEFORE the sweep takes place, the cursor gets erased and I have to reset it after.  Also, my x-axis goes from 0-240.  is their anyway to get a high precision?  When I input (154) for the position, it rounds up to 160 and its essential for me to keep as much precision as possible.  I attaching some pictures. 
    Another problem I am having is I want to gather the position where the max point is.  I need this position to subtract it from a reference point so I can determine how far I am from the desired reference point.  I am currently using the express VI statistics. 
    Attachments:
    Max and Min.JPG ‏162 KB
    Cursor Help.JPG ‏82 KB

    At the risk of sounding like a grumpy old man.
    Post you code please-  You have a lot of issues with your coding style and it might take a bit of work to help you out.  I'm not sure from your pictures where your question is pointing.
    Also please post .png files they are prefered on this forum.  And what LabVIEW version are you using?
    Jeff

  • My cursor keeps jumping while I am typing.

    Even while I am typing this question my cursor is jumping back to the middle of my sentance without touching the arrow keys or trackpad. Everything I have read says that this was a problem 2 years ago. I have the new macbook pro with retina. Any help?

    Since your Mac is "new".....
    You are still under warranty.  Call Apple Care. Make sure you get a case number as all repairs have an additional 90 days of warranty. 
    #1 - You have 14 days from the date of purchase to return your computer with no questions asked.
    #2 - You have 90 days of FREE phone tech support.
    #3 - You have the standard one year Apple warranty.
    #4 - If you've purchased an AppleCare Protection Plan, your warranty last for 3 years.   You can obtain AppleCare anytime up to the first year of the purchase of your computer.
    Take FULL advantage of your warranty.  Posting on a message board should be done as a last resort and if you are out of warranty or Apple Care has expired.

  • Unwanted links appearing in PDF document

    This is a continuation of a question I posted on the Indesign forum http://forums.adobe.com/message/4266495#4266495
    I have a document that was created in InDesign 3 and I am currently using InDesign CS5.5. When the document is printed to Adobe PDF I end up with random text that shows as a link. For instance if I hover my cursor over a table in question, the cursor changes to a hand and a box pops up displaying all of the information on the page as a web address. How do I correct this?
    I have attempted to remove all hidden data in Adobe Acrobat Pro but this renders the document unsearchable. When I then run OCR the mysteries links reappear.
    here is a screen capture of the issue

    I am not sure that I am following your advice. The problem is i receive random links which appear on certain pages. the example above happens when I hover anywhere in the table. This particular page does have legitimate web links but when selected they also display incorrect info. I have attempted the following actions with no success: "Remove Hidden Data", "Sanitize Document", "Remove All Links" and various actions using the action wizard (publish sensitive document, create accessible PDF's).
    If I add a link like you suggest then yes the link does work correctly but I have to wipe the entire document which in turn leaves the document un searchable. 

  • PL/SQL Prob in Report

    Hi,
    I have a question re: Cursors. Can you reference the previous and next cursor record in FOR loops?
    I have two data, value (either 1 or 0) & time the value was recorded. I need to determine x = sum(length of time the value was 1). Ex.
    v1 = 1; t1 = 1
    v2 = 1; t2 = 2.2
    v3 = 0; t3 = 2.7
    v4 = 1; t4 = 3
    v5 = 1; t5 = 3.5
    x = (t2 - t1) + (t5 - t4)
    I was thinking of using a cursor to select the values and time and then using a LOOP
    FOR curr_rec IN cursor1 LOOP
    IF (curr_rec.value = 1 and prev_rec.value <> 1) THEN
    v_start_time := curr_rec.time;
    ELSE
    v_start_time := v_start_time;
    IF (curr_rec.value = 1 and next_rec.value <> 1) THEN
    v_end_time := curr_rec.time;
    v_diff_time := v_end_time - v_start_time;
    v_total_time := v_total_time + v_diff_time;
    END LOOP;
    I need to know how do i declare prev_rec and next_rec.
    Is there a better way to get the desired results?
    Thanks !
    null

    E,
    Define cursor and populate all the records in to PL/SQL table and in PL/SQL table you can refer next and previous records - PL/SQL table is noting but array in C
    Good luck

Maybe you are looking for

  • Lack of performanc​e

    Hi All I have a A55 9265 bz7 with XP pro sp3, which often pops up a low performance message  .I'm aware of this, as I only have 1 gig , with no more dimm slots left. Does anyone have a miracle solution or am I out of luck? Appreciate any comment, SPI

  • Ipod touch 4g backup work on new ipod touch 5g?

    is it possible that once my new ipod touch 5g arrives i will be able to transfer the backup from the 4g..like the apps and save games and restore it to the new ipod touch 5g?

  • To retrieve the mapping expression of a particular column of an Interface

    How to retrieve the mapping expression corresponding to a particular column(say BATCH_ID) in the target table of the interface in IKM...? Using getColList() method all the mappings in the interface are retrieved. Is there a way to get the mapping for

  • Open 0Query_Template in WAD get red error

    Some documentation says we can't open 0Query_Template (with Notepad or some web development too), but we don't know how to locate this 0Query_Template file in Notepad or other web development tool.  Then the only choice left would be to open this 0Qu

  • Outlook 2011 on OS Mavericks question

    Dear Sir, I was using Outlook on my MaC book Air for business after i left the company i copied the folder Microsoft User Data to an external Hard Disk. Now after a year i start using the same mac for business and i got new email and everything worki