Count NULL Records

Hi,
  I am trying to count null records in the email field by using a running total. However, the running total is not calculating it correctly. I am using SQL Server and I have checked the database to make sure the cells are actually null and are not blank.  What formula do I need to use to get the running total to work? I have tried isNull() and that didn't work. Here is my current formula:
{vwGenPatInfo.Patient_Email} = "" and
Next ({vwEncounterForms.Patient_ID}) <> {vwEncounterForms.Patient_ID}

1) Is this a running total field or did you create a manual running total?
2)  Why are you comparing the next record?
3)  Do you have "Convert NULL values to Default" turned on in your report or global options?

Similar Messages

  • How can I get a count of records in a DB?

    If I want to get a count of the number of records in a table how do I do it?

    Generally, it's good practice to close the connection once you're done with it unless you have a reason to keep going back to it, in which case it probably becomes a performance issue. If you need to keep accessing the same connection repeatedly while your form is running (in Acrobat), I think you would be best to leave it open after initialization.<br /><br />You might consider placing the code which counts the records into a function inside a Script Object. This way, you can just call the Script Object method and retrieve the record count whenever you need it.<br /><br />Make sure you define the <b>oDB</b> variable outside the function but inside the Script Object:<br /><pre>var oDB = null;<br /><br />function GetRecordCount()<br />{<br />  if (oDB == null)<br />  {<br />    var sDataConnectionName = "<value>"; // example - var sDataConnectionName = "MyDataConnection"; <br /><br />    // Search for sourceSet node which matchs the DataConnection name <br />    var nIndex = 0; <br />    while(xfa.sourceSet.nodes.item(nIndex).name != sDataConnectionName) <br />    { <br />      nIndex++; <br />    } <br /><br />    var oDB = xfa.sourceSet.nodes.item(nIndex); <br />    oDB.open();<br />  }<br /><br />  oDB.first(); <br /><br />  // Search node with the class name "command" <br />  var nDBIndex = 0; <br />  while(oDB.nodes.item(nDBIndex).className != "command") <br />  { <br />    nDBIndex++; <br />  } <br /><br />  // Backup the original settings before assigning BOF and EOF to stay <br />  var sBOFBackup = oDB.nodes.item(nDBIndex).query.recordSet.getAttribute("bofAction"); <br />  var sEOFBackup = oDB.nodes.item(nDBIndex).query.recordSet.getAttribute("eofAction"); <br /><br />  oDB.nodes.item(nDBIndex).query.recordSet.setAttribute("stayBOF", "bofAction"); <br />  oDB.nodes.item(nDBIndex).query.recordSet.setAttribute("stayEOF", "eofAction"); <br /><br />  var itemCount = 0; <br /><br />  while(!oDB.isEOF()) <br />  { <br />    itemCount++; <br />    oDB.next(); <br />  } <br /><br />  // Restore the original settings <br />  oDB.nodes.item(nDBIndex).query.recordSet.setAttribute(sBOFBackup, "bofAction"); <br />  oDB.nodes.item(nDBIndex).query.recordSet.setAttribute(sEOFBackup, "eofAction"); <br /><br />  return itemCount;<br />}</pre><br />You can create a script object by right-clicking on the top-level form node ("form1" by default). Say you name your script object "Utils", you can then call the function inside of it from any event script like this:<br /><pre>this.rawValue = Utils.GetRecordCount();</pre><br />Stefan<br />Adobe Systems

  • Fetching null records out of a function takes much longer than non-null

    Hi,
    We have a function that is called thousands of times on SQL. This function has a SELECT than can return one row at max.
    We realized that when the SQL statement doesn't return any record, it takes 3x times longer in the fetch phase.
    I made a simple test with three functions were each one was executed 1000 times. The first one has an extra outer join that guarantees that it always returns one record, a second one with an explicit cursor that can return 0 records and a third one with an implicit cursor that can also return 0 records.
    Here is the sample test code:
    DECLARE
    -- Local variables here
    CURSOR c IS
    SELECT teste_vasco.teste_vasco1(epis.id_episode) as val
    FROM episode epis
    WHERE rownum <= 1000;
    TYPE t_c IS TABLE OF c%ROWTYPE;
    l_c t_c;
    BEGIN
    -- Test statements here
    OPEN c;
    FETCH c BULK COLLECT
    INTO l_c;
    CLOSE c;
              for i in l_c.first..l_c.last
              loop
              dbms_output.put_line(i || ' :' || l_c(i).val);
              end loop;
    END;
    The difference between the tests is that instead of calling the vasco1 function, vasco2 and vasco3 is called.
    ###Test1
    -Function vasco1:
    FUNCTION teste_vasco1(i_episode IN episode.id_episode%TYPE) RETURN VARCHAR2 IS
    l_dt_set TIMESTAMP WITH LOCAL TIME ZONE;
    l_flg_stage VARCHAR2(3);
    l_dt_warn TIMESTAMP WITH LOCAL TIME ZONE;
    CURSOR c_care_stage IS
    SELECT cs.dt_set, cs.flg_stage, cs.dt_warn
    FROM episode epis
    LEFT JOIN care_stage cs ON (cs.id_episode = epis.id_episode AND cs.flg_active = 'Y')
    WHERE epis.id_episode = i_episode;
    BEGIN
    OPEN c_care_stage;
    FETCH c_care_stage
    INTO l_dt_set, l_flg_stage, l_dt_warn;
    CLOSE c_care_stage;
    IF l_dt_set IS NULL
    THEN
    RETURN NULL;
    END IF;
    RETURN l_dt_set || l_flg_stage || l_dt_warn;
    EXCEPTION
    WHEN OTHERS THEN
    pk_alert_exceptions.raise_error(error_code_in => SQLCODE, text_in => SQLERRM);
    pk_alert_exceptions.reset_error_state;
    RETURN NULL;
    END teste_vasco1;
    -Trace file:
    SELECT TESTE_VASCO.TESTE_VASCO1(EPIS.ID_EPISODE) AS VAL
    FROM
    EPISODE EPIS WHERE ROWNUM <= 1000
    call count cpu elapsed disk query current rows
    Parse 1 0.01 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 0.04 0.06 0 8 0 1000
    total        3      0.06       0.07          0          8          0        1000
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 286 (recursive depth: 1)
    Rows Row Source Operation
    1000 COUNT STOPKEY (cr=8 pr=0 pw=0 time=2035 us)
    1000 INDEX FAST FULL SCAN EPIS_EPISODE_INFO_UI (cr=8 pr=0 pw=0 time=1030 us)(object id 153741)
    SELECT CS.DT_SET, CS.FLG_STAGE, CS.DT_WARN
    FROM
    EPISODE EPIS LEFT JOIN CARE_STAGE CS ON (CS.ID_EPISODE = EPIS.ID_EPISODE AND
    CS.FLG_ACTIVE = 'Y') WHERE EPIS.ID_EPISODE = :B1
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1000 0.07 0.05 0 0 0 0
    Fetch 1000 0.01 0.02 0 4001 0 1000
    total     2001      0.09       0.07          0       4001          0        1000
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 286 (recursive depth: 2)
    ###Test2
    -Function vasco2:
    FUNCTION teste_vasco2(i_episode IN episode.id_episode%TYPE) RETURN VARCHAR2 IS
    l_dt_set TIMESTAMP WITH LOCAL TIME ZONE;
    l_flg_stage VARCHAR2(3);
    l_dt_warn TIMESTAMP WITH LOCAL TIME ZONE;
    CURSOR c_care_stage IS
    SELECT cs.dt_set, cs.flg_stage, cs.dt_warn
    FROM care_stage cs
    WHERE cs.id_episode = i_episode
    AND cs.flg_active = 'Y';
    BEGIN
    OPEN c_care_stage;
    FETCH c_care_stage
    INTO l_dt_set, l_flg_stage, l_dt_warn;
    IF c_care_stage%NOTFOUND
    THEN
    CLOSE c_care_stage;
    RETURN NULL;
    END IF;
    CLOSE c_care_stage;
    IF l_dt_set IS NULL
    THEN
    RETURN NULL;
    END IF;
    RETURN l_dt_set || l_flg_stage || l_dt_warn;
    EXCEPTION
    WHEN OTHERS THEN
    pk_alert_exceptions.raise_error(error_code_in => SQLCODE, text_in => SQLERRM);
    pk_alert_exceptions.reset_error_state;
    RETURN NULL;
    END teste_vasco2;
    -Trace File:
    SELECT TESTE_VASCO.TESTE_VASCO2(EPIS.ID_EPISODE) AS VAL
    FROM
    EPISODE EPIS WHERE ROWNUM <= 1000
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 0.00 0.27 0 8 0 1000
    total        3      0.00       0.27          0          8          0        1000
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 286 (recursive depth: 1)
    Rows Row Source Operation
    1000 COUNT STOPKEY (cr=8 pr=0 pw=0 time=2048 us)
    1000 INDEX FAST FULL SCAN EPIS_EPISODE_INFO_UI (cr=8 pr=0 pw=0 time=1045 us)(object id 153741)
    SELECT CS.DT_SET, CS.FLG_STAGE, CS.DT_WARN
    FROM
    CARE_STAGE CS WHERE CS.ID_EPISODE = :B1 AND CS.FLG_ACTIVE = 'Y'
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1000 0.03 0.05 0 0 0 0
    Fetch 1000 0.00 0.00 0 2001 0 1
    total     2001      0.03       0.06          0       2001          0           1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 286 (recursive depth: 2)
    Rows Row Source Operation
    1 TABLE ACCESS BY INDEX ROWID CARE_STAGE (cr=2001 pr=0 pw=0 time=11082 us)
    1 INDEX RANGE SCAN CS_EPIS_FACT_FST_I (cr=2000 pr=0 pw=0 time=7815 us)(object id 688168)
    ###Test3
    -Function vasco3
    FUNCTION teste_vasco3(i_episode IN episode.id_episode%TYPE) RETURN VARCHAR2 IS
    l_dt_set TIMESTAMP WITH LOCAL TIME ZONE;
    l_flg_stage VARCHAR2(3);
    l_dt_warn TIMESTAMP WITH LOCAL TIME ZONE;
    BEGIN
    BEGIN
    SELECT cs.dt_set, cs.flg_stage, cs.dt_warn
    INTO l_dt_set, l_flg_stage, l_dt_warn
    FROM care_stage cs
    WHERE cs.id_episode = i_episode
    AND cs.flg_active = 'Y';
    EXCEPTION
    WHEN no_data_found THEN
    RETURN NULL;
    END;
    IF l_dt_set IS NULL
    THEN
    RETURN NULL;
    END IF;
    RETURN l_dt_set || l_flg_stage || l_dt_warn;
    EXCEPTION
    WHEN OTHERS THEN
    pk_alert_exceptions.raise_error(error_code_in => SQLCODE, text_in => SQLERRM);
    pk_alert_exceptions.reset_error_state;
    RETURN NULL;
    END teste_vasco3;
    -Trace file:
    SELECT TESTE_VASCO.TESTE_VASCO3(EPIS.ID_EPISODE) AS VAL
    FROM
    EPISODE EPIS WHERE ROWNUM <= 1000
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 0.25 0.27 0 8 0 1000
    total        3      0.25       0.27          0          8          0        1000
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 286 (recursive depth: 1)
    Rows Row Source Operation
    1000 COUNT STOPKEY (cr=8 pr=0 pw=0 time=2033 us)
    1000 INDEX FAST FULL SCAN EPIS_EPISODE_INFO_UI (cr=8 pr=0 pw=0 time=1031 us)(object id 153741)
    SELECT CS.DT_SET, CS.FLG_STAGE, CS.DT_WARN
    FROM
    CARE_STAGE CS WHERE CS.ID_EPISODE = :B1 AND CS.FLG_ACTIVE = 'Y'
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1000 0.07 0.06 0 0 0 0
    Fetch 1000 0.00 0.00 0 2001 0 1
    total     2001      0.07       0.06          0       2001          0           1
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 286 (recursive depth: 2)
    Rows Row Source Operation
    1 TABLE ACCESS BY INDEX ROWID CARE_STAGE (cr=2001 pr=0 pw=0 time=11119 us)
    1 INDEX RANGE SCAN CS_EPIS_FACT_FST_I (cr=2000 pr=0 pw=0 time=7951 us)(object id 688168)
    As you can see, in the first example the fetch time of the SELECT in the function vasco1 takes 0.02 seconds and 0.06 in the SELECT of the test script. This test returned 1000 non-null records.
    In the tests 2 and 3, the fetch phase of the SELECT in the test script takes much more time - 0.27 seconds, despite the fetch of the SELECT in the functions (vasco2 and vasco3) took 0.00 seconds (as it only returned 1 row for the 1000 executions) and the only difference between them is the function that is called. Both test2 and test3 returned 999 null records and 1 non-null record.
    How it's possible than a select null records takes much longer than selecting non-null records?
    Hope you can understand the problem and thank you in advance for any help or suggestions.

    Thank you for the replies...
    But the thing is that the SELECT in the function is very fast and the fetch phase takes no time (0.00 second).
    And, as you can see in the execution plan, there's no need for a full index scan...only a range scan is performed:
    SELECT CS.DT_SET, CS.FLG_STAGE, CS.DT_WARN
    FROM
    CARE_STAGE CS WHERE CS.ID_EPISODE = :B1 AND CS.FLG_ACTIVE = 'Y'
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1000 0.07 0.06 0 0 0 0
    Fetch 1000 0.00 0.00 0 2001 0 1
    total     2001      0.07       0.06          0       2001          0           1
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 286 (recursive depth: 2)
    Rows Row Source Operation
    1 TABLE ACCESS BY INDEX ROWID CARE_STAGE (cr=2001 pr=0 pw=0 time=11119 us)
    1 INDEX RANGE SCAN CS_EPIS_FACT_FST_I (cr=2000 pr=0 pw=0 time=7951 us)(object id 688168)
    But, the fetch phase of the SQL that calls the function that has this query takes 0,27 seconds.
    As far as the contex switch, we are aware of that, but we can have modularity with this solution and the first function also have many context switching and is must faster.
    Edited by: Pretender on Mar 18, 2009 3:38 PM

  • How to find total count of records in a cursor

    Aassume below is the cursor i defined
    cursor c1 is select * from emp;
    now, i want to find the total count of records in this cursor using an existing function etc., using one line statement.
    FYI: c1%rowcount is always giving 0, so i cant rely on this.
    Any thoughts, please share.
    Thanks in advance.

    I am just showing this to show how to get the rowcount along with the cursor, if the program has so much gap of between verifying the count(*) and opening the cursor.
    Justin actually covered this, he said, oracle has to spend some resources to build this functionality. As it is not most often required, it does not makes much sence to see it as a built-in feature. However, if we must see the rowcount when we open the cursor, here is a way, but it is little bit expensive.
    SQL> create table emp_crap as select * from emp where 1 = 2;
    Table created.
    SQL> declare
      2   v_cnt     number := 0;
      3   zero_rows         exception;
      4  begin
      5    for rec in (select * from (select rownum rn, e.ename from emp_crap e) order by 1 desc)
      6     loop
      7        if v_cnt = 0 then
      8           v_cnt := rec.rn;
      9        end if;
    10     end loop;
    11     if v_cnt = 0 then
    12        raise zero_rows;
    13     end if;
    14   exception
    15    when zero_rows then
    16      dbms_output.put_line('No rows');
    17   end;
    18  /
    No rows
    PL/SQL procedure successfully completed.
    -- Now, let us use the table, which has the data
    SQL> declare
      2   v_cnt     number := 0;
      3   zero_rows         exception;
      4  begin
      5    for rec in (select * from
      6          (select rownum rn, e.ename from emp e)
      7          order by 1 desc)
      8     loop
      9        if v_cnt = 0 then
    10           v_cnt := rec.rn;
    11           dbms_output.put_line(v_cnt);
    12        end if;
    13     end loop;
    14     if v_cnt = 0 then
    15        raise zero_rows;
    16     end if;
    17   exception
    18    when zero_rows then
    19      dbms_output.put_line('No rows');
    20   end;
    21  /
    14
    PL/SQL procedure successfully completed.Thx,
    Sri

  • How to know the count of record in CR XI?

    Post Author: Liu ming
    CA Forum: Deployment
    Hi All,
    I create a report by CR XI release 2. The report is viewed in ASP.Net. So, I would like show a message when the report have no record. My question is how to know the count of record?
    Thanks.

    I was able to do this by using
    ora:countNodes('Receive_1_Read_InputVariable','BILL','/ns2:BILL/ns2:CMS1500')

  • Need a relative sequence (count of record) in an input file in ESB input fi

    I am using ESB to pick up text files and pass them to a stored procedure. I have multiple variable length records in the file. I pass each record to the
    output file adapter, along with the input filename. I would also like to get a relative record number for each record within the file. I use an xsd file
    to convert the input to XML. The entire file is at the root level, each record is an element. Is there a way to get a relative count of each element?
    Here is the xsd file:
    <?xml version="1.0" encoding="UTF-8" ?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
    targetNamespace="http://TargetNamespace.com/Filein"
    xmlns:tns="http://TargetNamespace.com/Filein"
    elementFormDefault="qualified"
    attributeFormDefault="unqualified" nxsd:encoding="ASCII" nxsd:stream="chars" nxsd:version="NXSD">
    <xsd:element name="Root-Element">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="C1" minOccurs="1" maxOccurs="unbounded">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="C1" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;">
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    <!--NXSDWIZ:J:\\UPLD5383.INM:-->
    <!--USE-HEADER:false:-->
    I need to map the relative record number to a field in the output.
    Is there a function similar to the get filename that would return this value to me?
    <xsl:value-of select='ehdr:getRequestHeader("/fhdr:InboundFileHeaderType/fhdr:fileName","fhdr=http://xmlns.oracle.com/pcbpel/adapter/file/;")'/>
    I use this in the xsl file to get the file name .

    does each record start with a new line? if it does a
    simple wc -l can help you. If not, you can pre
    process this XML file by first removing all the new
    line characters using sed and then adding new line
    characters after the end tag of the xml using sed and
    finally doing a wc -l . this would be a simple shell
    script. Not sure if you want to use Unix shell
    scripting to achieve this.The sheer nature of XML means that it does not conform to any visual formatting. i.e. An xml file containing...
    <employee><empno>3</empno></employee>
    is identical in XML terms to...
    <employee>
    <empno>3</empno>
    </employee>
    which is also identical in XML terms to...
    <employee>
    <empno>
    3
    </empno>
    </employee>
    which is also identical in XML terms to...
    <employee><empno>
    3
    </empno></employee>
    etc.
    You cannot rely on the number of CR's or CR/LF's in the file to count the records. Proper XML processing should be used for such a task.

  • How to find count of records based on batch wise.

    Hi All,
    We are working on OWB10gr2. I would like share one requirement. Any one can suggest me how to do it and which is the best way to get accurate information.
    We have 2 schemas’ like nia_src and nia_tgt. currently we are moving data from nia_src to nia_tgt for that reason we implemented some mappings based on requirement. In my source schema (nia_src) having 100 tables with data and similar structure replicated in target schema (nia_tgt).
    In source schema every table having one date field for which record is inserted and based on that field we can find how may records are inserted on particular table ,particular time.
    Same like target also maintaining date fields for tracking purposes.
    We have done some mappings and scheduled also. Every day we are into the target with incremental data. All are working fine not any issues.
    I wanted to know how many records inserted, updated, merged for particular batch
    How can we find?
    Can we find exact information in OWB_REP_OWNER schema on WB_RT_AUDIT?.
    For tracking purposes I need to find those values how many records are available in
    Source table and how many records are populated to the target schema?
    How to find schedule batch count of records table wise for batch wise?
    Please suggest me any one on this.
    thanks and regards,
    venkat.

    RE: based on pre operator can we find count of records. if yes how to do it.
    No, you cannot tell from the pre- operator how many records will be inserted or updated into a mapping. How could you? The mapping hasn't run yet!
    At best (if you have simple mappings with single targets) you could come up with a strategy to have the pre-mapping procedure aware of it's package name, then select from user_source for that package body until you find that first cursor used for the row-based processing, copy the cursor into a local variable, and then execute immediate select count(*) from that cursor definition. But still, all that would get you is the number of rows selected - not inserted / updated / errored etc.
    A post-mapping procedure that is aware of the package name will, however, run prior to package exit so that the package spec is still in memory so you can access the public variables in the package spec. We do that in our standard post-mapping procedure
    CREATE OR REPLACE procedure erscntrl_finalize_prc(
                           p_process_id     in  number,
                           p_process_name   in  varchar2)
    as
          l_numread      number         := 0;
          l_numInserted  number         := 0;
          l_numUpdated   number         := 0;
          l_numMerged    number         := 0;
          l_owb_audit_id number         := 0;
          l_owb_status   number         := 0;
          sqlStmt        varchar2(2000) :=
                               'begin '||
                               '  :1 := '||p_process_name||'.get_selected; '||
                               '  :2 := '||p_process_name||'.get_inserted; '||
                               '  :3 := '||p_process_name||'.get_updated; '||
                               '  :4 := '||p_process_name||'.get_merged; '||
                               '  :5 := '||p_process_name||'.get_audit_id; '||
                               '  :6 := '||p_process_name||'.get_status; '||
                               ' end;';
    begin
          -- we use dynamic SQL to return required audit field values.
          --  This allows us to alter which values we need at a later date
          --  without impacting the deployed mappings.
        execute immediate sqlStmt
        using   out l_numread,   out l_numInserted,  out l_numUpdated,
                out l_numMerged, out l_owb_audit_id, out l_owb_status;
      -- then execute our own logging package.
       owb_mapping_log_pkg.finalize(
                           p_process_id,
                           p_process_name,
                           l_numread,
                           l_numInserted,
                           l_numUpdated,
                           l_numMerged,
                           l_owb_audit_id,
                           l_owb_status
    end;
    /However, even in this case bear in mind that if you run the mapping in set-base mode, all Oracle returns is the number merged which does not give values for the inserted and updated counts. If you really need those values you need to either a) run in row-based mode or row-based-target-only, or come up with some custom queries. For example, in your pre-mapping do a select count(*) from your_target_table, then run the mapping, then get the number merged, then do another select count(*) from your_target_table. With these values and basic math you could tell the number inserted by the growth in the table, and the rest of the number merged must have been updates.
    That being said, if you are playing with dimensions as large as most of the ones I am - there is no bloody way that you want to do two select count(*) statements on each run without a really, really good reason.....
    Cheers,
    Mike

  • Getting the count of records in a cursor

    Hi,
    How can I get the count of records satisfying a conditin in a cursor.
    This is the code that I have written. Please tell me where I am going wrong.
    declare
    cursor c is
    select * from Details where Name like 'M%';
    rec number;
    r c%rowtype;
    begin
    for r in c
    loop
    rec:=rec+1;
    end loop;
    dbms_output.put_line(rec);
    end;
    Thanks in advance

    Hi,
    You have to initialize the rec variable.
    declare
    cursor c is
    select * from Details where Name like 'M%';
    rec number :=0;
    r c%rowtype;
    begin
    for r in c
    loop
    rec:=rec+1;
    end loop;
    dbms_output.put_line(rec);
    end;
    You can also use the %ROWCOUNT attribute.
    Regards

  • Count of records/rows in a Table

    Hi
    This could be a basic question , but i don't have an idea how to do that .
    Could you please tell me , how get an count of records/rows in a specific table ?
    Thank you
    Luke

    sb92075 wrote:
    It takes time to get count of records if the table size is hugCan YOU count to 1000000000000000000 as quickly as you count to 10?????????????????????????
    If it takes you longer to count many things, why do you expect Oracle to do better than you?Really??
    Let's try some counts and see.
    First off, let's count a few 1000 rows.
    SQL> set timing on
    SQL> select count(*) from all_objects;
      COUNT(*)
         45045
    Elapsed: 00:00:17.08So 17 seconds for 45,000 rows.
    Now if you're logic is correct, counting let's say a few billion rows, should take an hour? Perhaps more?
    Here's what I see on one of my larger tables:
    SQL> select count(*) from daily_xxxxxxx;
      COUNT(*)
    2569780329
    Elapsed: 00:00:10.03Oops... it is faster.
    Get a clue!I hereby sincerely apologise that my database does not adhere to your fine logic that says it should take a few hours - I will speak disapprovingly to the CBO for allowing the 2nd select count (on the same database) to be faster than the 1st select count. I will even use the backchannel to inform Larry that this is not acceptable.
    Of course, this is assuming that you do not have your head stuck up somewhere and are indeed correct that it takes a "+looooonnngggg+" time to count lots of rows.
    !http://smileyicons.net/smilies/actions1.gif!

  • How to get count of records for each type from internal table

    Hi Guys,
    I want to implement a logic to find out the count of records in a internal table.
    Assume my internal table have one field having the entries as shown below.
    Internal table Entries
    10
    10
    10
    11
    11
    12
    12
    12
    12
    13
    14
    14
    15
    15
    15
    15
    15
    16
    16
    17
    18
    19
    20
    20
    20
    ....... etc....
    I should get an output as below
    10's - 3
    11's -2 ,
    12's - 4.... etc..
    Could any one help me how to do this.
    Thanx,
    Kumar

    REPORT  zzz.
    DATA: i(100),
          t(100),
          j TYPE n.
    TYPES: BEGIN OF gt_int_type,
            linex(100) TYPE c,
           END OF gt_int_type.
    DATA: gt_int TYPE STANDARD TABLE OF gt_int_type,
          wa_int LIKE LINE OF gt_int.
    START-OF-SELECTION.
      wa_int-linex = '10'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '10'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '10'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '11'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '11'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '12'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '12'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '12'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '12'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '13'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '14'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '14'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '15'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '15'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '15'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '15'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '15'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '16'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '16'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '17'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '18'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '19'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '20'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '20'.
      APPEND wa_int TO gt_int.
      wa_int-linex = '20'.
      APPEND wa_int TO gt_int.
      LOOP AT gt_int INTO wa_int.
        WRITE:/ wa_int-linex.
      ENDLOOP.
      ULINE.
      SKIP 3.
      SORT gt_int BY linex.
      READ TABLE gt_int INDEX 1 INTO i.
      j = 0.
      LOOP AT gt_int INTO wa_int.
        IF wa_int-linex EQ i.
          j = j + 1.
        ELSE.
          WRITE:/ i,'''s = ', j.
          j = 1.
          i = wa_int-linex.
        ENDIF.
      ENDLOOP.
      WRITE:/ i,'''s = ', j.
    consider clearing leading/trainling spaces...

  • Exel to SQL DFTask loads some Null records

    I have an SSIS package to import Excel data into SQL. When I look at Excel I dont see ANY Null rows. However when I run the SSIS package and check SQL, It loads some NULL RECORDS IN SQL. WHy is that It loads Null records in SQL, When i cannot see the Null
    recs In Excel?

    That's because the person who created the Excel file and added the data to it pressed the "Enter" key on some of the empty cells under that specific column. In excel, such a row might look like any other empty, non-data row but for SSIS, its an
    actual data row except that it doesn't have any value. SSIS treats a missing data value as a DBNULL and that's what you saw.
    There are multiple ways of fixing this. 
    1. Educate the creator of the excel to be more careful at the time of data entry.
    2. Make that target column in the DB table as NOT NULL. 
    3. Handle such "empty" data values as exception inside your SSIS (using a data flow task and ignoring such rows).
    4. Switch to using CSV file format instead of excel format.
    5. All of the above :)
    Hope this helps.
    Cheers!
    Muqadder.

  • Chart: amount (count) of records per month (and year). How?

    I need to create a chart eventually. Can't get what formula to use. The data is:
    1 | 15 Jan
    2 | 20 Jan
    25 | 14 Mar
    26 | 16 Mar
    28 | 20 Mar
    The chart should show amount(count) of records per month(and year). So in this example:
    Jan: 2
    Mar: 3
    Hm... totally lost. Any tips?

    To do this it would be best to add a column in which you isolate the month from the rest of the date information. Here's an example:
    You may hide the Month-Isolated column if it impacts your presentation.
    The Month-Isolated formula is: =IF(ISBLANK(B), "", (MONTH(B)))
    The formula for the count in the Summary table is: =COUNTIF(Data Table :: $C, COLUMN())
    Hope this gets you on your way.
    Regards,
    Jerry

  • Show count of records in prompt..

    Hi all,
    we have a requirement where the users need to see the count of records for each value in the last prompt in a sequence of prompts(i.e after applying all the filters).
    Any ideas on how we can do this?
    Thanks.

    Suggestions:
    1) Keep the origianal employeeid also in the prompt ..but it would feel redundant to users
    or
    2) use intermediate report as in here Re: MONTH and YEAR functions.  Please help...

  • Count of records

    Hi,
    I want to display the count of records under the same product ,product category and country .
    can anyone suggest how to do thta.
    Thanks in advance.

    Hi,
    Check this link:
    https://forums.sdn.sap.com/click.jspa?searchID=3300416&messageID=3618770
    With rgds,
    Anil Kumar Sharma .P

  • Count of records input via MM01

    How can we do count of records input via MM01?
    Thanks,
    AP

    Hi,
    it depends of using MM01.
    MARA, MARC, MARD, MVKE etc.
    regards, Dieter

