No cursor on client

guess that wasn't a search field anymore, eh?
Okay, guess I'll just ask before I search.
When taking control of a client, 90% of the time I have no cursor in the client window.  If I minimize the window and then pull it back up, it is fine.  Inputs are going out to the client either way, it's a refresh thing I think.  Thoughts?  Getting tedious to minimize and bring back every time I want to control something.
ARD 3.4
Client (whatever is latest)
OS 10.5.8
now I'll back and try to search

Cursors hold resources locked when used in a transactional environment. You need
to think of the replication application piece as a writer thread on the client. So, just like
you can have collisions with read cursors and write operations on the master, you
can have the same on clients.
Since cursors hold resources locked, like transactions, you need to hold cursors open
as short a time as possible to reduce the likelihood that an incoming update will
need access to some page that the cursor is holding with a read lock.
So, in your experiment 1, when you close the cursor, it allows the incoming flow of
update operations to get applied on the client. In experiment 2, the incoming flow
is stuck waiting to acquire a lock that the cursor is holding. This is not necessarily a deadlock
since the cursor may just be existing and not waiting for a lock the update path holds.
Basically it is good practice to minimize the lifetimes of objects which hold resources
locked such as cursors and transactions.
Sue LoVerso
Oracle

Similar Messages

  • Set cursor to client in DW8

    In DWMX when a recordset is selected at the bottom under
    properties there is
    an option to select if the cursor is set to 'server' or
    'client'.
    In DW8 there are no options for the recordset ? Where did
    they go ? Where
    can I set the cursor to 'client' for a recordset in DW8 ?
    Why would this options be removed ?
    A

    Hi Rohit,
    Please check with following code.
    LO_NODE   = WD_CONTEXT->GET_CHILD_NODE( 'DIAGNOSE' ).
    lv_index = lo_node->GET_LEAD_SELECTION_INDEX( ) .
    lv_index = lv_index + 1.
    LO_NODE->SET_LEAD_SELECTION(  lv_index ).
       LO_ELEMENT = LO_NODE->GET_ELEMENT( ).
       LO_RUNTIMEAPI = WD_THIS->WD_GET_API( ).   LO_RUNTIMEAPI->REQUEST_FOCUS( ATTRIBUTE = 'ICDDESC' CONTEXT_ELEMENT =LO_ELEMENT ).
    Thank You,
    Harsha

  • Trouble with Bulk Collect to Ref cursor

    I'm trying to open a ref cursor to a dynamic query, and the fetch the cursor (BULK COLLECT)to the table type variable.But I keep getting the compilation error as 'PLS-00597: expression 'EMP_RESULTSET' in the INTO list is of wrong type'
    But when I use a simple select from a table and Bulk Collect directly to the table type variable it works. But that is not what I want.
    Can someone tell me where I have gone wrong in this stored proc I have listed below.
    your help will be highly appreciated.
    PROCEDURE SP_TEST_EMP_TABLE_TYPE (
          p_resultset OUT result_cursor          -- ref cursor as out parameter
       AS
        TYPE TYPE_REC_EMP is RECORD(EMPNO EMPLOYEE.EMPNO%TYPE, JOIN_DATE EMPLOYEE.JOIN_DATE%TYPE, SALARY EMPLOYEE.SALARY%TYPE); -- declare record type
        TYPE TYPE_TAB_EMP IS TABLE OF TYPE_REC_EMP;    -- declare table type
        EMP_RESULTSET TYPE_TAB_EMP; -- declare variable of type type_calendar_avail_resultset  
        SQUERY VARCHAR2(32000):='';
       BEGIN
        SQUERY:='SELECT EMPNO,JOIN_DATE,SALARY FROM EMPLOYEE WHERE EMPNO= 1001 AND JOIN_DATE=''20070530'' ';
        --select EMPNO,JOIN_DATE,SALARY BULK COLLECT INTO EMP_RESULTSET from  EMPLOYEE WHERE EMPNO=1001 AND JOIN_DATE='20070525';
        OPEN p_resultset FOR SQUERY;
          FETCH p_resultset BULK COLLECT INTO EMP_RESULTSET;
      EXCEPTION
          WHEN NO_DATA_FOUND
          THEN
             NULL;
          WHEN OTHERS
          THEN
             DBMS_OUTPUT.put_line (SQLERRM (SQLCODE));   
       END SP_TEST_EMP_TABLE_TYPE ;

    > i) I use a ref cursor to return back to the java
    front end, so I had to use a ref cursor.
    What is a ref cursor? It is not a data set. It is a pointer to a "SQL program". This program is created by the SQL Engine and the CBO that parses the SQL source code and determine an execution plan to get to the requested rows.
    When the client fetches from a (ref) cursor, the client is running this program and it find and returns the next row.
    There is no such thing as a physical result set for a cursor - no "copy" of the rows found for the source code SQL is made as a result set.
    > ii) I also use a dynamic sql, but I was thinking it
    wasn't useful for this posting, so tried to write a
    simple sql
    What is dynamic SQL? SQL where object names (e.g name of the table) is only known at run-time. Or where the filter (e.g. WHERE conditions) can only be determined at run time.
    If these are known, the SQL is static SQL.
    For both static and dynamic SQL, bind variables are critical. It is the biggest performance mistake (in Oracle) to hardcode values and literals into a SQL.
    > ii) I use a Bulk Collect to the table type
    collection, since I use a loop, for which I had to
    collect the results from each loop and finally send
    the resultset thru the ref cursor.
    Impossible. Nor does it make any sense. As stated, a ref cursor is a program and not a result set.
    What you intend to do is run a SQL against data. Copy this data into private/local PL/SQL memory. Construct another SQL against this data - which means that it needs to be shipped back to the SQL engine as it cannot use/read local PL/SQL memory structures. And the pass that SQL cursor to the client.
    What for?
    > I had earlier used the logic to for this using a
    temporary table, which works perfectly fine, but our
    DBA says we should avoid temporary tables since it
    makes additional read/write to the disk. This is the
    reason I'm using table type collection here.
    Your DBA is correct. One should so a single pass through a data set. Which is why simply passing a ref cursor for a SQL statement to the client is the simplest.
    It makes no sense copying SQL data into a collection and then copying that back into the SQL engine in order to throw a ref cursor around it.
    Basic client-server fundamentals.
    And why RTFM the Oracle manuals I've indicated is important. You need to understand the memory and processing architectures in Oracle in order to make an informed and correct decision.

  • Can I create a dynamic cursor in a program unit on oracle form....

    Hello folks,
    can I create a dynamic cursor on client side ( in a program unit on the oracle form), is it possible, I Know how to create it on server side using Ref cursor, but on client side i got this message (can't be created on client side or something like that).... please if someone can help

    > select count(*) from t_comsis
    <p>But when you put that select string into a varchar2 variable, it won't compile. Which makes it hard to create anything "dynamic".
    <p>In Forms, you can create and populate a record group dynamically, which is ok as long as your select will not retrieve too many (more than several hundred) rows.
    <p>Or, your other option is to use the Forms Exec_SQL dynamic sql package.

  • How to create a function with dynamic sql or any better way to achieve this?

            Hello,
            I have created below SQL query which works fine however when scalar function created ,it
            throws an error "Only functions and extended stored procedures can be executed from within a
            function.". In below code First cursor reads all client database names and second cursor
            reads client locations.
                      DECLARE @clientLocation nvarchar(100),@locationClientPath nvarchar(Max);
                      DECLARE @ItemID int;
                      SET @locationClientPath = char(0);
                      SET @ItemID = 67480;
       --building dynamic sql to replace database name at runtime
             DECLARE @strSQL nvarchar(Max);
             DECLARE @DatabaseName nvarchar(100);
             DECLARE @localClientPath nvarchar(MAX) ;
                      Declare databaselist_cursor Cursor for select [DBName] from [DataBase].[dbo].
                      [tblOrganization] 
                      OPEN databaselist_cursor
                      FETCH NEXT FROM databaselist_cursor INTO @DatabaseName
                      WHILE @@FETCH_STATUS = 0
                      BEGIN       
       PRINT 'Processing DATABASE: ' + @DatabaseName;
        SET @strSQL = 'DECLARE organizationlist_cursor CURSOR
        FOR SELECT '+ @DatabaseName +'.[dbo].[usGetLocationPathByRID]
                                   ([LocationRID]) 
        FROM '+ @DatabaseName +'.[dbo].[tblItemLocationDetailOrg] where
                                   ItemId = '+ cast(@ItemID as nvarchar(20))  ;
         EXEC sp_executesql @strSQL;
        -- Open the cursor
        OPEN organizationlist_cursor
        SET @localClientPath = '';
        -- go through each Location path and return the 
         FETCH NEXT FROM organizationlist_cursor into @clientLocation
         WHILE @@FETCH_STATUS = 0
          BEGIN
           SELECT @localClientPath =  @clientLocation; 
           SELECT @locationClientPath =
    @locationClientPath + @clientLocation + ','
           FETCH NEXT FROM organizationlist_cursor INTO
    @clientLocation
          END
           PRINT 'current databse client location'+  @localClientPath;
         -- Close the Cursor
         CLOSE organizationlist_cursor;
         DEALLOCATE organizationlist_cursor;
         FETCH NEXT FROM databaselist_cursor INTO @DatabaseName
                    END
                    CLOSE databaselist_cursor;
                    DEALLOCATE databaselist_cursor;
                    -- Trim the last comma from the string
                   SELECT @locationClientPath = SUBSTRING(@locationClientPath,1,LEN(@locationClientPath)-  1);
                     PRINT @locationClientPath;
            I would like to create above query in function so that return value would be used in 
            another query select statement and I am using SQL 2005.
            I would like to know if there is a way to make this work as a function or any better way
            to  achieve this?
            Thanks,

    This very simple: We cannot use dynamic SQL from used-defined functions written in T-SQL. This is because you are not permitted do anything in a UDF that could change the database state (as the UDF may be invoked as part of a query). Since you can
    do anything from dynamic SQL, including updates, it is obvious why dynamic SQL is not permitted as per the microsoft..
    In SQL 2005 and later, we could implement your function as a CLR function. Recall that all data access from the CLR is dynamic SQL. (here you are safe-guarded, so that if you perform an update operation from your function, you will get caught.) A word of warning
    though: data access from scalar UDFs can often give performance problems and its not recommended too..
    Raju Rasagounder Sr MSSQL DBA
          Hi Raju,
           Can you help me writing CLR for my above function? I am newbie to SQL CLR programming.
           Thanks in advance!
           Satya
              

  • OutOfMemory error when trying to display large tables

    We use JDeveloper 10.1.3. Our project uses ADF Faces + EJB3 Session Facade + TopLink.
    We have a large table (over 100K rows) which we try to show to the user via an ADF Read-only Table. We build the page by dragging the facade findAllXXX method's result onto the page and choosing "ADF Read-only Table".
    The problem is that during execution we get an OutOfMemory error. The Facade method attempts to extract the whole result set and to transfer it to a List. But the result set is simply too large. There's not enough memory.
    Initially, I was under the impression that the table iterator would be running queries that automatically fetch just a chunk of the db table data at a time. Sadly, this is not the case. Apparently, all the data gets fetched. And then the iterator simply iterates through a List in memory. This is not what we needed.
    So, I'd like to ask: is there a way for us to show a very large database table inside an ADF Table? And when the user clicks on "Next", to have the iterator automatically execute queries against the database and fetch the next chunk of data, if necessary?
    If that is not possible with ADF components, it looks like we'll have to either write our own component or simply use the old code that we have which supports paging for huge tables by simply running new queries whenever necessary. Alternatively, each time the user clicks on "Next" or "Previous", we might have to intercept the event and manually send range information to a facade method which would then fetch the appropriate data from the database. I don't know how easy or difficult that would be to implement.
    Naturally, I'd prefer to have that functionality available in ADF Faces. I hope there's a way to do this. But I'm still a novice and I would appreciate any advice.

    Hi Shay,
    We do use search pages and we do give the users the opportunity to specify search criteria.
    The trouble comes when the search criteria are not specific enough and the result set is huge. Transferring the whole result set into memory will be disastrous, especially for servers used by hundreds of users simultaneously. So, we'll have to limit the number of rows fetched at a time. We should do this either by setting the Maximum Rows option for the TopLink query (or using rownum<=XXX inside the SQL), or through using a data provider that supports paging.
    I don't like the first approach very much because I don't have a good recipe for calculating the optimum number of Maximum Rows for each query. By specifying some average number of, say, 500 rows, I risk fetching too many rows at once and I also risk filling the TopLink cache with objects that are not necessary. I can use methods like query.dontMaintainCache() but in my case this is a workaround, not a solution.
    I would prefer fetching relatively small chunks of data at a time and not limiting the user to a certain number of maximum rows. Furthermore, this way I won't fetch large amounts of data at the very beginning and I won't be forced to turn off the caching for the query.
    Regarding the "ADF Developer's Guide", I read there that "To create a table using a data control, you must bind to a method on the data control that returns a collection. JDeveloper allows you to do this declaratively by dragging and dropping a collection from the Data Control Palette."
    So, it looks like I'll have to implement a collection which, in turn, implements the paging functionality that I need. Is the TopLink object you are referring to some type of collection? I know that I can specify a collection class that TopLink should use for queries through the query.useCollectionClass(...) method. But if TopLink doesn't provide the collection I need, I will have to write that collection myself. I still haven't found the section in the TopLink documentation that says what types of Collections are natively provided by TopLink. I can see other collections like oracle.toplink.indirection.IndirectList, for example. But I have not found a specific discussion on large result sets with the exception of Streams and Cursors and I feel uneasy about maintaining cursors between client requests.
    And I completely agree with you about reading the docs first and doing the programming afterwards. Whenever time permits, I always do that. I have already read the "ADF Developer's Guide" with the exception of chapters 20 and 21. And I switched to the "TopLink Developer's Guide" because it seems that we must focus on the model. Unfortunately, because of the circumstances, I've spent a lot of time reading and not enough time practicing what I read. So, my knowledge is kind of shaky at the moment and perhaps I'm not seeing things that are obvious to you. That's why I tried using this forum -- to ask the experts for advice on the best method for implementing paging. And I'm thankful to everyone who replied to my post so far.

  • Php page won't display the first record

    I have the following code, but it always skip the first row of the records pull from an Oracle table:
    include "utility_functions.php";
    // Form the query and execute it
    $sql = "select * from dept where cid=".$_GET['q'];
    $result_array = execute_sql_in_oracle ($sql);
    $result = $result_array["flag"];
    $cursor = $result_array["cursor"];
    if ($result == false){
      display_oracle_error_message($cursor);
      die("Client Query Failed.");
    // Display the query results
    echo "<ul class=\"nav\">";
    $values = oci_fetch_array ($cursor);
    //echo $values[0];
    // Fetch the result from the cursor one by one
    while ($values = oci_fetch_array($cursor)){
      $did = $values[0];
      $dname = $values[1];
      echo("<li><a href=\"showdetail.php?did=$did\">$dname</a></li> ");
    oci_free_statement($cursor);
    echo "</ul>";
    for example, I have the following in dept table:
    did    dname
    1     Business
    2     Education
    3     Math
    4     English
    It will only list: education, math, and english.  Any clues?

    What does execute_sql_in_oracle() do?
    Try following example code, such as from:
            http://www.php.net/manual/en/oci8.examples.php
            http://www.php.net/manual/en/function.oci-fetch-array.php
            http://www.php.net/manual/en/function.oci-bind-by-name.php
    It's extremely insecure (and slow) to do a query made up with string concatenation like:
      $sql = "select * from dept where cid=".$_GET['q'];
    You probably need to first sanitize $_GET to remove anything malicious.  Then you must use a bind variable on the sanitized result.

  • Calling Stored Procedure with TestStand to SQL 2000

    When I run the Stored Procedure in the query analyzer it returns the recordset fine. I am not specifying any parameters. I am Using TestStand 2.01 and SQL Server 2000. I am using the OPEN SQL STATEMENT step to call the SP. When I run the SP in TestStand I get no data returned. If I run the SQL statment in TestStand I get the data that I am requesting. Does TestStand not support stored procedures.

    Hi,
    The instructions that I posted were for TestStand 3.0. In version 3.0 you can call stored procedures with input/output paramateres and to support this functionality the data operation step support several new modes.
    TestStand 2.0.1 does not support parameters on stored procedures, but it does support calling stored procedures that do not take parameters. To be able to access the data back from the database you need to set the cursor location (in the Advanced tab of the Open SQL Statement step) to Client (http://digital.ni.com/public.nsf/websearch/0EF68BF97AB1A61F86256B8E007D70C0?OpenDocument).
    By changing the cursor to Client I was able to succesfully call a stored procedure from TestStand 2.0.1 and to read back the recordse
    t return by the database. Please let me know if you are still experiencing dificulties.
    Best regards,
    Alejandro del Castillo
    National Instruments

  • Old Theme:  Pagination with Ordenation

    Hi
    I need return a cursor for Client (java)
    I already read meny posts about article, I got to make pagination using this articles
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:76812348057
    http://www.oracle.com/technology/oramag/oracle/07-jan/o17asktom.html
    Implementing  Resultset   with  Pagination in a Web Application
    But my Problem is thar the user can to choice 3 columns diferents for to order and Asc ou Desc
    The Problem is thar the query is very large.
    Example The user Choice column 1 ASC or Column2 DESC or COLUMN8 Desc
    In other topic, tell me put as:
       ORDER BY decode(P_order,0, decode(P_coluna,1,LAST_NAME,2,CODE_NAME,3,VALUE)) ASC,
    decode(P_order,1,decode(P_coluna,1,LAST_NAME,2,CODE_NAME,3,VALUE))  DESCBut did not work, work only when P_coluna =1 , for other number return me error
    Put Query in Dynamic Query is Impossible is very great
    Some have some idea?

    I'm not sure why you think the size of the query
    makes it more difficult to use dynamic SQL. From
    your description of the problem, the only dynamic
    piece is the ORDER BY clause. Everything other than
    the ORDER BY clause is static.
    Turning this into dynamic may take some effort, but
    is far from impossible.Thank
    Look length of my query ?
        OPEN P_CURSOR FOR
        WITH NOTIFICACAO AS(
          SELECT 
           t1.cd_consultora,
           t1.dc_nome_consultora,
           t2.nm_notificacao_cn,
           t2.dt_notificacao_cn dt_notificacao,
           t2.dt_atendimento_notificado,
           t1.cd_tipo_estrutura_comercial,
           t1.cd_estrutura_comercial
            FROM t_consultora t1, nc.t_nc_notificacao_cn t2
           WHERE t2.dt_notificacao_cn BETWEEN w_DTA_INI AND w_DTA_FIM
             AND t2.cd_consultora = t1.cd_consultora
             AND t1.cd_setor = w_cd_setor
             AND t1.cd_tipo_estrutura_comercial = p_tp_estrutura_comercial
             AND t1.cd_estrutura_comercial = p_cd_estrutura_comercial),
        T_NOTIFICADA AS ( select Count(t1.nm_notificacao_cn) over (partition by  t1.cd_consultora,t1.nm_notificacao_cn ) QTD_NOTAS,
                                 Count(t2.nm_item_notificacao_cn) over (partition by  t1.cd_consultora,t1.nm_notificacao_cn ) QTD_ITENS,
                                 T3.*
                                  from nc.t_nc_notificacao_cn t1,
                                       nc.t_nc_item_notificacao_cn  T2,
                                       NOTIFICACAO                  T3 
                                   where       t1.dt_notificacao_cn >= to_date('01/09/2006','dd/mm/yyyy')
                                    and   t3.nm_notificacao_cn = t1.nm_notificacao_cn
                                   and    t1.nm_notificacao_cn = t2.nm_notificacao_cn
                                   and    ((t2.cd_tipo_item_nc = 4 and t2.cd_subtipo_item_nc = 6)
                                           or t2.cd_tipo_item_nc = 2 or t2.cd_tipo_item_nc = 3)
                                           and t3.cd_consultora = t1.cd_consultora (+)  )  ,
        T_BLOQUEADA AS ( SELECT T4.* FROM
                     (SELECT  T3.*,
                            CASE WHEN T3.BLOQUEADA = -1 THEN  'Bloqueada'
                                 WHEN  T3.BLOQUEADA = 0 THEN
                              (CASE WHEN T3.QTD_NOTAS > 2 THEN
                                 CASE WHEN T3.QTD_ITENS > 8 THEN 'Atencao / Analise'
                                 ELSE
                                    'Normal'
                                 END
                               ELSE
                                 'Atencao / Analise'   
                              END)
                             END OBSERVACAO
                      FROM  (SELECT CASE WHEN NVL(T2.ID_CN_BLOQUEADA,1) = 1 then -1
                                   WHEN NVL(T2.ID_CN_BLOQUEADA,1) = 0  THEN 0
                                   END BLOQUEADA, T1.*
                        FROM   T_NOTIFICADA T1,
                               T_PS_CONSULTORA T2 
                               WHERE T1.CD_CONSULTORA = T2.CD_PESSOA)T3) T4 )
            select *
              from (SELECT t1.*, ROWNUM r_linha
               FROM (SELECT  cd_consultora,
                       dc_nome_consultora,
                       TELEFONE1,
                       TELEFONE2,
                       --fnc_busca_telefone(CD_CONSULTORA, 1) TELEFONE1,
                       -- fnc_busca_telefone(CD_CONSULTORA, 2) TELEFONE2,
                        EMAIL,
                        observacao,
                       nm_notificacao_cn,
                       nvl(vl_total_final,0) vl_total_final,                  
                       dt_notificacao,
                       qt_produto_item_nc,
                      sg_notificacao,
                      ID_SITUACAO,
                       qtd_registros
                    FROM (SELECT /*+ INDEX(W5 I0_NC_TIPO_ITEM_NC) */
                       W1.cd_consultora,
                       W1.dc_nome_consultora,
                       fnc_busca_telefone(w1.CD_CONSULTORA, 1) TELEFONE1,
                       fnc_busca_telefone(w1.CD_CONSULTORA, 2) TELEFONE2,
                       fnc_busca_email(w1.CD_CONSULTORA) EMAIL,
                       W1.OBSERVACAO observacao,
                       W1.nm_notificacao_cn,
                       sum(W4.qt_produto_nf *
                           W4.vl_unitario_final_produto_nf) OVER(PARTITION BY W1.cd_consultora, W1.nm_notificacao_cn) vl_total_final,
                       W1.dt_notificacao,
                       sum(W4.qt_produto_nf) OVER(PARTITION BY W1.cd_consultora, W1.nm_notificacao_cn) qt_produto_item_nc,
                       'PENDENTE' sg_notificacao,
                       W5.dc_tipo_item_nc ID_SITUACAO,
                       W_qtd_registros qtd_registros
                        FROM T_BLOQUEADA               W1,
                             nc.t_nc_item_notificacao_cn W2,
                             nc.t_nc_produto_item_nc     W3,
                             nc.t_nc_produto_item_nf     W4,
                             nc.t_nc_tipo_item_nc        W5
                       WHERE W1.dt_atendimento_notificado is null
                         and W1.nm_notificacao_cn =
                             W2.nm_notificacao_cn
                         and W2.cd_tipo_item_nc = W5.cd_tipo_item_nc
                         and W2.nm_notificacao_cn =
                             W3.nm_notificacao_cn(+)
                         and W2.nm_item_notificacao_cn =
                             W3.nm_item_notificacao_cn(+)
                         and W3.nm_notificacao_cn =
                             W4.nm_notificacao_cn(+)
                         and W3.nm_item_notificacao_cn =
                             W4.nm_item_notificacao_cn(+)
                         and W3.nm_sequencia_produto_item_nc =
                             W4.nm_sequencia_produto_item_nc(+)
                         and W2.cd_tipo_item_nc not in (6, 7)
                         and ((W2.id_situacao_item_nc = 1) OR
                             (W2.id_situacao_item_nc = 3 OR
                             W2.id_solucao_definida is not null))
                      UNION
                      SELECT /*+ INDEX(W5 I0_NC_TIPO_ITEM_NC) */
                       W1.cd_consultora,
                       W1.dc_nome_consultora,
                       fnc_busca_telefone(w1.CD_CONSULTORA, 1) TELEFONE1,
                       fnc_busca_telefone(w1.CD_CONSULTORA, 2) TELEFONE2,
                       fnc_busca_email(w1.CD_CONSULTORA) EMAIL,
                       W1.OBSERVACAO observacao,
                       W1.nm_notificacao_cn,
                       sum(W4.qt_produto_nf *
                           W4.vl_unitario_final_produto_nf) OVER(PARTITION BY W1.cd_consultora, W1.nm_notificacao_cn) vl_total_final,
                       W1.dt_notificacao,
                       sum(W4.qt_produto_nf) OVER(PARTITION BY W1.cd_consultora, W1.nm_notificacao_cn) qt_produto_item_nc,
                       'ATENDIDO' sg_notificacao,
                       W5.dc_tipo_item_nc ID_SITUACAO,
                       W_qtd_registros qtd_registros
                        FROM T_BLOQUEADA                W1,
                             nc.t_nc_item_notificacao_cn W2,
                             nc.t_nc_produto_item_nc     W3,
                             nc.t_nc_produto_item_nf     W4,
                             nc.t_nc_tipo_item_nc        W5
                       WHERE W1.dt_atendimento_notificado is not null
                         and W1.nm_notificacao_cn =
                             W2.nm_notificacao_cn
                         and W2.cd_tipo_item_nc = W5.cd_tipo_item_nc
                         and W2.nm_notificacao_cn =
                             W3.nm_notificacao_cn(+)
                         and W2.nm_item_notificacao_cn =
                             W3.nm_item_notificacao_cn(+)
                         and W3.nm_notificacao_cn =
                             W4.nm_notificacao_cn(+)
                         and W3.nm_item_notificacao_cn =
                             W4.nm_item_notificacao_cn(+)
                         and W3.nm_sequencia_produto_item_nc =
                             W4.nm_sequencia_produto_item_nc(+)
                             )T2
                    --   ORDER BY  DECODE(p_nm_asc_desc,0,DECODE(p_nm_col_ordem ,1, t2.cd_consultora,2,t2.dc_nome_consultora,t2.cd_consultora)) ASC
                      -- DECODE(p_nm_asc_desc,1,DECODE(p_nm_col_ordem ,1, cd_consultora,2,dc_nome_consultora)) desc
                             ) T1
               where rownum <= W_TO_REC)
             where r_linha >= W_FROM_REC;
      ORDER BY is with commentary because did not work, I tried with Dynamic Sql , but return me many errors

  • Question regarding SYS_REFCURSOR

    Hello,
    Here is my procedure which will get the set of result into SYS_REFCURSOR as OUT parameter.
    The problem is :
    if p_job is null then we will get "ORA-01006: bind variable does not exist"
    Could anybody please let me know how to solve this problem, or please provide better way to put the set of result into SYS_REFCURSOR.
    Thanks in advance!
    CREATE OR REPLACE PROCEDURE pr_test
    (p_start_date IN DATE,
    p_end_date IN DATE,
    p_job IN varchar2,
    result_set IN OUT SYS_REFCURSOR)
    AS
    v_sql_string varchar2(2000);
    BEGIN
    v_sql_string := 'SELECT * FROM emp WHERE HIREDATE between :1 AND :2';
    IF p_job is not null THEN
    v_sql_string := v_sql_string || ' AND job = :3';
    END IF;
    OPEN result_set
    FOR v_sql_string USING p_start_date, p_end_date, p_job;
    END pr_test;
    /

    Hello,
    I did some test with DBMS_SQL, and was able to solve my previous problem (determining the number of bind variables and bind them at run-time) with DBMS_SQL.BIND_VARIABLE.
    However, I could not figure out how to pass the cursor to client application. This function will be called by other web-based application. Could anybody please help on this or provide me other way to solve both issues (bind variables and pass cursor to client application).
    Here is the two functions:
    Function F will pass the cursor to client application (I used sqlplus here). But I am not able to bind variables at run-time. For example, if p_job/p_start/p_end is not null, then I need to add them into V_SQL and USING Clause......
    Function F2 will let me bind the variables at run-time. However, it does not let me pass the cursor to client application, because of the restriction of DBMS_SQL.TO_REFCURSOR.
    Thanks in advance!!!
    create or replace function F (p_deptno emp.deptno%type,
    p_start emp.hiredate%type,
    p_end emp.hiredate%type,
    p_job emp.job%type)
    return sys_refcursor
    as
    rec sys_refcursor;
    v_sql varchar2(1000);
    begin
    v_sql := 'select * from emp where deptno = :1';
    open rec for v_sql using p_deptno;
    return rec;
    end;
    Function created.
    SQL> var rec refcursor
    SQL> execute :rec := f(10, null, null, null);
    PL/SQL procedure successfully completed.
    SQL> print rec
    EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
    7782 CLARK MANAGER 7839 09-JUN-81 3450 10
    7839 KING PRESIDENT 17-NOV-81 6000 10
    7934 MILLER CLERK 7782 23-JAN-82 4300 10
    create or replace function F2(p_deptno emp.deptno%type,
    p_start emp.hiredate%type,
    p_end emp.hiredate%type,
    p_job emp.job%type)
    return sys_refcursor
    AS
    v_sql varchar2(3200);
    v_cursor binary_integer := dbms_sql.open_cursor;
    v_execute binary_integer;
    begin
    v_sql := 'select * from emp where deptno = :deptno';
    dbms_sql.parse(v_cursor, v_sql, dbms_sql.native);
    dbms_sql.bind_variable(v_cursor, 'deptno', p_deptno);
    v_execute := dbms_sql.execute(v_cursor);
    RETURN dbms_sql.to_refcursor(v_cursor);
    end;
    Function created.
    SQL> var rec refcursor
    SQL> execute :rec := f2(10, null, null, null);
    PL/SQL procedure successfully completed.
    SQL> print rec
    ERROR:
    ORA-01001: invalid cursor
    no rows selected

  • Rowset position cannot be restarted?

    Microsoft OLE DB Provider for SQL Server error '80040e18'
    Rowset position cannot be restarted.
    /pagename.asp, line 408
    I am using asp, stored procedure and i get the above error.
    Any ideas
    how to fix it?

    Joris van Lier wrote:
    > "Art" <lee_nospam_@nospam_artjunky.com> wrote in
    message
    > news:fevrc8$2qo$[email protected]..
    >>
    >> How do you change "cursor" location from server to
    client?
    >
    > this thread gives some details about the reasons why
    this is happening
    > <
    http://groups.google.com/group/macromedia.ultradev/browse_thread/thread/fe8c4acb6ede7a9a/7 c250437cd7ef22d?lnk=st&q=BLOB+joris+group%3Amacromedia.ultradev#7c250437cd7ef22d>
    >
    >
    > In Dreamweaver MX you can change the cursor location by
    selecting the
    > recordset from the serverbehaviors panel, that should
    activate the
    > Recordset Inspector in the Properties Panel, select
    Client from the
    > Cursor location Drop down.
    >
    > Joris
    >
    Thanks but I am using CS3 and changing the cursor location is
    no longer
    an option unless you hand-code it as I did.
    The solution was to add the 3rd line in. This changes the
    cursor to
    client side. Don't totally understand it but it worked.
    set commSearchResults = Server.CreateObject("ADODB.Command")
    commName.ActiveConnection = MM_connStringname_STRING
    --->commName.ActiveConnection.CursorLocation = 3 '
    adUseClient
    commName.CommandText = "results"
    Thanks for your help.

  • Anybody can explian what influence to my system if i increase open_cursors

    I want to increase open_cursors to 1000 , because of ORA-01000 error. But i want to know what influence to my system if i increase open_cursors !

    There are two types of cursors in the Oracle SQL engine.
    The cursors that results from parsing and determining an execution plan. These you will find in V$SQLAREA.
    These cursors are intended to be shared.
    When a client opens such a cursor, a "client" cursor is created. Oracle refers to this as a "child cursor". This cursor include the bind variable values to use for the cursor, the current "state" of the cursor and so on. These you will find in V$OPEN_CURSOR.
    An ORA-1000 results due too many client/child cursors being simultaneously opened.
    How many child cursors should a client application have opened at a single point in time? 1 or 2.
    Any more than this is not sensible as a client can only fetch and process a single cursor at a time. Maybe a 2nd cursor in some cases. But more than that? It does NOT make sense.
    How many sessions will simultaneously create a child cursor? For how long will these child cursors be opened?
    The answers to this determines the number of opened cursors the instance should cater for.
    If the answer is a 1000, then that means a 1000 sessions at the same time opening and using child cursors. And I doubt that this is the case for the OP.
    The Oracle default for open cursors is a SENSIBLE default. When changing that default, make sure that you are doing the SENSIBLE thing.
    Do not treat the symptoms of client cursor leakage by client application by increasing the number of open cursors. Bluntly put - that is an idiotic approach that will only hurt the clients and Oracle more.
    Determine the CAUSE. Fix the CAUSE. The approach is that simple.

  • Implicit PL/SQL cursors remain open, causing ORA-01000 (Client 9.2.0.1)

    Hello,
    since migrating our system from Oracle Client 9.0.X to 9.2.0.1 (Windows XP), i am encountering troubles when calling a stored procedure from a Cobol-Program:
    after a while i run into a 'Maximum open cursors exceeded'-message (ORA-01000)
    The stored procedure returns a cursor (ref_cursor)
    When Executing the stored procedure, there are actually 2 cursors involved, in fact the stored PL/SQL procedure implicitely opens a child-cursor when doing a select within the PL/SQL.
    After fetching the result and closing the cursor in my cobol-program, it correctly closes the cursor associated with the stored-procedure, but it does not close the cursor that was implicitely opened by oracle.
    After a while i am running into a Maximum open cursors message, because those cursors have not properly been closed.
    Here's a simple PL/SQL package that illustrates the problem:
    create or replace package scott.SCOTTS_PACKAGE is
    type ref_cursor IS REF CURSOR;
    function GET_EMP(EMP_IN CHAR) return ref_cursor;
    end SCOTTS_PACKAGE;
    create or replace package body scott.SCOTTS_PACKAGE is
    -- Function and procedure implementations
    function GET_EMP(EMP_IN CHAR) return ref_cursor is
    MyCurs ref_cursor;
    begin
    OPEN MyCurs FOR
    SELECT EMPNO ,
    ENAME ,
    JOB
    FROM SCOTT.EMP
    WHERE ENAME = EMP_IN;
    return(MyCurs);
    end;
    end SCOTTS_PACKAGE;
    Here are some exerpts from my cobol program:
    (The program iterates 100x through the section that executes the PL/SQL. After each iteration an additional open cursor remains in the database)
    003800 EXEC SQL BEGIN DECLARE SECTION END-EXEC.
    003900*
    004000 01 SQL-USERNAME PIC X(16) VARYING.
    004100 01 SQL-PASSWD PIC X(16) VARYING.
    004200 01 SQL-DBNAME PIC X(64) VARYING.
    004300 01 ORACLE.
    004700 02 ORA-CUR-EMP SQL-CURSOR.
    01 EMPREC.
    02 EMPREC-EMPNO PIC X(4).
    02 EMPREC-ENAME PIC X(10).
    02 EMPREC-JOB PIC X(9).
    005400 EXEC SQL END DECLARE SECTION END-EXEC.
    018400 PROCEDURE DIVISION.
    CONTINUE.
    018700 EXEC SQL
    018800 WHENEVER SQLERROR DO PERFORM SQL-ERROR
    018900 END-EXEC.
    019000*
    CONTINUE.
    019100 EXEC SQL
    019200 WHENEVER NOT FOUND DO PERFORM SQL-NOT-FOUND
    019300 END-EXEC.
    022400 EXEC SQL
    022500 ALLOCATE :ORA-CUR-EMP
    022600 END-EXEC
    PERFORM VARYING I FROM 1 BY 1 UNTIL I > 100
    ACCEPT DUMMY FROM TER
    IF DUMMY = "E"
    MOVE 100 TO I
    END-IF
    PERFORM GET-EMP
    ADD 1 TO I
    END-PERFORM
    119300 GET-EMP SECTION.
    119400************************
    119500 GAM0.
    MOVE SPACES TO EMPREC-EMPNO EMPREC-JOB
    MOVE "SMITH" TO EMPREC-ENAME
    120200 EXEC SQL AT SSSI EXECUTE
    120300 BEGIN
    120400 :ORA-CUR-EMP:=
    120500 SCOTT.SCOTTS_PACKAGE.GET_EMP(:EMPREC-ENAME );
    120900
    END;
    121000 END-EXEC
    121200 IF DB-ERR-CODE NOT = HIGH-VALUE
    121300 DISPLAY "CCSIFSO:GET-AUTRE-MATR:APPEL PERS... OK"
    121400 EXEC SQL
    121500 FETCH :ORA-CUR-EMP
    121600 INTO
    121700 :EMPREC-EMPNO,
    121800 :EMPREC-ENAME,
    121900 :EMPREC-JOB
    122400 END-EXEC
    122500 END-IF
    122600*
    122700 IF DB-ERR-CODE NOT = HIGH-VALUE
    122800 DISPLAY "CCSIFSO:GET-AUTRE-MATR:APPEL FETCH.. OK"
    123000 ELSE
    123100 MOVE LOW-VALUE TO DB-ERR-CODE
    123200 END-IF
    123300 EXEC SQL
    123400 CLOSE :ORA-CUR-EMP
    123500 END-EXEC
    123600 GA-EX.
    123700 EXIT.
    124000 SQL-NOT-FOUND SECTION.
    124100*----------------------
    124200 NF0.
    124300 DISPLAY "CCSIFSO:SQL-NOT-FOUND SECTION."
    124400 MOVE HIGH-VALUE TO DB-ERR-CODE.
    124500 NF-EX.
    124600 EXIT.
    124700*
    124800 SQL-ERROR SECTION.
    124900*-----------------
    125000 ER0.
    125200 EXEC SQL
    125300 WHENEVER SQLERROR CONTINUE
    125400 END-EXEC
    125700 MOVE HIGH-VALUE TO DB-ERR-CODE
    125800*
    126100 DISPLAY "ORACLE ERROR DETECTED: " SQLCODE UPON TER
    126200 DISPLAY SQLERRMC UPON TER
    126300*
    126400 EXEC SQL AT SSSI
    126500 ROLLBACK WORK
    126600 RELEASE
    126700 END-EXEC
    126800 DISPLAY "----------------------------" UPON TER
    126900 DISPLAY " ! ROLLBACK ET DISCONNECT ! " UPON TER
    127000 DISPLAY "----------------------------" UPON TER
    127200 CALL "PPTERMJ".
    127400 ER-EX.
    127500 EXIT.
    Finally here's an exerpt from V$OPEN_CURSOR, after a few iterations:
    1 begin :b1 := SCOTT . SCOTTS_PACKAGE . GET_EMP (:b2 ) ; END ;
    2 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    3 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    4 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    5 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    6 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    7 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    8 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    9 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    10 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    11 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    As you see, there is only 1 cursor starting with 'begin ... '
    but there are 10 implicit cursors 'SELECT EMPNO, ... ' that have not been properly closed, nor reused by ORACLE.
    In our old configuration (ORACLE CLient 9.0.X), you would only see:
    1 begin :b1 := SCOTT . SCOTTS_PACKAGE . GET_EMP (:b2 ) ; END ;
    2 SELECT EMPNO , ENAME , JOB FROM EMP WHERE ENAME = :B1
    meaning all the other cursors have properly been closed.
    As a conclusion: the program correctly closes the implicit cursors when using a 9.0 Client, wheras the implicit cursors remain open on Client 9.2.0.1 (Windows XP)
    The underlying database can be either 8.i or 9, the problem remains the same.
    Finally here's a small Delphi code, using ODAC-components, that somewhat illustrates the same problem:
    procedure TForm1.ExecProcClick(Sender: TObject);
    var I: INTEGER ;
    begin
    FOR I := 1 TO 5 DO
    BEGIN
    SP1.StoredProcName:='SCOTT.SCOTTS_PACKAGE.GET_EMP';
    SP1.Prepare;
    SP1.ParamByName('EMP_IN').AsString := 'SMITH';
    SP1.ExecProc;
    SP1.Next;
    SP1.Close;
    SP1.UnPrepare;
    END;
    end;
    After each call to 'PREPARE', an additional implicit cursor remains open on the database. (using Oracle Client 9.2.0.1)
    On our old system (Oracle Client 9.0 or 8.X), the same program would not generate accumulating open cursors on the database
    Any suggestions would be welcome,
    Claude

    Cobol.. been many years since I last even saw some Cobol source code. Invokes all kinds of memories. :-)
    Since you found the patch, the advice is superfluous, but works. Close the cursor at the PL/SQL side, e.g.
    create or replace procedure CloseRefCursor( cRefCursor TYPELIB.TRefCursor ) is
    begin
      close cRefCursor;
    exception when OTHERS then
      -- if the cursor is already gone, not a problem
      NULL;
    end;In Delphi for example, one can subclass the class used for ref cursor calls and add a call to the above PL/SQL proc in the destructor. Or add create a standard Cobol close ref cursor section that does similar.

  • How to change the mouse cursor icon type when mouse moves out of client area ( propertysheet) WTL?

    I got stuck with an issue in property sheet .I want to load different cursor when the mouse position is within the client area and load another when moves out of the client area.
    In the porpetysheet I added four page. In the first page when I click next I am loading cursor of IDC_WAIT type and loading IDC_ARROW when the mouse moves out of the client area.
    In the page class I triggered the event for WM_MOUSEMOVE as follow:
        MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)
    LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
    if(TRUE == m_bIsNextBtnClicked)
    ::SetCursor(LoadCursor(NULL, IDC_WAIT));
    else
    ::SetCursor(LoadCursor(NULL, IDC_ARROW));
    return TRUE;
    This event is getting triggered and absolutely had no issue with this. Similarly I tried adding `MESSAGE_HANDLER(WM_MOUSELEAVE, OnMouseLeave)` this event making an assumption that this will get triggered if the mouse moves out of the client area,  but
    this event did not get triggered at all.If this is not the mouse event to be triggered for mouseleave which event should I trigger?
    LRESULT OnMouseLeave(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
    ::SetCursor(LoadCursor(NULL, IDC_ARROW));
    return TRUE;
    Now when I click Next button , **I was actually calling a function which is taking sometime to return** . Before to this function I am loading IDC_WAIT cursor i.e., 
     `::SetCursor(LoadCursor(NULL, IDC_WAIT));` . 
    Now when move the mouse cursor on to the non-client area I want to load IDC_ARROW cursor i.e., 
        ::SetCursor(LoadCursor(NULL, IDC_ARROW)); 
    When the moves on to the non-client area I am handling the mouse event in sheet derived class as follows,
    MESSAGE_HANDLER(WM_NCMOUSEMOVE, OnNCMouseMove)
    LRESULT OnNCMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
    ::SetCursor(LoadCursor(NULL, IDC_ARROW));
    return 0;
    This event is not getting triggered until unless the function in the Next button event is executed.
    I want both of them to be done in parallel i.e, click Next button now hover mouse on the client area, Busy icon should come and when mouse moves out of the client area then IDC_ARROW icon should come.
    LRESULT OnWizardNext()
    ::SetCursor(LoadCursor(NULL, IDC_WAIT));
    m_bIsNextBtnIsClicked = TRUE;
    BOOL bRet = MyFun();
    m_bIsNextBtnIsClicked = FALSE;
    //Until this function(MyFun()) is executed **WM_NCMOUSEMOVE**
    //event is not getting triggered.But this event should get triggered and I
    //should be able to see the change of cursor within and out of client area.
    Can anyone kindly help me to solve this issue.
    SivaV

    Hello
    sivavuyyuru,
    For this issue, I am trying to involve someone to help look into, it might take some time and as soon as we get any result, we will tell you.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Logitech Touch Mouse App won't work or display cursor on a iOS device running RD Client App

    I was trying to use Logitech Touch Mouse App installed on a iPhone5 as a physical mouse with a RD Client installed on another iPad mini. The host is a NB running Windows 7. The Touch mouse movement is noticeable on the RDC screen on iPad mini, but the cursor
    is missing. It appears the cursor image was blocked by the RDC.
    It would be very helpfull for the RDC running on a iOS device to support this type of WiFi mouse App to enable a physical mouse (through a smart device). I can see many usage models of RD Client with this type of physical mouse feature.

    Hi,
    The version 8.1.3 is released, please update to the latest version and see how it works,
    https://itunes.apple.com/us/app/microsoft-remote-desktop/id714464092
    Thanks.
    Jeremy Wu
    TechNet Community Support

Maybe you are looking for