Function and number of rows
Hi ..is it possible to write a function that will take a table name and a where clause as parameters and return the number of rows in the table that satisfy the where clause...?
thanks
W
SQL> select * from emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7566 JONES MANAGER 7839 02-APR-81 2975 1000 20
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7788 SCOTT ANALYST 7566 09-DEC-82 3000 20
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 12-JAN-83 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7934 MILLER CLERK 7782 23-JAN-82 1300 10
14 rows selected.
SQL> create or replace function fnc_demo (pTable varchar2,
2 pWhere varchar2)
3 return sys_refcursor as
4 c sys_refcursor;
5 begin
6 open c for 'select * from '||pTable||' '||pWhere;
7 return c;
8 end;
9 /
Function created.
SQL> var c refcursor
SQL> exec :c := fnc_demo('emp','where deptno = 10');
PL/SQL procedure successfully completed.
SQL> print c
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7839 KING PRESIDENT 17-NOV-81 5000 10
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7934 MILLER CLERK 7782 23-JAN-82 1300 10
SQL>
Similar Messages
-
List Table names and number of rows in it
Following is a piece of code that would list all tables in a schema and the number of rows in each table.Hope it is helpful for you.
Note: In this example iam selecting only those tables starting with 'T_'. you may replace it accordingly.
create or replace procedure count_lines is
cursor cur is select tname from tab where tname like 'T\_%' escape '\';
lines number;
begin
dbms_output.put_line(rpad('TABLE_NAME',65,' ')||'NUMBER_OF_LINES');
dbms_output.put_line(rpad('-',80,'-'));
for i in cur loop
execute immediate 'select count(*) from '||i.tname into lines;
dbms_output.put_line(rpad(i.tname,70,' ')||lines);
end loop;
end count_lines;
Following is the sample output:(ignore alignment here)
TABLE_NAME NUMBER_OF_LINES
T_FR_ACTION 3
T_FR_ATTRIBUTE 52
T_FR_ATTRIBUTE_TYPE 3
T_FR_ATTRIBUTE_VALUE 5389This has been covered many times, so your solution is not the only way...
http://laurentschneider.com/wordpress/2007/04/how-do-i-store-the-counts-of-all-tables.html
Re: count rows in shema tables
And there's many more if you search -
SELECT 'analyze table '||table_name||' compute statistics for table;'
from user_tables;
SELECT table_name,num_rows
FROM user_tables; Hi I am getting null NUM_ROWS column what could be the reason and how can I fix it?It works ... for me however.....!!!!
SQL> create table f(b varchar2(10) , g number(2));
Table created
SQL> insert into f values('5',4);
1 row inserted
SQL> insert into f values('e',4);
1 row inserted
SQL> commit;
Commit complete
SQL> select table_name,num_rows from user_tables where table_name='F';
TABLE_NAME NUM_ROWS
F
SQL>
SQL> begin
2 for r in ( select table_name from user_tables )
3 loop
4 execute immediate 'analyze table '||r.table_name||' compute statistics for table';
5 end loop;
6 end;
7 /
PL/SQL procedure successfully completed
SQL> select table_name,num_rows from user_tables where table_name='F';
TABLE_NAME NUM_ROWS
F 2
If you repeat the above simple test don't you get the same results.....????
Sim
Message was edited by:
sgalaxy -
Change the size of and number of rows retrieved in Popup Key LOV
I have a Page Item of type Popup Key LOV (Displays description, returns key value).
There are 100+ rows returned but each "page" in the popup window only holds 10, then the user has to click next to see the next 10 rows. Where can I change this setting so that 25 rows are returned per page?
Also, is there a way to make this popup window wider so that a long string doesn't wrap, but stays on a single row.
Edited by: mimi_jones on Nov 20, 2009 9:48 AM ADDED: APEX 3.1.1 Oracle 10gGo to Shared Components in the Application Builder for your app.
Go to Templates.
Go to Popup LOV template.
The Window section allows you to change the height and width. The Pagination section allows you to change how many entries you see per page.
Boris -
How do i get the table_names and no of rows in a session
how do i write a select statement to
retrieve the all the table_names and number of rows in that table in a session.
for example i should get the output as below
tab_name no.of rows
tab1 40
tab2 50
tab3 25
thank u for the helpWhy? You do realize that this will force Oracle to do a full table-scan on every table in the schema, right? This will be horribly slow...
The PL/SQL approach would be something like this... You could also write a pipelined function to do this if you want to be able to do this in a SQL statement.
DECLARE
sqlStmt VARCHAR2(4000);
cnt NUMBER;
BEGIN
FOR x IN (SELECT * FROM user_tables)
LOOP
sqlStmt := 'SELECT COUNT(*) FROM ' || x.table_name || ';';
EXECUTE IMMEDIATE sqlStmt INTO cnt;
dbms_output.put_line( x.table_name || ': ' || to_char(cnt) );
END LOOP;
END;Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Count number of rows in a table
Hi,
I have a requirement. I want to frame a SQL, which takes schema name as input and returns tables owned by that schema and number of rows inside a particular table.
A Sample output:
===========
Table No. of Rows
~~~~ ~~~~~~~~
A 123
B 126
C 234
.Can somebody help me in framing a query for the same.
Regards,hoek wrote:
But you could use this script:
http://laurentschneider.com/wordpress/2007/04/how-do-i-store-the-counts-of-all-tables.html
Laurent's solution most likely was published before IOT. Anyway, IOT ovwerflow tables must be excluded. Otherwise:
SQL> select table_name,
2 to_number(
3 extractvalue(
4 xmltype(
5 dbms_xmlgen.getxml('select count(*) c from '||owner || '.' || table_name)),'/ROWSET/ROW/C')) cou
6 from dba_tables
7 where owner = 'OE'
8 /
ERROR:
ORA-19202: Error occurred in XML processing
ORA-25191: cannot reference overflow table of an index-organized table
ORA-06512: at "SYS.DBMS_XMLGEN", line 176
ORA-06512: at line 1
no rows selected
SQL> select table_name,
2 to_number(
3 extractvalue(
4 xmltype(
5 dbms_xmlgen.getxml('select count(*) c from '||owner || '.' || table_name)),'/ROWSET/ROW/C')) count
6 from dba_tables
7 where owner = 'OE'
8 and nvl(iot_type,'X') != 'IOT_OVERFLOW'
9 /
TABLE_NAME COUNT
CUSTOMERS 319
WAREHOUSES 9
ORDER_ITEMS 665
ORDERS 105
INVENTORIES 1112
PRODUCT_INFORMATION 288
PRODUCT_DESCRIPTIONS 8640
PROMOTIONS 2
PRODUCT_REF_LIST_NESTEDTAB 288
SUBCATEGORY_REF_LIST_NESTEDTAB 21
10 rows selected.
SQL> SY. -
Want to know the table names as well as number of rows
hi...every one.....i want to explain more in detail to previous thread i have posted.
actually i need to display all the table names and number of rows for each, in a schema(like AP,HR,....)
it's must that i should do it by using a stored procedure.
so the best way for this would be by using cursor and loop.
so please help me in solving this question.i need to display all the table names and number of rows for each, in a schema(like AP,HR,....)
it's must that i should do it by using a stored procedure.Homework ?
Anyway, try this
SQL> create or replace procedure count_rows
2 is
3 nrows number;
4 str varchar2(100);
5 begin
6 for T in (select table_name from user_tables
7 order by table_name)
8 loop
9 str := 'select count(*) from '||T.table_name;
10 execute immediate str into nrows;
11 dbms_output.put_line(T.table_name||' '||nrows);
12 end loop;
13* end;
SQL> /Don't forget to "set serveroutput on" when you execute it. -
Displayin message and fixing the number of rows in a table
Hi Experts,
I have a requirement like this
there is a table, where i need to diplay a message when there are no records and no rows should be visible on that table.
Also, when the records are populated from the context, i need to fix the number of rows in that table and display the records.
Please let me know hw this can be achieved.
Also in the table I have Link to URL, please let me know how to handle this reference, when i set the reference Property, its giving me an error stating that the file doesn't exist when the table gets loaded.
Thanks in Advance
Regards,
PalaniHi
Oh!! You should to explain it at first thread itself that you want to display a JPG imange or other WDWebResourceTypetaken form the backend.
1. So this is not at all a URL
2. You have to convert binary data to WDWebResource then display it in either Image UI element or other (like PDF , txt etc)
3
try
// Read the datasource of the FileUpload
IWDResource res = wdContext.currentContextElement().getResource();
InputStream in = res.read(false);
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
int length;
byte[] part = new byte[10 * 1024];
while ((length = in.read(part)) != -1)
bOut.write(part, 0, length);
in.close();
bOut.close();
IPrivateUploadCompView.IImageTableElement ele = wdContext.nodeImageTable().createImageTableElement();
ele.setImage(wdContext.currentContextElement().getResource().getUrl(0));
ele.setText(res.getResourceName());
wdContext.nodeImageTable().addElement(ele);
catch (Exception e)
wdComponentAPI.getMessageManager().reportWarning(e.toString());
Here I assume that you convert that data to IWDResource type or
4.
WDWebResource.getWebResource(wdContext.currentContextElement().getresource(), type);
// getResource of type binary which u read from BAPI and set it in local context , type is MIMETYPE or hardcode it as "JPG"
5. Further help
[Help1|To Displayan Image in Webdynpro Java from Standard Function Module;
[Help2|http://wiki.sdn.sap.com/wiki/display/KMC/GettinganimagefromKMDocumentstobeusedinWeb+Dynpro]
[Help3|http://wiki.sdn.sap.com/wiki/display/KMC/GettinganimagefromKMDocumenttobeusedinWeb+DynPro]
It might code look strange at first , please do some reserch in SDN ,I did my best at this level.
Best Regards
Satish Kumar -
Open system form and select a row number on matrix by click on button
Hi experts,
I have to open the purchase order form and select a specific row number from the matrix by clicking a button on sales order form.
is it possible ?
can anyone help me to achieve it?
Thanks in advance.
Best regards
AndreaAndrea,
To Do? Clicking on a Button on Sales Order -> Opens a PO form, and selects the row?
In the eventhandler of a button click if the PO is not linked to SO by SAP B1 standard functionality
step 1. call ActivateMenu ("2305") of Sbo_application , this opens the PO form
step 2. Change the form to Find mode
step 3. enter po number to the Item UID "8" which is the document number.
step 4. Send enter key, or Clikc On button UID "1" which finds the PO
step 5.read the value from SO form, from matrix "38" line where you selected
step 6. use the code above to locate the line in PO (use # column for position numbers which UID is 0)
at step 5, i think you should select a line from SO matrix which you would like to open.
IN sales order, If you used PO chekcbox on logistics tab to create the PO, you can find a direct link between PO and SO (only in docentries are linked not positions) on sales order, Column UID 158 field name: potrgnum. If this connection is exists, you have an easy way:
SO form, when a user clicks on COlumn 158 (po number), you can implement an eventhandler, which
step 1.read the value from SO form, from matrix "38" line where you selected
step 2. use the code above to locate the line in PO (use # column for position numbers which UID is 0)
By processing theses steps, you can build up you solution.
Regards
János -
PLSQL function does not return the correct number of rows?
Hey folks. I'm still green when it comes to writing PLSQL. It's fun, rewarding and very frustrating. Hence, I'm turning to the experts. If you folks can help me understand what I'm doing wrong here, I'd really appreciate it.
The code is somewhat specific to my company's product, but I think it should be easy to read and understand what I'm doing. If not, please let me know what I can clarify.
All i'm trying to do is determine if the most recent iteration of data available for a particular host is a full scan or not (level2). I go about this in the following manner:
1. get the operatingsystem id, it's scandate (preferred), the most recent scandate and it's scan status from a table of where all operating systems data lives. Loop through all the Oses
(from this I set v_osid, v_mostrecentscandate, v_scandate).
2. Before doing the crazy logic, pick the low hanging fruit
2a. if the the level2 status of the host is N, then v_level2 = 'N';
2b. if the level2 = 'Y' and the mostrecentscandate and scandate are identical, then v_level2 = 'Y';
2c. for all other cases, go to 3
3. Using v_mostrecentscandate, find all table id that may hold the most recent instance of data for the host
4. Loop through through the concatenation of that id + _base. If you find the id in those tables, then store the id for the next step.
5. When you I find the right id, I now concatenate the id + attrdata. For the host id, I look for any rows where attribute_value in (..) and the corresponding number_value is not null.
5b. set v_level2 = 'Y'
5c. otherwise, set v_level2 = 'N'
6 end the loop
7 wash, rinse, repeat for each OS.
create or replace package body mostrecentlevel2 as
function getMostRecentL2 return bdna_mostrecent_level2 pipelined IS
v_lsid NUMBER;
v_sql VARCHAR2(5000);
v_sql_baseid NUMBER;
v_sql_numv NUMBER;
v_lsidt VARCHAR2(5000);
v_lsidt2 VARCHAR2(5000);
v_sql_rec VARCHAR2(5000);
v_osid NUMBER;
v_anchor DATE;
v_ls CHAR(2);
v_level2 CHAR(1);
v_mostrecentscandate DATE;
v_scandate DATE;
cursor getOSinfo_cur is select operatingsystem_id, scandate, mostrecentscandate, level2 from bdna_all_os;
cursor getlsID_cur is select id from local_scan where
((trunc(collect_start_time) - to_date(v_anchor))*24*60*60) <= ((to_date(v_mostrecentscandate) - to_date(v_anchor))*24*60*60)
and
((trunc(collect_end_time) - to_date(v_anchor))*24*60*60) >= ((to_date(v_mostrecentscandate) - to_date(v_anchor))*24*60*60);
getOSinfo_rec getOSinfo_cur%rowtype;
getlsID_rec getlsID_cur%rowtype;
BEGIN
v_ls := 'ls';
v_anchor := '01-JAN-01';
FOR getOSinfo_rec IN getOSinfo_cur LOOP
v_osid := getOSinfo_rec.operatingsystem_id;
v_mostrecentscandate := getOSinfo_rec.mostrecentscandate;
v_scandate := getOSinfo_rec.scandate;
IF getOSinfo_rec.level2 = 'N' THEN
v_level2 := 'N';
ELSIF getOSinfo_rec.level2 = 'Y' THEN
IF v_mostrecentscandate != v_scandate THEN
FOR getlsID_rec IN getlsID_cur LOOP
v_lsid := getlsID_rec.id;
v_lsidt := v_ls||v_lsid;
v_sql := 'select id from '||v_lsidt||'_base where id = '||chr(39)||v_osid||chr(39);
EXECUTE IMMEDIATE v_sql into v_sql_baseid;
IF SQL%ROWCOUNT > 0 THEN
v_lsidt2 := v_lsidt;
v_sql := '';
END IF;
END LOOP;
v_sql := 'select number_value from '||v_lsidt2||'_attr_data where
lower(attribute_name) IN ('||chr(39)||'numcpus'||chr(39)||', '||chr(39)||'totalmemory'||chr(39)||', '||chr(39)||'cpuutilpercent'||chr(39)||', '||chr(39)||'numprocesses'||chr(39)||')
and
number_value is not NULL
and
element_id = '||chr(39)||v_osid||chr(39);
EXECUTE IMMEDIATE v_sql into v_sql_numv;
IF SQL%ROWCOUNT > 0 THEN
v_level2 := 'Y';
ELSE v_level2 := 'N';
END IF;
END IF;
v_level2 := 'Y';
END IF;
PIPE ROW (mostRecentLevel2Format(v_osid,v_mostrecentscandate,v_level2));
END LOOP;
END;
END;
/Now some will ask why I'm using pipelining? Again, I'm green.. I was reading around, looking for a way to make this code run as fast as possible (because it's potentially got to go through 56K records and perform the expensive work on).
I also realize I'm not providing the type or package code, and that's because I think I'm good on that. The code above compiles just fine without errors and when it runs, it only returns 6 consecutive rows.. I'm expecting 70K lol. So I know I'm doing something wrong.
Any thoughts?
Oh forgot to add this is on 11g R1 Enterprise Edition
Edited by: ErrolDC on Nov 14, 2011 4:52 PM
Edited by: ErrolDC on Nov 14, 2011 5:07 PMErrolDC wrote:
Hey folks. I'm still green when it comes to writing PLSQL. It's fun, rewarding and very frustrating. Hence, I'm turning to the experts. If you folks can help me understand what I'm doing wrong here, I'd really appreciate it.
The code is somewhat specific to my company's product, but I think it should be easy to read and understand what I'm doing. If not, please let me know what I can clarify.Post a complete script that peoople who aren't as familiar with the application as you are can run to re-create the problem and test their ideas. In this case, that includes CREATE TABLE and INSERT statements for the tables used (just the columns needed for this job), a query that uses the function, and the results you want from that query given the data you posted.
All i'm trying to do is determine if the most recent iteration of data available for a particular host is a full scan or not (level2). I go about this in the following manner:
1. get the operatingsystem id, it's scandate (preferred), the most recent scandate and it's scan status from a table of where all operating systems data lives. Loop through all the Oses
(from this I set v_osid, v_mostrecentscandate, v_scandate).
2. Before doing the crazy logic, pick the low hanging fruit
2a. if the the level2 status of the host is N, then v_level2 = 'N';
2b. if the level2 = 'Y' and the mostrecentscandate and scandate are identical, then v_level2 = 'Y';
2c. for all other cases, go to 3
3. Using v_mostrecentscandate, find all table id that may hold the most recent instance of data for the host
4. Loop through through the concatenation of that id + _base. If you find the id in those tables, then store the id for the next step.
5. When you I find the right id, I now concatenate the id + attrdata. For the host id, I look for any rows where attribute_value in (..) and the corresponding number_value is not null.
5b. set v_level2 = 'Y'
5c. otherwise, set v_level2 = 'N'
6 end the loop
7 wash, rinse, repeat for each OS.
create or replace package body mostrecentlevel2 as
function getMostRecentL2 return bdna_mostrecent_level2 pipelined IS
v_lsid NUMBER;
v_sql VARCHAR2(5000);
v_sql_baseid NUMBER;
v_sql_numv NUMBER;
v_lsidt VARCHAR2(5000);
v_lsidt2 VARCHAR2(5000);
v_sql_rec VARCHAR2(5000);
v_osid NUMBER;
v_anchor DATE;
v_ls CHAR(2);
v_level2 CHAR(1);
v_mostrecentscandate DATE;
v_scandate DATE;
cursor getOSinfo_cur is select operatingsystem_id, scandate, mostrecentscandate, level2 from bdna_all_os;
cursor getlsID_cur is select id from local_scan where
((trunc(collect_start_time) - to_date(v_anchor))*24*60*60) <= ((to_date(v_mostrecentscandate) - to_date(v_anchor))*24*60*60)
and
((trunc(collect_end_time) - to_date(v_anchor))*24*60*60) >= ((to_date(v_mostrecentscandate) - to_date(v_anchor))*24*60*60);
getOSinfo_rec getOSinfo_cur%rowtype;
getlsID_rec getlsID_cur%rowtype;
BEGIN
v_ls := 'ls';
v_anchor := '01-JAN-01';
FOR getOSinfo_rec IN getOSinfo_cur LOOP
v_osid := getOSinfo_rec.operatingsystem_id;
v_mostrecentscandate := getOSinfo_rec.mostrecentscandate;
v_scandate := getOSinfo_rec.scandate;
IF getOSinfo_rec.level2 = 'N' THEN
v_level2 := 'N';
ELSIF getOSinfo_rec.level2 = 'Y' THEN
IF v_mostrecentscandate != v_scandate THEN
FOR getlsID_rec IN getlsID_cur LOOP
v_lsid := getlsID_rec.id;
v_lsidt := v_ls||v_lsid;
v_sql := 'select id from '||v_lsidt||'_base where id = '||chr(39)||v_osid||chr(39);
EXECUTE IMMEDIATE v_sql into v_sql_baseid;
IF SQL%ROWCOUNT > 0 THEN
v_lsidt2 := v_lsidt;
v_sql := '';
END IF;
END LOOP;
v_sql := 'select number_value from '||v_lsidt2||'_attr_data where
lower(attribute_name) IN ('||chr(39)||'numcpus'||chr(39)||', '||chr(39)||'totalmemory'||chr(39)||', '||chr(39)||'cpuutilpercent'||chr(39)||', '||chr(39)||'numprocesses'||chr(39)||')
and
number_value is not NULL
and
element_id = '||chr(39)||v_osid||chr(39);
EXECUTE IMMEDIATE v_sql into v_sql_numv;
IF SQL%ROWCOUNT > 0 THEN
v_level2 := 'Y';
ELSE v_level2 := 'N';
END IF;
END IF;
v_level2 := 'Y';
END IF;
PIPE ROW (mostRecentLevel2Format(v_osid,v_mostrecentscandate,v_level2));
END LOOP;
END;
END;
/Now some will ask why I'm using pipelining? Again, I'm green.. I was reading around, looking for a way to make this code run as fast as possible (because it's potentially got to go through 56K records and perform the expensive work on).
I also realize I'm not providing the type or package code, and that's because I think I'm good on that. The code above compiles just fine without errors and when it runs, it only returns 6 consecutive rows.. I'm expecting 70K lol. So I know I'm doing something wrong. You're calling TO_DATE with a DATE argument. Why are you calling TO_DATE at all?
It seems like this condition:
((trunc(collect_start_time) - to_date(v_anchor))*24*60*60) <= ((to_date(v_mostrecentscandate) - to_date(v_anchor))*24*60*60) is equivalent to
TRUNC (collect_start_time) <= v_mostrecentscandateThat probably has nothing to do with why you're only getting 6 rows. -
Maximum number of rows and columns in data form
Hi,
I wanted to know if there is a limitation to the number of rows and columns that can be displayed in a data form, in Hyperion planning 11.1.2.1 ?
And what would be the most appropriate number of rows and columns to be included for optimum performance.
Thanks.Hi,
While its a fun fact to determine how much one can stuff into a web form, the reality is: how much can a user reasonably consume in a web form?
And what would be the most appropriate number of rows and columns to be included for optimum performance
You will find that the answer to this is by "what design makes a web form most usable?" And no, the users don't really know what they want from a design perspective, they see it in their head, but usually what they ask for is something that would look entirely different (huge).
The next thing to think about is the use of member selection functions in the page axis. IDescendants(Entity) in a dropdown could cause issues just as easily as too many rows - and again make the drop down unusable for a user.
If your question is a bit more technical, then consider this (somewhat oversimplified): Web forms are constructed by a process on the server. Objects are created based on the form's definition and used by the process that builds the form. The process uses Cartesian looping (lots of iterations) to construct the form cell by cell, starting at the top left and finishing up in the bottom right. If the form has a million cells on it, then the loop and all the code within it runs a million times. The capability of the server has a lot to do with how well it can handle this request, and how many it can handle at one time.
The result of this is gobs of HTML and JavaScript. All of this has to be sent over a network to the requesting client. The client starts receiving the web page code and has to render it in the browser and run the JavaScript. The ability to do this is limited by the browser, the OS, and the hardware that the client is running on.
And that's just rendering the page for use.
Now it has to be interacted with on the client machine, and changes parsed, packaged, and sent back to the server.
So the technical answer is, there can be many limitations to how many rows and columns a data form can have - none of which can truly be anticipated by anyone. This is why I put the part about usability first in this post.
Regards,
Robb Salzmann -
How to find accurate number of Rows, and size of all the tables of a Schema
HI,
How to find the accurate number of Rows, and size of all the tables of a Schema ????
Thanks.SELECT t.table_name AS "Table Name",
t.num_rows AS "Rows",
t.avg_row_len AS "Avg Row Len",
Trunc((t.blocks * p.value)/1024) AS "Size KB",
t.last_analyzed AS "Last Analyzed"
FROM dba_tables t,
v$parameter p
WHERE t.owner = Decode(Upper('&1'), 'ALL', t.owner, Upper('&1'))
AND p.name = 'db_block_size'
ORDER by 4 desc nulls last;
## Gather schema stats
begin
dbms_stats.gather_schema_stats(ownname=>'SYSLOG');
end;
## Gather a particular table stats of a schema
begin
DBMS_STATS.gather_table_stats(ownname=>'syslog',tabname=>'logs');
end;
http://www.oradev.com/create_statistics.jsp
Hope this will work.
Regards
Asif Kabir
-- Mark the answer as correct/helpful -
How to get number of rows and columns in a two dimensional array ?
Hello,
What would be the simplest way to get number of rows and columns in a two dimensional array represented as integers ?
I'm looking for another solution as For...Each loop in case of large arrays.
Regards,
PetriHi Petri,
See a attached txt file for obtaining two arrays with upper and lower index values
Regards
Ray
Regards
Ray Farmer
Attachments:
Get2DArrayIndex.txt 2 KB -
There is no "deactivate" function and the technical support person I chatted with recommended I come here. Can I just use the serial number again? How can I deactive? Has anyone else run into this? How can I get Dreamweaver 8, which is no longer being activated by Adobe, on a new computer? Is it even worth doing or do I need to get a new version. What are the killer features I'm missing?
If you manage to get it installed on your current OS, don't forget to install the 8.02 update.
Adobe - Dreamweaver Support Center : Updaters
Nancy O. -
XMLIndex: finding indexed XPaths and the number of rows in the path table
Hi,
I am storing non-schema-based binary XMLs in an XMLType column in 11g (11.1.0.6.0) and would like to index the XMLs either partially or fully using XMLIndex. I'm expecting to have a large number (tens of millions) of XML documents and have some concerns about the size of the XMLIndex path table.
In short, I am worried that the path table might grow unmanageable large. In order to avoid this and to plan for table partitioning, I would like to create a report of all indexed XPaths in an XMLIndex and to find out how many times each path is actualized in the path table. I would do this for a representative XML sample.
I have been creating XMLIndexes with different exclude/include paths, gathering stats with DBMS_STATS (estimate_percent = 100) and selecting the number of rows in the path table through USER_TABLES.
If anyone knows a more straightforward way of doing this all advice is very much appreciated.
Best Regards,
Rasko LeinonenThanks Marco,
I managed to get out all indexed paths using the following SQL. It took a while to understand how the join the XDB.X$PT39CW6BJR8W4VVE0G0LLGA0OCR5 and XDB.X$QN39CW6BJR8W4VVE0G0LLGA0OCR5 tables together but got there in the end. This helps to clarify which XPaths are being currently indexed by the XMLIndex.
begin
for v_row in (select PATH from XDB.X$PT39CW6BJR8W4VVE0G0LLGA0OCR5)
loop
declare
v_i BINARY_INTEGER := 1;
v_id raw(8);
v_len BINARY_INTEGER := 2;
v_skip BINARY_INTEGER := 1;
begin
while v_i < utl_raw.length(v_row.path) and
v_i + v_len <= utl_raw.length(v_row.path)
loop
v_i := v_i + v_skip;
v_id := utl_raw.substr(v_row.path, v_i, v_len);
--dbms_output.put_line(v_id);
for v_row2 in (select LOCALNAME, flags from XDB.X$QN39CW6BJR8W4VVE0G0LLGA0OCR5
where ID = v_id )
loop
if rawtohex(v_row2.flags) = '01'
then
dbms_output.put('@');
end if;
dbms_output.put(v_row2.localname);
if v_i + v_len < utl_raw.length(v_row.path)
then
dbms_output.put('/');
end if;
end loop;
v_i := v_i + v_len;
end loop;
dbms_output.put_line('');
end;
end loop;
end;
Example output:
RUN
RUN/@accession
RUN/@alias
RUN/@instrument_model
RUN/@run_date
RUN/@run_center
RUN/@total_data_blocks
RUN/EXPERIMENT_REF
RUN/EXPERIMENT_REF/@accession
RUN/EXPERIMENT_REF/@refname
RUN/DATA_BLOCK
RUN/DATA_BLOCK/@name
RUN/DATA_BLOCK/@total_spots
RUN/DATA_BLOCK/@total_reads
RUN/DATA_BLOCK/@number_channels
RUN/DATA_BLOCK/@format_code
RUN/DATA_BLOCK/@sector
RUN/DATA_BLOCK/FILES
RUN/DATA_BLOCK/FILES/FILE
RUN/DATA_BLOCK/FILES/FILE/@filename
RUN/DATA_BLOCK/FILES/FILE/@filetype
RUN/RUN_ATTRIBUTES
RUN/RUN_ATTRIBUTES/RUN_ATTRIBUTE
RUN/RUN_ATTRIBUTES/RUN_ATTRIBUTE/TAG
RUN/RUN_ATTRIBUTES/RUN_ATTRIBUTE/VALUE
Maybe you are looking for
-
Hard drive died - multiple problems with backed up home folder
My friend called me when she started having some problems with her home iMac. After we did went through a myriad of troubleshooting items, I determined that her hard drive was failing and suggested she backup her home folder immediately to another dr
-
My Home button doesn't respond when pressed, how can I get it working again?
While using my iPod Touch, the HOME button just stopped working, so when trying to get out of an application it is unresponsive. Any ideas/suggestions?? I have already restored the iPod to its original settings but the same problem persists. All help
-
Need Guideline on Essbase Error
Hi, I logged in Essbase by using my Login ID and password successfully but as soon as I clicked on application server I got error which is given below at same time my other friends are both able to connect and work with applications. Error is :- Erro
-
I will be travelling to China in a couple of weeks, and am reading up on what I need to do to enjoy my iPhone 4 while there. I am horrified to read stories by folks who have data roaming OFF and come home to thousands of dollars worth of roaming char
-
Using Pantone Colour as Effects in Illustrator CS5
Hello. I have create a swoosh for a clients logo and to cut down on production cost I have created a two colour option (pantone). The design is using the following effects Drop Shadow, Outer Glow & Feathering. To maintain the brand colours I have sel