Total number of lines, separate column count
HelloI am looking for a procedure that inserts following data columns:
Table_name Column_name COUNT (*), count (DISTINCT column_name)
EX: Employee 5000 4500 emp_name
Employee 5000 10 emp_location
I want this for the entire schema.
I have a procedure that gives me count (*), but I am not able to write a procedure to count (DISTINCT column_name)
If anyone can help me, that would be really helpful
Thank you
Hello
Yes, you certainly want to use all_tab_cols, since you need the column names.
The error seems to come from the EXECUTE IMMEDIATE statement, then put in comment declaration. Highlight the text that you run in a variable, as I showed you before, and use dbms_output.put_line see what dynamic types of SQL statements are produced. If you see no errors, after a few lines of the output produced by put_line and the results of the execution of these same SELECT statements manually.
Tags: Database
Similar Questions
-
display the Total number of lines in the first page of the report
Hi, in obiee, paging will be 1-25. Is there any possibility in obiee to display the total number of lines next to paging. Ex: If the result contains the 120 lines. It should show after paging
Documents 1-25. Total records: 120User,
If this is the very simple case go in narrative display
In the Narrative section give
No.Of.Records: @4
in my case is 4th column: No.Of.Records where fx = max (rcount (1))
GoTo Compound display click the button Add and align narrative view down to see table
Thank you
Saichand.v -
How to get the total number of lines workbook Table Page-Details
Hi all
I built a workbook Page-detail Table. In addition, my section of the page is 'user of assets '. Then, when I click the users button, it shows me, credit notes different from the user that I was selected. The problem is that I want to show a percentage by user.
For example:
-------------------
The query returns me assets 40 for all users.
But for example I click the first user who has only 10 credit notes.
I want to show at the end of the page: "this user is:" 25% (because I calculate 10 * 100/40). "."
How can I do this? Because I found that I can show the number of lines that are in the screen, but not the total of the lines referring to my request.
I use Oracle Desktop, but I have no problem using Oracle Discoverer Plus.
I really appreciate your help.
Best regards!
Mariano. -.You can do it directly in the front as you wish but you can manipulate the spreadsheet to do something like.
By creating a calculation that will contain the data you need you can then present in the page point right next to the user name.
If you change the user in the page element, it will present the % that you wanted.do that create a new calculation, called "is the percentage of this user:
To_char (COUNT (credit memos) OVER (PARTITION BY User) * 100/COUNT(credit memos) OVER (), '990D99'). « % »Place the calculation in the page element.
There is a small restriction since if you just change the user it will work fine, but if you pick the design value, then you will get a mess.
Beside that, you can use the 'text area' of the discoverer and put for example here: (exactly the name of the calc) "& is the percentage of this user.
Well, it's not perfect, but maybe it can be used...
-
Sort sort the columns number of lines n columns in the RTF PivotTable but hide them.
Hello
I'm trying to sort on the columns number of sort for lines n columns in the PivotTable but hide them. Any help appreciated.
Attached model RTF, XML and output required. Thank you
Please check your email that I have forwarded to update the model.
by default, it performs a sort on the column, we used to pivot rows and columns. If we need custom sort, we must specify that column in the logic that was present in the C form field.
by default, you are as below
Custom sort
{INDUSTRY_sort, o = a, t = n} « ; » MONTHS {Month_sort, o = a, t = n} '; SALES '; "' sum '? >
-
Add a table with the number of lines and columns JS
Hello
Simple question: what is the syntax for adding a table with a specified number of rows and columns? I don't get it. (I don't know how to add them later, but I want to do when I create the table). Here is the entry in the ESTK:
Tables.Add (to: LocationOptions, reference: all, withProperties: Object): array
Creates a new table.
(optional): Data Type: LocationOptions, by default: LocationOptions.UNKNOWN
The location of the new table to the object within the container object or reference. (Optional)Reference: Data Type: no
The reference object. Note: Required when the value specifies before or after. Can accept: Table, XmlStory, XMLElement, TextFrame, text, character, Word, line, paragraph, TextColumn, PointInsertion, story, cell or TextStyleRange. (Optional)withProperties: Data Type: object
Initial values for the properties of the new Table (optional)Thank you
Ariel
After much experimentation, I found this works:
t = app.selection [0].tables.add (LocationOptions.AT_BEGINNING, undefined, {columnCount:2, headerRowCount:1, bodyRowCount:5, footerRowCount:3});})
-
Hi guys, am hoping someone can help with this query.
I have 2 tables
Search
----------
code VC2 (10)
Description VC2 (50)
domain VC2 (50)
MyTab
----------
hour date
VC2 status (10)
The data should be like this:
Search
----------
B, buy, Transaction
S, sale, Transaction
R, back, Transaction
O, old, to Condition
N, new, Condition
MyTab
---------
JANUARY 1, 2008, B
JANUARY 1, 2008, B
JANUARY 1, 2008, B
JANUARY 1, 2008, S
JANUARY 1, 2008, S
JANUARY 1, 2008, R
JANUARY 2, 2008, B
JANUARY 2, 2008, B
JANUARY 2, 2008, R
JANUARY 3, 2008, B
JANUARY 3, 2008, S
What I want to do, is go back a number of lines for each date in mytab, for each possible transaction situation, even if it's 0.
If the query returns
hour, status, County
----------------------------------
JANUARY 1, 2008, B, 3
JANUARY 1, 2008, S, 2
JANUARY 1, 2008, R, 1
JANUARY 2, 2008, B, 2
JANUARY 2, 2008, S, 0
JANUARY 2, 2008, R, 1
JANUARY 3, 2008, B, 1
JANUARY 3, 2008, S, 1
JANUARY 3, 2008, R, 0
So because there are 3 rows of transaction status in the lookup table, you always get 3 rows returned BY DATE in the table mytab.
Is it possible without using loads of trade unions?
Thank you!
Scott
Published by: Scott Hillier on November 5, 2008 15:24Nicolas-
I don't think that you need a self-join.
(my apologies for the bad formatting, cannot understand the syntax of the citation!)
with
list of choices like
(select code 'B', 'Buy' descr, area of "Transaction" of union double all the)
Select' code, descr 'Sell', 'Transaction' of all field double union
Select code 'R', 'Return' descr, area of 'Deal' of all the double union
Select ' o ' code, descr 'Old', 'Condition' field of dual union all
Select "n" code, descr 'New', 'Condition' field of the double),
MyTab as
(select to_date (January 1, 2008 "," MON-DD-YYYY "") transdate, status 'B' of all the double union)
Select to_date (January 1, 2008 "," MON-DD-YYYY "") transdate, status 'B' of all the double union
Select to_date (January 1, 2008 "," MON-DD-YYYY "") transdate, status 'B' of all the double union
Select to_date (January 1, 2008 "," MON-DD-YYYY "") transdate, the from ' Union status double all the
Select to_date (January 1, 2008 "," MON-DD-YYYY "") transdate, the from ' Union status double all the
Select to_date (January 1, 2008 "," MON-DD-YYYY "") hour, status of 'R' of all the double union
Select to_date (January 2, 2008 "," MON-DD-YYYY "") transdate, status 'B' of all the double union
Select to_date (January 2, 2008 "," MON-DD-YYYY "") transdate, status 'B' of all the double union
Select to_date (January 2, 2008 "," MON-DD-YYYY "") hour, status of 'R' of all the double union
Select to_date (January 3, 2008 "," MON-DD-YYYY "") transdate, status 'B' of all the double union
Select to_date (January 3, 2008 "," MON-DD-YYYY "") transdate, the from ' double status)
Select trunc (a.transdate), c.code, count (decode(a.status,c.code,1))
mytab a.,
Search c
where c.domain (+) = "Transaction".
Trunc Group (a.transdate), c.code
order of trunc (a.transdate);TRUNC (A.TRANSDATE) CODE COUNT (DECODE(A.STATUS,C.CODE,1))
------------------------- ---- --------------------------------
1 JANUARY 08 B 3
1 JANUARY 08 R 1
1 JANUARY 08 S 2
JANUARY 2 08 B 2
JANUARY 2 08 S 0
JANUARY 2 08 R 1
JANUARY 3 08 B 1
JANUARY 3 08 R 0
JANUARY 3 08 S 19 selected lines
-
Hello
I have a range of numbers from B2 - B11 until the G2 - G11. For example:
31
7
28
10
4
17
20
13
44
2
1
39
32
45
39
4
10
25
26
38
27
43
12
3
42
35
37
1
34
21
13
39
11
14
5
37
21
33
34
4
13
10
31
14
1
24
35
3
20
2
24
27
22
30
10
34
36
32
3
27
I would like to know who among these numbers have occurred and how many times. For example (just to have as an example): number 10 repetitions 5 times, number 13 repeated 3 times, 24 repetitions 9 times.
Repeats = duplicates.
I want to know all the repetitive number and how many times they repeat.
Is there some kind of formula I can use to get there. It would be good to have the sorted result. For example:
32 repeats 10 times
24 repeat 9 times
6 reps 8 times
5 repeat 7 times
22. repeat 6 times
10 repeats 5 times and so on.
Hello
Problem of three steps:
- Determine the distinct values
- Count the number of times each appears in the table
- Sort by value or frequency (or both).
The first step is easily handled by copy separate Automator Service, a Service of Automator, written by SGIII. A link to the file in post June 21 of the SG in this thread: Re: Analyzing column (maybe not the correct wording)
After downloading and installing the service, select the cells containing the numbers, call the service, and then select the first regular (ie. non-header) cell to a new table and the dough.
(The following assumes the new table has a header row, no column header, and you have selected - click - cell A2 before pasting.)
You will get a list of distinct numbers in a single column (A2 - A34, of your sample and support of note).
To count the numbers:
In this example, the existing table is named 'Table 1'
Enter the following formula in B2 the new table, and then fill up to the last line of the column B:
= COUNTIF (Table 1::B:G, A)
Results should be as shown:
Sort the results on column (value) or B (frequency)
Two types (A, then B) will be put in order of frequency, with values appear the same number of times sorted by value within this group.
Kind regards
Barry
-
How to get the total number of cursor in a counter
I am now using the meter control objects, I added 4 needles/cursors when the VI is offline, when I clicked on run, Labview is more allows me to add more needle, so control of the needle is not dynamic, there are several things I need to dynamically which means computer lets find and make a decision during the race :
1 know how many cursors are on the Panel?
2 Add/Remove one of the sliders?
3 redistribute all cursors?
I would use the node property to achieve this, but I don't how. Any help?
We cannot add hand/cursor to the object during execution of VI.
your needs from 1 and 3 can be made using the property node...
Use the property 'Display Digital []' to get/set the value of the slider.
Ganesan Kani
-
How to count the number or lines in the file
Hi Experts,
I'm file as source and Oracle as target. My folder that contains some data that will load the target.
My requirement is that I want to count the number of lines that contains my folder. Please help me how to count the total number of lines in the file.
THX,
Sara.Hi Sahaveda,
Now, I tried and it works.
Sorry my mistake again.
I created HR. ETL_FILE_LOG as below:
CREATE THE TABLE HR. ETL_FILE_LOG (numero_fichier varchar2 (10))
Below the code will run without error:
import java.lang as lang
import java.sql SQL
import of java.lang.String
Import os
disadvantages is sql. DriverManager.getConnection ("<%=snpRef.getInfo("DEST_JAVA_URL")%>", "<%=snpRef.getInfo("DEST_USER_NAME")%>", "<%=snpRef.getInfo("DEST_PASS")%>")
dblinks = cons.createStatement)
File1 = Open ('c:\EMP.txt','r')
Count = 0
Line = file1. ReadLine()
all online! ='' :
Count += 1
Line = file1. ReadLine()
File1. Close()
sqlQuery = "insert into HR. "The values of ETL_FILE_LOG (numero_fichier) (" + str (count) + ' ") '.
rqQuery = dblinks.execute (sqlQuery)
jerks. Close()
Concerning
-
Count the total number of rows found in the schema
Count the total number of lines present in the schema, including the table, sequence, view
Desirable output
Table sequence views
20 of 1000 1000Do you mean that you need to count the number of Tables, views and sequence present in the schema?
Hi something like that.
SELECT a.view_cnt AS "View Count", b.tab_cnt AS "Table Count", c.seq_cnt AS "Sequence Count" FROM (SELECT COUNT (*) view_cnt FROM USER_VIEWS) a, (SELECT COUNT (*) tab_cnt FROM USER_TABLES) b, (SELECT COUNT (*) seq_cnt FROM USER_SEQUENCES) c
Gives you,
View Count Table Count Sequence Count 153 878 32
Thank you
ShankarPublished by: Shankar Viji on August 28, 2012 03:03
-
How to count the total number of records with distinction?
Hello guys
I have a report that contains a list of the types of company and other attributes as follows:
The list goes on and... "Business type" appears is not the highest or the lowest... I would like to see what is the total number of different company types we have. By this report, there should be 5, but if I count or count (*) or rcompte, I actually get the total number of lines in the present report, which is not what I want...Shipto Company Type GC Code Measures A cc x 100 y 200 c 120 B YUT I 200 cc U 98 G Maid rt 200 YUT TT 300 JTE TY 400
If someone could help me to find the total number of company types?
Thanks in advanceHave you tried this one?
Sum (Count (distinct ColumnName))
-
Calculate the total number of the schema rowset.
Hi all
I use the oracle 10g database on windows server 2003.
I want to calculate the total number of lines in a pattern.
I have only one method to select just count (*) from each table within each schema.
because it doesn't matter what possible query that could calculate the total number of lines in a pattern?
Thank you.
Published by: Maahjoor on May 13, 2013 23:21Hello
Well, if you keep your cool failry statistics, you can get a very good grip on the number of lines through the NUM_ROWS in dba_tables column and then summarize the owner, on the top of my head:
select sum(NUM_ROWS) from dba_tables where owner like 'SCHEMA';
Do not forget that the number of lines shown this way will be the number of lines at the time of the last crawl (dbms_stats) has been run on the segment, so it may not always be equal to the number of the schema rowset did when running.
-
total number of rows in the result
Hello..
I have a query_x with columns Col1, Col2, Col3 following and would like to get the total number of lines for my query_x so
-Query_x
SELECT
Col1,
Col2,
COL3
Of
X, Y, Z
WHERE
...=..
Group
Col1,
Col2,
COL3
ThanxSQL> select empno, ename , sal, count(*) over (order by null) total_rows from emp ; EMPNO ENAME SAL TOTAL_ROWS ---------- ---------- ---------- ---------- 7369 SMITH 800 14 7499 ALLEN 1600 14 7521 WARD 1250 14 7566 JONES 2975 14 7654 MARTIN 1250 14 7698 BLAKE 2850 14 7934 MILLER 1300 14 7788 SCOTT 3000 14 7839 KING 5000 14 7844 TURNER 1500 14 7876 ADAMS 1100 14 7900 JAMES 950 14 7902 FORD 3000 14 7782 CLARK 2450 14 14 rows selected.
HTH
SS -
Bucketing lines by number of lines
OK, I've been struggling with this during long enough that I need to get other opinions!
I have these data similar to this:
I need to split the lines upward in buckets, based on a number of lines specified by bucket. For example. If the bucket was 80, I need to split lines into buckets so:with my_tab as (select 1 id, 100 cnt from dual union all select 2 id, 30 cnt from dual union all select 3 id, 50 cnt from dual union all select 4 id, 1 cnt from dual union all select 5 id, 102 cnt from dual union all select 6 id, 24 cnt from dual), results as (select /*+ no_merge */ id, cnt, sum(cnt) over (order by id) cuml_cnt from my_tab) select id, cnt, cuml_cnt from results; ID CNT CUML_CNT ---------- ---------- ---------- 1 100 100 2 30 130 3 50 180 4 1 181 5 102 283 6 24 307
That is to say. the cumulative returns as soon as the previous line is 80 or higher, and that triggers the start of a new bucket.. ID CNT CUML_CNT AMENDED_CUML_CNT BUCKET ---------- ---------- ---------- ---------------- ---------- 1 100 100 100 1 2 30 130 30 2 3 50 180 80 2 4 1 181 1 3 5 102 283 103 3 6 24 307 24 4
I thought to use ntile, but I need to be variable depending on the number of lines, and he kept complaining when I tried to use a column in a subquery as number of the ntile (having worked on the total number of lines / specified the number and the ceiling'd it), even if it could only be a single value! In addition, I don't think he will give me the results I want.
I have a sneaky suspicion that the type clause is what is needed, so I have to go offshore and of research, but I wonder if I'm missing something really obvious analytically. If it turns out that there the clause type, indications in this direction would be very appreciated!
ETA: I should add, it's on a 10.2.0.4 database.
Published by: Boneist on July 12, 2011 15:14Boneist wrote:
I would be really grateful if you could take a look at it and verify that I did not a stupid mistake!Seems good! No stupid errors found. A note about the setting: you can directly add the parameter to the partition clause so you do not need the subquery mt2.
SQL> var THRESHOLD number SQL> exec :THRESHOLD := 100 PL/SQL procedure successfully completed. SQL> with my_tab as (select 1 id, 100 cnt from dual union all 2 select 2 id, 30 cnt from dual union all 3 select 3 id, 40 cnt from dual union all 4 select 4 id, 5 cnt from dual union all 5 select 5 id, 6 cnt from dual union all 6 select 6 id, 99 cnt from dual union all 7 select 7 id, 1 cnt from dual union all 8 select 8 id, 1 cnt from dual) 9 select * 10 from my_tab 11 model 12 partition by (:THRESHOLD threshold) 13 dimension by (id) 14 measures (cnt, 0 cumulative_count, 1 grp) 15 ( cumulative_count[any] order by id 16 = cnt[cv()] + 17 case 18 when cnt[cv()] > cv(threshold) then 19 1/0 -- an error when the bucket is too small 20 when cnt[cv()] + nvl(cumulative_count[cv()-1],0) > cv(threshold) then 21 0 22 else 23 nvl(cumulative_count[cv()-1],0) 24 end 25 , grp[any] order by id 26 = nvl(grp[cv()-1],0) + 27 case 28 when cumulative_count[cv()] = cumulative_count[cv()-1] + cnt[cv()] then 29 0 30 else 31 1 32 end 33 ) 34 / THRESHOLD ID CNT CUMULATIVE_COUNT GRP ---------- ---------- ---------- ---------------- ---------- 100 1 100 100 1 100 2 30 30 2 100 3 40 70 2 100 4 5 75 2 100 5 6 81 2 100 6 99 99 3 100 7 1 100 3 100 8 1 1 4 8 rows selected.
Kind regards
Rob. -
Number of lines UTL_FILE
Hai
I get pl/sql block file.
Fic_Laos: = UTL_FILE. FOPEN (p_tfi, nom_fi, vs_mod_r, 3000);
UTL_FILE. GET_LINE (Fic_Laos, line);
I want to count the total number of lines in UTL_FILE...
pls help
SCount until no data found in the file.
declare f utl_file.file_type; s varchar2(200); n number := 0; begin f := utl_file.fopen('REMOTEDIR','tata.txt','R'); loop utl_file.get_line(f,s); if s is not null then n := n+1; end if; dbms_output.put_line(s); end loop; exception when NO_DATA_FOUND then dbms_output.put_line('no of lines:'||n); utl_file.fclose(f); end; /
Maybe you are looking for
-
Download my iTunes library to a new Mac
Hello I bought a new MacBook and want to download my entire iTunes library so that I can use it offline (in flight, etc.). Is it possible to do this without having to individually click each album, one by one? Thank you
-
VGC-JS155J hard drive upgrade!
Upgrading the hard drive of a VGC-JS155J? It is a 2.5 "or 3.5" disk?
-
Portege 2000 does not recongnise the run key that I'm going home
Some how my laptop can not recongnise the race key that I go... (with the help of a friend Comp in now)Is there a special function key which toggle the keyboard. Using XP sp2.
-
Lenovo Ideaphone P770 - how to open these past apps?
Hello I recently bought a Lenovo mobile P770 and I noticed that there is no "recent apps" button at the bottom right as the Lenovo P700i or Samsung android mobile. This button looks like two rectangles that overlap. I don't see this on P770 and I don
-
BootDevice found Probook 6475 b
I work in a corporate environment and may have a "stupid question". Regretably I have to deploy Windows XP currently. I was able to successfully repel the 6475b image by setting the machine to start in legacy mode, as the native operating system wa