Maybe you are looking for

  • The maximize/minimize and close and buttons are not shown correctly when FF windows is maximized.

    I have the same problem on all my computers, one running Windows 7 and two with Vista. The three buttons in the upper right corner of the FF windows are not shown correctly. They are soft of cut off in the middle when the FF window is maximized.

  • We want the accounts to be posted to 5310 and sales org xx70

    Hi All In april2008 invoice was created for company code 5610 and sales org xx60 now in Jan 2009 they have seized this company code 5610 and sales org xx60 and started operations on 5310 with sales org xx70 Now for business reasons (self billing) the

  • Losing control of input in browser - 2 laptops on same network

    Hello Forum, We have had a sudden worrisome problem.  It has apparently been an off and on problem affecting my partner's MacBook Pro (purchased Fall, 2011) for at least a month now.  The first time it affected my system (MacBook Pro, purchased last

  • Problem: Oracle auditing and Coldfusion pages.

    Oracle 10g has robust auditing functionality.  If you want to see who is inserting records into account.staff, you issue this command. audit insert on account.staff by access; It's done.   All inserts into the table are tracked by Oracle automaticall

  • Customer correspondence

    hi gurus when i am generating customer balance confirmation report; it is picking all the customers within that range. my problem is for ZERO BALANCE customers also report is getting printed. to avoid this what i have to do? kindly help me in this re