How to find the partition
Guys,
Please can you tell me how to find the partition name from the table for say today ("SYSDATE") assuming that the table is partitioned by Date ( monthly )
ie,
I need to find the partition belonging to the current month, on which i am working
Thanks
G
Based on martina's suggestion (can be of course improved, maxvalue should be handled as well):
SQL> create table p(id number,time_stamp date)
2 partition by range(time_stamp)
3 (
4 partition p1 values less than(date '2007-10-01'),
5 partition p2 values less than(date '2007-11-01'),
6 partition p3 values less than(date '2007-12-01'),
7 partition p4 values less than(date '2008-01-01'),
8 partition p5 values less than(date '2008-02-01'),
9 partition p6 values less than(date '2008-03-01')
10 )
11 /
Table created.
SQL> create or replace function date_from_long(p_tabname varchar2,
2 p_partname varchar2)
3 return date is
4 l_long long;
5 l_date date;
6 begin
7 select high_value
8 into l_long
9 from user_tab_partitions
10 where table_name = p_tabname
11 and partition_name = p_partname;
12 if substr(l_long, 1, 7) = 'TO_DATE' then
13 execute immediate 'select ' || l_long || ' from dual'
14 into l_date;
15 return l_date;
16 else
17 return null;
18 end if;
19 end;
20 /
Function created.
SQL> select table_name,partition_name,
2 date_from_long(table_name,partition_name) high_value
3 from user_tab_partitions
4 where table_name='P'
5 order by 3
6 /
TABLE_NAME PARTITION_NAME HIGH_VALUE
P P1 01.10.2007 00:00:00
P P2 01.11.2007 00:00:00
P P3 01.12.2007 00:00:00
P P4 01.01.2008 00:00:00
P P5 01.02.2008 00:00:00
P P6 01.03.2008 00:00:00
6 rows selected.
SQL> select
2 max(partition_name)
3 keep
4 (dense_rank first order by date_from_long(table_name,partition_name)) part_name
5 from user_tab_partitions
6 where table_name='P' and date_from_long(table_name,partition_name)>=sysdate
7 /
PART_NAME
P2Best regards
Maxim
Similar Messages
-
How to find the partition/overflow tablespace for hash partition?
CREATE TABLE sales(acct_no NUMBER(5),
acct_name CHAR(30),
amount_of_sale NUMBER(6),
week_no INTEGER,
sale_details VARCHAR2(1000),
PRIMARY KEY (acct_no, acct_name, week_no))
ORGANIZATION INDEX
INCLUDING week_no
OVERFLOW
PARTITION BY HASH (week_no)
PARTITIONS 16
STORE IN (tsp101, tbs_scott01)
OVERFLOW STORE IN (tsp101, tbs_scott01);
Query the partition tablespace like below, get null instead of 'tsp101' and 'tbs_scott01':
SELECT tp.PARTITION_NAME, tp.TABLESPACE_NAME
FROM ALL_TAB_PARTITIONS tp, ALL_PART_TABLES pt
WHERE tp.TABLE_NAME='SALES'
AND tp.TABLE_OWNER = pt.OWNER(+) AND tp.TABLE_NAME = pt.TABLE_NAME(+)
ORDER BY PARTITION_POSITIONCREATE TABLE sales(acct_no NUMBER(5),
acct_name CHAR(30),
amount_of_sale NUMBER(6),
week_no INTEGER,
sale_details VARCHAR2(1000),
PRIMARY KEY (acct_no, acct_name, week_no))
ORGANIZATION INDEX
INCLUDING week_no
OVERFLOW
PARTITION BY HASH (week_no)
PARTITIONS 16
STORE IN (tsp101, tbs_scott01)
OVERFLOW STORE IN (tsp101, tbs_scott01);
Query the partition tablespace like below, get null instead of 'tsp101' and 'tbs_scott01':
SELECT tp.PARTITION_NAME, tp.TABLESPACE_NAME
FROM ALL_TAB_PARTITIONS tp, ALL_PART_TABLES pt
WHERE tp.TABLE_NAME='SALES'
AND tp.TABLE_OWNER = pt.OWNER(+) AND tp.TABLE_NAME = pt.TABLE_NAME(+)
ORDER BY PARTITION_POSITION -
How to find the partition column in a partitioned table
Hi,
I have a partition table and I need to find out what column was used to partition the table. Range partition.
Thanks,
Maria Sanchezselect *
from dba_part_key_columns -
I partitioned my MacBook Pro and installed Windows 8 in it.....now I can't find my partition when I pressed option key when booting up.....so how can I do to find the partition to boot...I can see it in the disk manager in Mac....any ideas? thanks..!..
Hi LamboMong,
just try this:
http://refit.sourceforge.net
install, reboot twice and choose the Windows-Partition on next startup.
(The apple-bootloader doesn't display all bootable harddisks.
With rEFIt you can boot from all partitions/harddisks on your computer.)
I hope that will solve your problem.
Daniel Fernau -
How Do I Find the Partition GUID?
I'm new to server administration and I've been looking for a way to find the GUID of a partition on a hard drive. I've read a lot of articles on GPT and partitioning in general, and I reviewed all the articles suggested in the Related Topics section
that opens up when a person goes to post a question in these forums, and thus far nothing I've read has given me the answer.
I can find the GUID of the hard drive, but drives can contain multiple partitions, and I'd like to be able to find the GUID for any partition. I'd like to use a script to retrieve the partition GUIDs for a drive, but I'd also like to be able to get
the GUIDs manually as a check against the script results.
Can anyone tell me how to find the GUIDs for the partitions on a drive?
Thanks for any help that you can offer.
--TomI understand perfectly thankyou.
However, you can have a partition on a disk that doesnt necessarily have a volume in windows.
A volume must have a partition that it is applied to, however a partition doesnt always have to have a volume, a single partition can also contain multiple volumes (extended partitions if you will, where multiple logical drives can be created within it)
You can refer to the following reference for the differences between a volume and a partition
http://en.wikipedia.org/wiki/Volume_(computing)
Regardless of which, the powershell command I provided still provides the solution to the original query
If you would like further evidence of the difference between partitions and volumes as far as windows is concerned, you can refer to the WMI namespace for each
This will return all of the partitions that exist (powershell)
GWMI -namespace root\cimv2 -class win32_DiskPartition
This will return all of the volumes that exist (powershell)
GWMI -namespace root\cimv2 -class win32_volume
Notice how there are more volumes than partitions?
So, as I said before, I don't believe windows assigns GUID's to partitions, but it does to Volumes.
Kriss Milne, MCSE | Infrastructure Specialist -
Find the partition for the fact table
Oracle version : Oracle 10.2
I have one fact table with daily partitions.
I am inserting some test data in this table for old date 20100101.
I am able to insert this record in this table as below
insert into fact_table values (20100101,123,456);
However I observed that the partition for this date does not exist in the table (all_tab_partitions) morever I am not able to select the data using
select * from facT_table partition(d_20100101)
but I am able to extract the data using
select * from facT_table where date_id=20100101
could some one please let me know the way to find the partition in which this data might be inserted
and if the partition for date 20100101 is not present then why insert for that date is working ?user507531 wrote:
However I observed that the partition for this date does not exist in the table (all_tab_partitions) morever I am not able to select the data using
select * from facT_table partition(d_20100101)Wrong approach.
but I am able to extract the data using
select * from facT_table where date_id=20100101Correct approach.
could some one please let me know the way to find the partition in which this data might be inserted
and if the partition for date 20100101 is not present then why insert for that date is working ?Who says that the date is invalid..? This is a range partition - which means that each partition covers a range. And if you bothered to read up in the SQL Reference Guide on how a range partition is defined, you will notice that each partition is defined with the end value of the range it covers. There is no start value - as the previous partition's end value is the "+border+" between this and the prior partition.
I suggest that before you use a database feature you first familiarise yourself with it. Else incorrectly using it, and making the wrong assumptions about it, more than likely results. -
How to find the avg salary of first 3 employees based on each department?
how to find the avg salary of first 3 employees based on each department?
Hi,
Do you mean something like this?
with a as
select
deptno
,sal
,row_number() over ( partition by deptno order by sal desc) rn
from
emp
select
deptno
,round(avg(sal)) avg_sal_of_top_3
from
a
where
rn <= 3
group by
deptno
order by
deptno
DEPTNO AVG_SAL_OF_TOP_3
10 2917
20 2992
30 1983
If not please give more details.
Regards,
Peter -
Hi, i have G550 i wont to burn facroty defult disc, the recovery program cant find the partition of lenovo, but i see its there i think the letter of the pratition is change... what can i do? (how much DVDs i need, in the program i see 3 DVDs but all the partition is like 5GB?)
The partition letter can't be changed because it's hidden (at least you use a specific software or specific commands).
The factory disk set are 2 DVDs more and less.
Did you modify your partition schema?
IPnaSh
First Spanish Community Guru - Colaborador ad honorem -
I tried to partition my Harddisk and now i can't find the partition and the space is lost.
The 100GB that I intended to create my partition on are lost and I can't find them anywhere. The option to merge two partitions doesn't even appear and I don't tend to restore my device.
GreetingsI'm guessing you mean Backup and not Restore so I guess you'll start backing up your files now, eh?
From what i've read, unfortunetely, if you bugger your partition then about the only thing you can do is reinstall the Mac OS again and start over. So now is a good time to buy a cheap external drive and start backing up for things like this.
If you down load the Boot Camp Installation Guide and look at page #12 I believe, how to delete the Windows partition or something similar, it will walk you through it step by step or if you can watch one of the video's on YouTube on how to Restore the partitions back to one for further information.
Good luck.......... -
How to find the third highest salary from deptno20,from employee table
how to find the third highest salary from deptno20,from employee table
SELECT *
FROM emp;
EMPNO
ENAME
JOB
MGR
HIREDATE
SAL
COMM
DEPTNO
7369
SMITH
CLERK
7902
12/17/1980
1000
3
20
7499
FEDERAL
SALESMAN
7654
2/20/1981
2000
4
30
7521
WARD
SALESMAN
7698
2/22/1981
3000
4
30
7566
JONES
MANAGER
7839
4/2/1981
4000
3
20
7839
MARTIN
SALESMAN
7698
9/28/1981
5421
4
30
7698
BLAKE
MANAGER
7698
5/1/1981
6222
4
30
7782
CLARK
MANAGER
7839
6/9/1981
5222
2
10
7788
SCOTT
ANALYST
7566
12/9/1982
5463
3
20
7839
KING
PRESIDENT
7902
11/17/1981
8543
2
10
7844
TURNER
SALESMAN
7698
9/8/1981
2124
4
30
7876
ADAMS
CLERK
7788
1/12/1983
2125
3
20
7900
JAMES
CLERK
7698
12/3/1981
5462
4
30
7902
FORD
ANALYST
7566
12/3/1981
2132
3
20
7934
MILLER
CLERK
7782
1/23/1982
5165
2
10
SELECT sal, deptno
FROM (SELECT a.*,
DENSE_RANK () OVER (PARTITION BY deptno ORDER BY sal DESC) r
FROM emp a
---- ORDER BY sal DESC
WHERE r = 3;
SAL
DEPTNO
5421
30
5165
10
2132
20
Regards ,
Friend
Message was edited by: MostWanted!!!! -
How to find the CONNECTION STRING
how to find the connection string through SQL Statement?
salahuddin/salahuddin@CONNECTION_STRING
Below is all about my sql version:
DEFINE SQLPLUSRELEASE = "800060000" (CHAR)
DEFINE _EDITOR = "Notepad" (CHAR)
DEFINE OVERSION = "Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options" (CHAR)
DEFINE ORELEASE = "1002000100" (CHAR)In windows XP plateform your can find from the ServicesHow can you do that using SQL statement? Plus connect strings are not available in Services. In post 9i SQL*Plus we can do it in SQL statement like this
SELECT '&&_CONNECT_IDENTIFIER'
FROM dual;
Note: This will work only in SQL*Plus. -
How to find the installed CUCM iso is restricted or unrestricted?
How to find the installed software in CUCM9.1(iso) is restricted or unrestricted??
Hi,
what u can do is u can login into OS administration through Putty . u get the details of VMWare .
Same can be compared and checked with OVA templates in README file
http://www.cisco.com/web/software/283088407/97505/cucm_9.1_vmv8_v1.7.ova.README1.txt
CUCM 7500 user node:
Cisco Unified Communications Manager (CUCM) configuration that
supports up to 7500 users per node.
Details:
Red Hat Enterprise Linux 5 (32-bit)
CPU: 2 vCPU with 3600 MHz reservation
Memory: 6 GB with 6 GB reservation
Disk: 1 - 110 GB disk with pre-aligned disk partitions
you can see UNRST in attached snapshot.
regds,
aman -
How to find the number of data items in a file written with ArryToFile function?
I have written an array of number in 2 column groups to a file using the LabWindows/CVI function ArrayToFile...Now if I want to read the file with FileToArray Function then how do I know the number of items in the file. during the write time I know how many array items to write. but suppose I want the file to read at some later time then How to find the number of items in the file,So that I can read the exact number and present it. Thanks to all
If you are young work to Learn, not to earn.
Solved!
Go to Solution.What about:
OpenFile ( your file );
cnt = 0;
while ((br = ReadLine ( ... )) != -2) {
if (br == -1) {
// I/O error: handle it!
break;
cnt++;
CloseFile ( ... );
There are some ways to improve performance of this code, but if you are not reading thousands of lines it's quite fast.
After this part you can dimension the array to pass to FileToArray... unless you want to read it yourself since you already have it open!
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos? -
How to find the number of entries in a master data table
Hi Experts,
I am trying to find the entries in 0CUSTOMER master data.
BW>LISTCUBE>Data target: 0CUSTOMER and selected the fields that I need.
I would like to know how to find the "number of entrees". I tried to run the SUM for a count field, but it is taking forever as there are huge number of records .Hi Dev,
Go to the change/display mode of the info object (0CUSTOMER) in your case. Go to the Master data/Text tab. Here you will find the master data tables according to your settings (P orQ or X or Y). Double click on the table name and it will take you to the SE11 display. From there, you can check the number of records as you do in any transparent table.
Hope this helps.
Thanks and Regards
Subray Hegde -
How to find the number of links in a website
hi every body
can any one clear my doubt
my doubt is that
in a website how to find the number of links the hole website contains
is there any navigation tool to find that
plz help me yar
i am waiting for the replyIf you're talking about commercial sites (sites you don't have the source code for) I'm not sure.
If you want to count the links in site that you have the source code for, it should be relatively easy to write a Java application to do it. All you really need to do is have a list of the files you want to count links in, read each file line by line and check for the existance of the <a> tag in each line. Anywhere their is an <a> tag there is a link.
Hope this helps.
Maybe you are looking for
-
Flash Player 10 installed but not woking
I have spent hours and hours trying to solve this issue on my own from all the adobe forums and forums on other websites about this issue. Still can't get FP to work and I need it working ASAP for my on-line college classes. Getting very desperate an
-
We are new on sap. So most of our materials have never been counted. I have run mibc(ABC analysis), then I ran micn by material group to generate a cycle count. One of my 'A' materials is missing. It's in stock and we've never counted it before.
-
HR Master Record Replication to FI with Dual Control for Sensitive Fields
Dear Experts, We have an issue on our project whereby employee records are maintained in HR, but replicated to FI on a regular basis via tcode PRAA, creating employee vendors. We wish to activate the "Dual Control for Sensitive Fields" for the vendor
-
ME52N: Purchase Requisition Change GL Account Number
Requirement: ABAP auto-change the GL Account field number in a Purchase Requisition after the Material Group is changed. Background: This custom logic has been successfully applied to all types of Purchase Requisitions using BADI ME_PROC_REQ_CUST, w
-
DTMF tones from CUCUM 9 thru H323 GW out SIP trunk not working
This is the setup. Currently in lab environment for a client, but needs to go into production IP Phone -> CUCM 9 -> H323 GW -> SIP Trunk -> Proprietary device -> Analog phone Calls complete both ways with no issues. Proprietary devices only uses