Record count of all DSOs
Hi Experts,
Does any one have an idea as to
how to get the record count of all DSOs in one shot?
Regards
Dipali
Tran ST14 allows you to run a background program that captures data on the 30 largest ODS. Might be able to run it, or use the program it runs as a starting point for a Z version. It also produces other lists 30 largest cubes, E anf F fact tables, dimension tables, PSA, master data, etc.
This alignment of the sample below isn't quite right, but it gives you an idea of the output:
Logical Name (BW) Active Data Active Data Activation Queue Activation Queue Rollback Rollback Changelog Changelog Changelog Total Size Growth RSDBEXFL LASTUSED TXTLG ODSOTYPE
Size (KB) records Size records Size records Name Size (KB) records (KB) (KB)
ZPU_O52 223084800 270319290 128 72020 0 0 /BIC/B0000357000 1898496 3020700 224983424 0 X 20080903190013 Line Items in Funds Management
ZSL_O52 164580224 285739820 128 215490 0 0 /BIC/B0000558000 3041280 5548000 167621632 0 X 20080903135047 Special Ledger Details
ZGL_O_02 94384640 253558550 128 394820 128 0 /BIC/B0000595000 2469888 5227867 96854784 0 X 20080903180839 General Ledger: Line Item Detail
PU_O32 72226624 114269900 128 13880 128 0 /BIC/B0000325000 1768448 3172567 73995328 0 0 FI Line Items in Funds Management (IS-PS)
ZARS_O70 65613632 131033900 128 0 128 0 /BIC/B0000537000 2744320 5117567 68358208 0 X 20080828130735 Activity-based Reporting
PU_O33 49556224 107794700 128 44533 0 0 /BIC/B0000327000 1468416 2495200 51024768 0 0 CO Line Items in Funds Management (IS-PS)
ZCBP_CON 7841792 11669800 128 13550 128 0 /BIC/B0000958000 9650176 15398900 17492224 0 X 20071114174148 COPY OF ZBBP_CON
ZAP_O_02 15391808 27049480 128 42380 0 0 /BIC/B0000594000 569344 817460 15961280 0 X 20080903190031 Accounts Payable - Vendors: Line Item Detail
ZCBBP_PO 6334464 9345900 128 11493 128 0 /BIC/B0000957000 9124864 14334000 15459584 0 X 20080818174802 Copy of 0BBP_PO
PU_O31 12421696 21020500 128 13123 0 0 /BIC/B0000310000 607232 1183300 13029056 0 0 Commitments Line Items in Funds Management (IS-PS)
ZAP_OTW1 10814208 28065630 128 1091100 128 0 /BIC/B0000608000 957440 2711567 11771904 0 X 20080903110025 Accounts Payable: Treasury Warrant Info
ZSEM_O51 6937344 17585900 128 0 128 0 /BIC/B0000584000 4678784 12101200 11616384 0 X 0 Complement Data for Costing
BBP_PO 991232 0 128 0 128 0 /BIC/B0000167000 128 0 10116480 0 0 Purchase Order - Single Documents
ZCBP_INV 3613696 5889633 128 7167 128 0 /BIC/B0000959000 4551680 6404367 8165632 0 X 20071114161251 COPY OF 0BBP_INV
ZPU_O51 7032896 14555300 128 2093 128 0 /BIC/B0000352000 160768 392960 7193920 0 X 20080903141737 Budget in Funds Management
ZSEM_O52 3749952 17608900 128 0 128 0 /BIC/B0000585000 2978944 10656100 6729152 0 X 0 Complement Cost Data from HRV1018
ZSLGS_O1 2781184 5666200 128 18360 128 0 /BIC/B0000841000 3241984 6964467 6023424 0 X 20080903145240 FISL: SRM Global Spend Detail
BBP_DS1 5011456 5870533 128 18070 128 0 /BIC/B0000198000 548864 846330 5560576 0 0 Actual Value for Purchase Order -Single Documents
ZIC_O03 4332096 9217400 128 10477 128 0 /BIC/B0000587000 45056 91627 4377408 0 0 ODS Material Stocks / Movements
BBP_SC 1542400 1493100 128 19663 128 0 /BIC/B0000733000 119808 382750 2363904 0 0 Shopping Cart - Individual Documents
ZRR_O01 290816 781850 128 1263 0 0 /BIC/B0001007000 1815552 4045433 2106496 0 X 20080211170935 Revenue & Refunds DSO
BBP_DOC 797184 1359533 128 6978 128 0 /BIC/B0000732000 481280 51307 1278720 0 0 Document Flow - Single Documents
BBP_CON 1227776 0 128 0 128 0 /BIC/B0000194000 128 0 1228160 0 0 Goods/Services Confirmation - Single Documents
ZAR_O_02 840960 1288300 128 1427 128 0 /BIC/B0000593000 132096 199870 973312 0 X 20080711125812 Accounts Receivable - Customers:Line Item Detail
SRPO_D1 311296 375290 128 6176 0 0 /BIC/B0001036000 384000 500900 695424 0 0 Purchase Order History
ZSLFM_O1 542720 2404400 0 0 0 0 /BIC/B0000666000 128 0 542848 0 0 Expenditure Estimation - FM T
BBP_INV 461824 0 128 0 128 0 /BIC/B0000196000 128 0 462208 0 0 Invoice - Single Documents
ZSL_O3 458752 2430400 0 0 0 0 /BIC/B0000670000 128 0 458880 0 0 Expenditure Estimation - SL Data T
ZPM_O51 196928 755080 128 0 128 0 /BIC/B0000894000 159744 703770 356928 0 X 20080507175910 Plant Material Valuation History
ZGL_O3 235520 2422767 0 0 0 0 /BIC/B0001041000 128 0 235648 0 0 Expend Est - GL Svc Dt T
There are DB dictionary views that contain this info as well, some of which is copied ot SAP tables. If you have Oracle DB, look for a table DBSTATTORA.
Similar Messages
-
Get records count of all tables
Hi ,
I am trying to get the record count of all tables using dynamic query. I don't know how to put the value in placeholder. I tried the below code.
SET SERVEROUTPUT ON SIZE 1000000
DECLARE
CURSOR table_list
IS
select OBJECT_NAME from user_objects
where object_type in ('TABLE')
and object_name not like '%AUDIT_DDL%'
AND object_name not like 'MD_%'
AND object_name not like 'EXT_%'
AND object_name not like 'STG_%'
AND object_name not like 'SYS_%'
AND object_name not like 'TMP_%'
AND object_name not like 'TEMP_%'
order by 1;
v_count NUMBER :=0;
query_str VARCHAR2(1000);
BEGIN
FOR table_name IN table_list
LOOP
query_str :='SELECT COUNT(1) FROM ' || table_name.OBJECT_NAME;
dbms_output.put_line(query_str);
dbms_output.put_line('Table Name:' || table_name.OBJECT_NAME );
v_count:= execute immediate query_str;
dbms_output.put_line('Table Name:' || table_name.OBJECT_NAME || ', Count ' || v_count );
END LOOP;
END;
I know I am doing wrong in the bold lines. But not sure how to fix it. Please help. Thanks in advance.Hi,
Welcome to the forum!
What you posted is basically right, assuming you really want to do dynamic SQL t all.
The only problem with
961618 wrote:
query_str :='SELECT COUNT(1) FROM ' || table_name.OBJECT_NAME; would be if the object name included special characters (such as single-quotes) or lower-case letters. To avoid any possible problems, I would put the object name inside double-quotes:
... query_str := 'SELECT COUNT (*) FROM "' || table_name.OBJECT_NAME
|| '"';
v_count:= execute immediate query_str;
The correct syntax is
execute immediate query_str INTO v_count;V_count will be the number of rows in a single table. Keep another variable (say total_v_count) that keeps the total count so far.
Do you really need dynamic SQL?
SELECT SUM (num_rows) AS total_rows
FROM user_tables
WHERE table_name NOT_LIKE '%AUDIT_DDL%
AND ...
;gets the same information, accurate as of the last time statistics were gathered, and some of the numbers may be approximate. Depending on how you use the results, that may be good enough for you. If you actually have 10,000,123 rows, and the query says you have 10,000,000, does it really matter? -
Query to display all records count of all tables in a schema
Hi,
I need to count all the records of all my tables in a certain schema and display the max amount of the record count. Do you have a script for this one??SQL> create function countrec(in_tab in varchar2) return number is
2 retval number;
3 begin
4 execute immediate 'select count(*) from '||in_tab into retval;
5 return retval;
6 end;
7 /
Function created.
SQL> select table_name, countrec(table_name)
2 from tabs;
TABLE_NAME COUNTREC(TABLE_NAME)
QUERY_TOOL_DATA_COLLECTION 5
TEST01 0
T1 14
EMP 14
SALGRADE 5
FILES 0
PROVA 0
TEST 0
T_MASTER 1
T_CHILD 3
TAB_ONE 30
TAB_TWO 10
A 3
B 4
C 3
D 3
BONUS 0
DEPT 4
18 rows selected.Max -
Not all records are updated in DSO
Dear Friends
My Scenario is SAP - FM -> DataSource -> InfoPackage -> DTP ->Transformation - > DSO.
I have 896 Records in my PSA , but when I run DTP to load the data in DSO only 817 records are added, rest records are not updated. I have supplied
Purchasing organization 0PURCH_ORG
Purchasing Group 0PUR_GROUP
Vendor 0VENDOR
BW: Document Number 0DOC_NUM
BW: Document Item Number 0DOC_ITEM
Material 0MATERIAL
Accounting document number 0AC_DOC_NO
Item in Material Document ZZEILE
as key fields of DSO.
can you suggest me what could be possible reason for not having all the records.
Regards
NaimHi,
is it full load?
Have you applied any filters at dtp level?
if its full load then delete whole psa data and dso data.
reload them again and see the count.
As per dso primary keys, same combination data will over write it.
how many records count you see at dso-->manage-->request tab
Added and transferred.
Thanks -
Query in SQL to display count of all records but where condition is present
Hi All,
I have situation where I need to display count of all records all particular period but in where condition type condition has to be present :
Please find the below sample data :
PERIOD_ID TYPE MV_COUNT IS_FLAG
20110401 AM 1 0
20110401 AM 1 0
20110401 MS 29 0
20110501 MS 1 0
20110601 MS 14 0
20110701 MS 2 0
20110401 MS 1 0
20110401 AM 2 0
20110401 AM 69 0
20110401 AM 2 0
finally I need for type = MS
i) total is_flag count for all the periods
ii) for period=20110501 what is the mv_count
I need to use the table single time (ie not self join outer joins )
I have tried to use partition by clause but it will filter out the data .
Cheers,
Sp842106 wrote:
finally I need for type = MS
i) total is_flag count for all the periods
ii) for period=20110501 what is the mv_count
I need to use the table single time (ie not self join outer joins )
I have tried to use partition by clause but it will filter out the data .
select sum(is_flag) is_flg_count,
sum
case when period = 20110501 then mv_count else 0 end
) mv_cnt_for_20110501
from your_table
where type = 'MS'; -
How to get count of all records of all entities in CRM Online
Hi,
I want to get count of all records entitywise in dynamics CRM 2013 online. I know we can count the records in CRM on-premise using a SQL query in report. Earlier I wrote a SSRS report to count the records in a CRM entity wise as displayed in
the screenshot below..
Can someone suggest me a good approach to implement the same in CRM Online.
Thanks
Pratibha SinghHello,
In a CRM Online environment, you need to create reports based on Fetch XML. Take a look at this link to create a Fetch XML query with aggregates: https://msdn.microsoft.com/en-us/library/gg309565.aspx?f=255&MSPPError=-2147217396#count .
Here is an example to create a report in an online environment: http://edwardsdna.com/2012/12/03/crmonline-report/
Hope it helps,
Kind regards -
Report with all Data Targets in Production and Record Count
Hi,
I am planning to create new report to handle some production maintenance work.
How do I create a report with list of each ODS and Cube and count of Active record count? Can I use any report in BW statistics and modify based on my requirements?
And also "Last Activation Date" is required.
Any suggestions? Please do let me know.
Thanks
Anand.Hi,
The load might be taking too mucjh time as the system is busy.
wait for some time (30 mins) and see if the load goes thru
The load might have strucked up.
Change the request to red and reload data.
after doing initwith out data load, Run Delta.
Cheers,
Srinath. -
Data Load : Number of records count
Hi Experts,
I want to document number of records transferred to BW during an infopackage execution.
I want to automate the process by running a report in background which will fetch a data from SAP tables about number of records been transfered by all my InfoPackage .
I would like to know how should I proceed with.
I want to know some System tables which contains same data as that of RSMO transaction displays to us.
Kindly help with valuable replies.HI,
inorder to get the record counts report you need to create a report based on below tables
rsseldone, rsreqdone, rsldpiot, rsmonfact
Check the below link which explain in detail with the report code as well.
[Data load Quick Stats|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/90215bba-9a46-2a10-07a7-c14e97bdb764]
This doc also explains how to trigger a mail with the details to all.
Regards
KP -
Invalid record count - grey screen- Target Mode Cures
Hi there,
I have a common problem: I was doing nothing particular that I remember: No fancy file uploads, doanloads, creation, erasing - nothing special:
Anyway after a customary week, or few days of leaving the macbook permanently on, I think "let's give it a rest".
Then switch back on:
- Grey screen, spinning grey progress wheel fine.
- Takes a while. Strange. After say a minute - it just switches off wordlessly.
- Reset PRAM: No solution. Take a look with single-user startup in console: Files are all there, OK. Disk not dead.
- Start up from OS X 10.5 disk:
Permissions repair fine. Good.
Verify disk: FAIL! +*Invalid Record Count.Volume check failed.*+
Next: *Try target disk mode to back up essentials* - that works fine: I now have Time Machine AND a smaller important essentials backup.
But finally, here's the surprise: Just for kicks, I *shut the macbook down, try a reboot - and it works!*
But I note that root system files are unchanged since the problem occurred: ".hotfiles.btree" for example (I don't know what that is but suspect it's relevant).
Then: I tried restarting again - and back to square one, it won't boot.
Do the "Target disk" firewire mode trick again, and browse a few folders: And it boots (slowly).
If I just leave the Macbook on permanently - everything seems fine. Not even sluggish.
So:
- Why can connecting a disk with an incorrect file system in target disk make the system forget about these problems when booting?
- Why does the problem return on a successive reboot?
- Is it related to some system files being ignored if booting straight after a target mode session?
- What is ".hotfiles.btree", and should it not exist ?
And the big one:
- +Can extended Applecare, wot cost me loads of money, help me?+Hi Cornelius:
Having been a faithful Apple-groupie for a while, and despite some problems over the years (hard drive failing, screen going, etc.) this is the first time I'm disappointed with them, because theor Micromat Applecare deal is a ripoff:
You fork out for Applecare extension: All you get is something that say "Yep, you've got a problem. Now go and buy techtoolpro".
That is, the TechTool Deluxe is practically useless. Argh.
Worse: They keep that rather quiet. If you run TechTool deluxe, and it fails: It points you to the Techtool site to
"download the TechTool Deluxe software with diagnostic and repair capabilities".
You think "Aha, right, I need an update, or a DMG rather than just the executable".
Download another 1.25Gb.
So you try again: Same thing.
The chiselling little crooks, to quote Ken Livingstone, won't even come out and say "Buy TechTool Pro to fix it". The website as reported above is wrong.
Result: I'm not happy with them. And I'll never buy anything off Micromat.
In the meantime, I've got a bootable backup thanks to CC-Cloner (excellent, I'll send him some money), and I'm waiting until I don't have any critical deadlines to allow myself time to restore a daily bootable backup.
The dodgy files seem to be the Sun Developper Java suite according to CC Cloner. -
How to find Maximum Record Count in a particular section
Hi ALL
My report has 3 detail sections. I am showing different set of data in each section.
Example:
Details a
Details b
Details c
In the Details c section I have 5 columns.
I want to find out MAXIMUM RECORD COUNT in only Details c.
Actually I have done a running total on column1 field which gives me the records number in that section only. But I am not able to find the MAXIMUM record count.
Rtotal Colum1 Column 2 Column3
1 Data1 Data2 Data3
2 Data1 Data2 Data3
3 Data1 Data2 Data3
4 Data1 Data2 Data3
Now I need the Maximum record count=4
Thanks.If I have understood correctly you want to count the amount of records in each section.
In this case, go to "Insert > Summary", choose your ID field, and choose "Count" in "Calculate this summary:". You can put the summary in your group footer.
If you want the maximum (the highest number value in that column), you can choose "Maximum" instead of "Count". -
Records count in Receiver File Adapter
Hi All,
I have a scenario IODC to File. The requirement is to get the total record count in the Trailer record of the Target File .Please help.
Regards,
KevinHello,
The requirement is to get the total record count in the Trailer record of the Target File
In your XML, decide which IDOC field you get your records from and then do a similar mapping
IDOC field -> removeContext -> count -> TrailerRecordfield
Hope this helps,
Mark -
What event should I use to grab the record count of a DataGrid?
I have a "Go" button on a search form. It works correctly, fetching records from a CF data service into a data bound DataGrid. However, using the code shown below, the record count always shows zero. I've tried putting the "..Provider.length" line shown below, into various events on the grid, so that it will always update the count at the correct time, but I get "null" object errors at run time. There seems to be no event that fires "AfterDataLoad".
protected function btnGo_clickHandler(event:MouseEvent):void
getSBJsResult.token = baa_data_svc.getSBJs(cmbSrch.text);
tabSbjs.label = 'Subjects: ' + grdSBJs.dataProvider.length; // This always returns zero. Why?For example, this doesn't work. The grid is told to loaded data on line 1, but this must just be only a message send to the Flash Player 10, because the processing doesn't stop and wait for the loading of data to complete, it just continues on to line 2, at which point '...Provider.length' is always zero the first time through. So... the NEXT time the user clicks the Go button, line 2 is processed for the DataGrid which is holding data from the PREVIOUS search, so it updates the tabSbjs.label with the count from the previous search, not the current search. The count of records is always for the previous data set.
protected function btnGo_clickHandler(event:MouseEvent):void
1 getSBJsResult.token = baa_data_svc.getSBJs(cmbSrch.text); // edtSrch.text
2 tabSbjs.label = 'Subjects: ' + grdSBJs.dataProvider.length;
All I'm trying to do is (which seems like a very difficult thing to do in FB4):
-Display a DataGrid popluated with data records
-Display a count of how many records are in the data grid
If I rely on CF9 functions, which can only return a single value, then I have to make two CF9 functions, with the exact same SQL, one that returns data, and one that returns a count of the records.... which is non-sensicle.
There must be a simple way to do this, but I'm going around in circles. -
Problem in getting correct update records count while getUpdateCount()
hi,
I have used "Select in Insert" queries for migrating data from one table to another.
like
INSERT INTO TABLE1 (COL1, COL2)
SELECT COL1,COL2,... FROM TABLE2
WHERE COL1 = ... AND COL2 = ...;
Case 1:
I added these statements as addBatch() & at the end i execute method " executeBatch()".
Then i execute
getUpdateCount() method
on that prepareStatement ,but that count was not correct all the time.
Case 2:
If i run the same code with executeUpdate() method , it returned me the correct number of records counts that are inserted into the table.
I cudn't able to understand that it is failing for case1.
Can anybody tell the reason for this behaviour .......................
Edited by: user11187328 on Mar 18, 2010 4:52 AMhi,
Thanks again for a correct reply but can u also tell me tht which jar i needs to included.
There are so many jar files & should i remove old jar files or jvm auto picks the updated jar file.
Following jar files are shown on the link:::
ojdbc5.jar (1,996,228 bytes) - Classes for use with JDK 1.5. It contains the JDBC driver classes, except classes for NLS support in Oracle Object and Collection types.
ojdbc5_g.jar (3,081,328 bytes) - Same as ojdbc5.jar, except that classes were compiled with "javac -g" and contain tracing code.
ojdbc6.jar (2,111,220 bytes) - Classes for use with JDK 1.6. It contains the JDBC driver classes except classes for NLS support in Oracle Object and Collection types.
ojdbc6_g.jar (3,401,519 bytes) - Same as ojdbc6.jar except compiled with "javac -g" and contains tracing code.
ojdbc5dms.jar (2,429,777 bytes) - Same as ojdbc5.jar, except that it contains instrumentation to support DMS and limited java.util.logging calls.
ojdbc5dms_g.jar (3,101,875 bytes) - Same as ojdbc5_g.jar, except that it contains instrumentation to support DMS.
ojdbc6dms.jar (2,655,741 bytes) - Same as ojdbc6.jar, except that it contains instrumentation to support DMS and limited java.util.logging calls.
ojdbc6dms_g.jar (3,423,263 bytes) - Same as ojdbc6_g.jar except that it contains instrumentation to support DMS.
orai18n.jar (1,656,280 bytes) - NLS classes for use with JDK 1.5, and 1.6. It contains classes for NLS support in Oracle Object and Collection types. This jar file replaces the old nls_charset jar/zip files.
demo.zip (603,363 bytes) - contains sample JDBC programs. -
Oracle 10g - Insert in to Temporary Table - Record count mismatch between s
We are trying insert records from a select query in to temporary table, some of the records is missing in the temporary table. The select statement is having multiple joins and union all which it little complex query. In simple terms the script contains 2 part 1st Part Insert in to temporary table 2nd part Select query with multiple joins, inline sub queries, unions and group by classes and conditions
Eg. If we execute select statement alone it returns some count for example => 60000 After inserting into the temp table, in temp table the count is around 42000 why is the difference?
It is simple bulk inserts... insert in to temp table select from xxx. also, there is no commit in between. The problem is all the records populated by the select statement are not inserted in to temp table. some records are not inserted.*
Also, we had some other observation. It only happens in its 2nd execution and not its first run. Hope there might be some cache problem
Even, we also did not believe that. We are wondering. In TOAD, we tested however at times it happens. In application jar file, after "insert in to temp select * from xxx" we take the i. record count of temp table and ii. record count of "select * from xxx" separately but both doesn't match. Match only at 1st time.
Thank you in advance for your efforts and help.
Shiva.The code looks like
sql = "insert in to temptable select x,y,z,.... from xxx,abc,pqr..where...."; (logial but not real is very complex around 700 lines with multiple joins, inline sub queries, group by etc. )
stmt = conn.createStatement();
rCount= stmt.executeUpdate(sql);
Actual issue is
rCount = xxxx = Count(temptable) < count(select x,y,z,.... from xxx,abc,pqr..where....)
why this diffference ? some records populated in the select but not inserted in to temp table
Anyone can explain? -
Record counts by hour,day - report
Record count, grouped by day, hour
Intended output:
DATE | 00:00 | 01:00 | 02:00 | .....
07-21-2011 | 100 | 200 | 300
07-22-2011 | 500 | 0 | 200
The below returns a version, but it doesn't account for when there are no records for a given hour.
I've created a successful script, but it involves too many subqueries, and is an abmonination
Any help would be awesome!
(any table with a date field will work)
with
hrly_ttls as
select to_char(sdate,'YYYY-MM-DD') as dte, to_char(sdate,'HH24') as hr,
count(*) as cnt from df_audit_batches
group by to_char(sdate,'YYYY-MM-DD'),to_char(sdate,'HH24')
select dte,
max(ltrim(sys_connect_by_path(cnt,' '),' ')) keep
(dense_rank last order by level) as Ttls
from (
select hrly_ttls.*, row_number() over(partition by dte order by hr) as rn
from hrly_ttls
start with rn = 1
connect by prior dte = dte
and prior rn = rn - 1
group by dte;
==> returns
DTE TTLS
2011-07-01 2 1 1 1
2011-07-02 1 2 1 1Hi,
Welcome to the forum!
Whenever you post a question, please include CREATE TABLE and INSERT statements for some sample data. That way, people who want to help you can re-create the problem and test their ideas. Also post the results you want from that data. Simplify if possible. For example, if you need a query for all 24 hours in a day, you can post a question that only has data and results for maybe 3 hours. Adapting the result should be easy.
Always say which version of oracle you're using.
Since this is your first post, I'll post some sample data for you:
CREATE TABLE df_audit_branches
( sdate DATE
INSERT INTO df_audit_branches (sdate) VALUES (TO_DATE ('21-Jul-2011 00:00', 'DD-Mon-YYYY HH24:MI'));
INSERT INTO df_audit_branches (sdate) VALUES (TO_DATE ('21-Jul-2011 00:01', 'DD-Mon-YYYY HH24:MI'));
INSERT INTO df_audit_branches (sdate) VALUES (TO_DATE ('21-Jul-2011 02:02', 'DD-Mon-YYYY HH24:MI'));
INSERT INTO df_audit_branches (sdate) VALUES (TO_DATE ('22-Jul-2011 01:40', 'DD-Mon-YYYY HH24:MI'));And the results you want from that data might look like this:
DAY TXT
21-Jul-2011 2 0 1
22-Jul-2011 0 1 0In the real problem, of course, you would need 24 "columns" in txt, not just 3.
To include all hours, even if there is no data for a particular hour, do an outer join to a "table" (I used a sub-query, all_hours, not a real table) that has one row per hour.
Here's one way to do that:
WITH got_cnt AS
SELECT TRUNC (sdate) AS day
, TO_CHAR (sdate, 'HH24') as hour
, COUNT (*) AS cnt
FROM df_audit_branches
GROUP BY TRUNC (sdate)
, TO_CHAR (sdate, 'HH24')
, all_hours AS
SELECT LEVEL AS n
, TO_CHAR ( LEVEL - 1
, 'FM00'
) AS hour
FROM dual
CONNECT BY LEVEL <= 3 -- or 24, for the real query
SELECT c.day
, REPLACE ( SYS_CONNECT_BY_PATH ( TO_CHAR ( NVL (c.cnt, 0)
, '999'
) AS txt
FROM all_hours h
LEFT OUTER JOIN got_cnt c PARTITION BY (day)
ON c.hour = h.hour
WHERE CONNECT_BY_ISLEAF = 1
START WITH h.n = 1
CONNECT BY h.n = PRIOR h.n + 1
AND c.day = PRIOR c.day
ORDER BY c.day
;This will work in Oracle 10.1 (and up).
Maybe you are looking for
-
Calendar template in obiee 11g
Hi All, Is there any calendar template/add on in obiee 11g? So in calendar we can set the schedule for sales, etc. If there is any, how to use it? Thank you before Regards JOE Edited by: JoeSSI on Jul 26, 2012 7:54 PM
-
Problem with iText pageEvent.
I am creating a PDF document using iText and writing some tables to it. On page end event of PDFWriter I am creating footer. method :onEndPage(PdfWriter pdfwriter, Document document) My problem is that this event is getting called twice. so some tabl
-
Which is better storing string values in Map or String buffer
Hi, I have a store a 10 string values in a cookie. Do i use a String buffer and append all values or put it in a hash map. If i put in a string buffer i have to use a string tokenizer to loop and extract the values., but if i am using a map then retr
-
Switchover_status "FAILED DESTINATION" on both primary-standby databases
Hi, I setup primary-standby databases and try to test the switchover functionality between them using the following commands: alter database commit to switchover to primary with session shutdown; alter database commit to switchover to physical standb
-
Mpeg 2 23.50???
Good Day, I saw a thread that kind of maybe answered this but I want to word it my way and really make sure because I find this rather weird: I have a 23.98 video, 4 minutes long. It's a DVCPROHD Quicktime file. I am trying to create an Mpeg2 for bro