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
Similar Messages
-
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=""">
</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 -
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
-
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 advanceHi,
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
Lukesb92075 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,
KumarREPORT 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... -
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 input via MM01
How can we do count of records input via MM01?
Thanks,
APHi,
it depends of using MM01.
MARA, MARC, MARD, MVKE etc.
regards, Dieter -
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? -
Showing Dimension counts for record results.
Hi experts,
In my application, I want to show dimension counts for record results. Support results contains 50 records, Out of 50 records, with Color=Red has 15 records. Therefore I want to display the Red Color results as -
Color:
Red (15)
Silver(5)
Like wise for other dimensions as well. As per the Endeca documentations, I guess "Drs" parameter is there to achieve it. If this is true then can you guys explain how the required functionality can be achieved using endea_jspref application . Or using presentation api, what kind of code should be written.
Any input/ideas will be highly appreciated.
Regards,
HoqueHi,
in my code level i used like below to display num of records
if you use RefinementMenu cartridge(in jsp RefinementMenu.jsp) you will get refinements in that content.
<c:forEach items="${content.refinements}" var="refinement">
<li>
<dsp:include page="/renderNavLink.jsp">
<dsp:param name="navAction" value="${refinement}"/>
<dsp:param name="text" value="${refinement.label} (${refinement.count}) "/>
</dsp:include>
</li>
</c:forEach>
in above ${refinement.label} :: means the lable name(color:red,silver) and
(${refinement.count}) :: means the no of records it has( red(10), silver(12))
in renderlink.jsp i used to render content or navigation based on your click(red or silver)
i think so it may help you from endeca Stuff.
Regards
Y.V.L -
How i will find out count of record
there is a table emp.it consist two column CODE ,COUNTRY. has value like
1, india
1,china
1,japan
1,koria
2,india
2,china
2, japan
2,viatenam
2,finland
3,india
3,japan
3,china
3,america
3,russia
4, jermany
4,france
i want to see distinct count of record which consist country 'india','china','japan'(a code which has all these 3 values). according to this value output should be 3 (1,2,3)Better suited for PL/SQL forum and here is my attempt at solving this.
SQL> with datatab as (select 1 code, 'india' country from dual
2 union all
3 select 1,'china' from dual
4 union all
5 select 1,'japan' from dual
6 union all
7 select 1,'koria' from dual
8 union all
9 select 2,'india' from dual
10 union all
11 select 2,'china' from dual
12 union all
13 select 2, 'japan' from dual
14 union all
15 select 2,'viatenam' from dual
16 union all
17 select 2,'finland' from dual
18 union all
19 select 3,'india' from dual
20 union all
21 select 3,'japan' from dual
22 union all
23 select 3,'china' from dual
24 union all
25 select 3,'america' from dual
26 union all
27 select 3,'russia' from dual
28 union all
29 select 4, 'jermany' from dual
30 union all
31 select 4, 'france' from dual)
32 select distinct a.code from datatab a
33 where 3 = (select count(code) from datatab b where a.code =b.code and b.country in ('india','china','japan'));
CODE
1
2
3
3 rows selected.
Maybe you are looking for
-
Vendor Report G/L and open item wise
hello all, I need to execute a vendor (for bulk vendor) report with following data/field, please suggest. Vendor Code Vendor Name G/L code G/L description Balance Open items I tryed with FBL1N, FBL3N but
-
Mapping Problem with IDOC HRMD_A05
Hi All, When i am mapping source structure with IDOC HRMD_A05 i am getting Mapping not sufficiently defined... The idoc is used to change the address of employee(infotype 0006).. my source structure is EMPADDR_MT EmpAddr1 Trans_INFTY * Ad
-
Trying to recover metadata from a lost DB
Hi: We lost a DB instance and cannot recover. Ops replaced the broken disks and restored datafiles from backup, but "recover datafile..." for a specific datafile fails with OAR-01113 (file 89 needs media recovery). It calls for a file called arch1_12
-
Rename State Service Database in SharePoint 2010
As the title says, I want to rename/change database for State Service Application. I did some experiments wit it as suggested by others but I think I somehow managed to broken my service. I can SharePoint Products Configuration again and I got anothe
-
How do I burn a DVD on my mac air and be able to loop it in a dvd player
What program can I use on my mac air to burn a dvd that I will be able to loop on a dvd player