HOW TO USE SUBSTR IN PARTITIONING

HEY ALL,
CAN I USE SUBSTR IN PARTITIONING
LIKE DIS
create table test
process_id number(19),
name varchar2(15))
partition by range(process_id)
partition p1 values less than (substr(process_oid,-1))
tablespace test,
partition p2 values less than (substr(process_oid,-1))
tablespace test,
partition p3 values less than (maxvalue)
tablespace test
)

No. You cannot use like that.
Why don't you run your CREATE statement and check it for yourself. You will get the below error
ORA-14019: partition bound element must be one of: string, datetime or interval
literal, number, or MAXVALUE

Similar Messages

  • How to use substring in  ITS(HTML file)

    Hai,
    I am modifying d_searchhelp.html file in agate. I want a use a substring function this file. So I used the below code.
      newclassname=~searchhelpcontrolname;
      oldclassname=newclassname.substring(0,8);
                                                                ^ ^ ^
    This is the error i got when i use this HTML file in searchhelp.
    @ ...\templates\system\dm\msiexplorer\d_searchhelp.html (263,42): error : syntax error   : '('
    @ ...\templates\system\dm\msiexplorer\d_searchhelp.html (263,44): error : syntax error   : ','
    @ ...\templates\system\dm\msiexplorer\d_searchhelp.html (263,46): error : syntax error   : ')'
    Please let me know how to use substring.
    Thanks & Regards,
    H.K.Hayath Basha

    Hello H.K.Hayath Basha,
    please see the HTML Business documentation on <http://help.sap.com/saphelp_nw04/helpdata/en/5f/1fb5174aee11d189740000e8322d00/frameset.htm>:
      string strSub (in string string, in int position, in int length)
    With regards,
      TJ

  • How can use row_number() over partition by plz provide some doc.

    row_number() over (partition by)
    what is this and how can use it in sql query.
    if ur have any documentation of it. plz give...me..
    thanx sir
    thanx in advance.

    http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96540/functions105a.htm
    SELECT empno, deptno,
    row_number() over (partition by deptno order by empno) rn
    from scott.emp
         EMPNO     DEPTNO RN                                    
          7782             10     1
          7839             10     2
          7934             10     3
          7369             20     1
          7566             20     2
          7788             20     3
          7876             20     4
          7902             20     5
          7499             30     1
          7521             30     2
          7654             30     3
          7698             30     4
          7844             30     5
          7900             30     6Regards
    Dmytro

  • How to use substr in external table defnition.

    Hi All,
    Im using oracle 11g. I have an external table which is reading data from a file. For one of the column, i need to get only the first 250 characters. My external table defnition looks like this
    create table tbl_substr
    ( col1 varchar2(20),
    col2 varchar2(250)
    organization external
    ( type oracle_loader
    default directory XXXX
    access parameters (
    records delimited by newline
    FIELDS TERMINATED BY '|'
    missing field values are null
    ( col1 ,
    col2 "substr(:col2,1,250)"
    ) ) location ('file.txt') )
    reject limit unlimited
    But this defnition gives an error when i do select * from tbl_substr
    I want to use substr in external table defnition its self and not in SELECT. Also i dont want to crete a view to solve this. If anyone has done this please help.

    You need to play with COLUMN_TRANSFORMS
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/et_params.htm#sthref1792
    BTW, i too got it from Google. I was not aware about this :)
    Amardeep Sidhu

  • How to use Substring function with Case statement.

    Hello Everyone,
    I have one requirement where I have to use substring function on the field for report criteria.
    E.G.
    I have Branch Name Field where I have all branch names information, Now some of the branch names are too big with some extension after the name .
    now i want to substing it but the character length varies for each branch.
    so is there any way where we can use case statement where we can define that if branch name character are exceeding some value then substing it with this length.

    Try something like this:
    CASE WHEN LENGTH(tablename.Branch_Name) > n THEN SUBSTRING(...) ELSE tablename.Branch_Name END
    where n is the number of characters you want to start the break.

  • How to use substring ?

    guys,
    i have to get last 3 char. of the char. string.
    now the problem is, the char. string is all different length. if it was the same i could use SUBSTRING formula. but in my case its all diff. and i have to get last 3 char. from the string .
    what shoud i use ?

    Hi Honar,
    Try this
    //<varname>- value whose last 3 character you want to read
    Data : v_length type n length 3,
              v_value_last3 like <varname> .
    *****read the length of value
    v_length = STRLEN(  <varname> ) .
    *****subtract string length index by 3 character
    v_length  = v_length - 3 .
    *****read last 3 character of value
    v_value_last3  =  <varname>+v_length(3) .
    v_value_last3 will have last 3 character
    Please follow spaces as in code .
    This will work .
    Regards,
    Jaya Tiwari

  • How to use a 2nd partition for data storage?

    The 40 GB hard disk on my satellite L10 was delivered with two 20 GB partitions (drive C and D). I now understand (by reading this forum) that it is preferred to use one partition for data storage.
    Until now there was no need to use the D-drive. But by now I need the extra space.
    How can I use the folders structure in windows XP home (My Documents etc) and put the data on the D-drive.
    We work on this computer with several accounts.
    I tried to move one folder out of My Documents to the D-drive, but then it can be reached by the other users. Should I use shortcuts towards the D-drive? I hope there is a simple solution.
    Thanks in advance.
    (I tried my best to write this in English....)

    Hi
    I didnt tried it before but you can try to make your personal folder on D partition. The notebook administrator should set the security settings that can be found under folder properties. Go to Security tab and check all permissions for other users. Choose Deny option for all of them.
    I believe that on this way you can use your data folder alone and be sure that other users can not read or execute any of your private data.
    Please let me know if it works properly.
    Bye

  • How to use substring on a property within a "select -expand properties" statement

    Apologies if this is a dumb question - I'm just familiarizing myself with Powershell.
    I have an existing script which queries groups in AD. It outputs some attributes of the groups to a CSV file.
    I'm trying to modify it a little bit - one of the attributes it returns is the distinguishedname of each group. I'm trying to get it to chop off the first part ("CN=groupname,"), leaving the OU path of each group.
    Here is the original line that I think needs to be modified:
    $AllGroups = $GroupAccounts | select -Expand Properties | select @{n='GroupName';e={$_.name}}, @{n='Description';e={$_.description}}, @{n='DN';e={$_.distinguishedname}}
    Based on what I've gleaned so far about Powershell, I figured I would use the substring function, along with the length of the group's name (plus 4 to account for the "CN=" and the first comma). But every variation that I've tried returns nothing
    at all for the last property ("DN").  
    Any suggestions?

    Hi,
    Here's an example:
    Get-ADUser testac1 |
    Select @{N='DN';E={$_.DistinguishedName.Substring($_.DistinguishedName.IndexOf(',')+1)}}
    Output:
    DN
    OU=Test 1,DC=domain,DC=local
    Don't retire TechNet! -
    (Don't give up yet - 12,950+ strong and growing)

  • How to use substr?

    Hi,
    I have strings like abc.x.02 or abc.x, and I want to get the x right after abc. and before next ., this is what I tried and failed:
    select substr('abcd.x.02', instr('abcd.x.02', '.', 1)+1, instr('abcd.x.02', '.', 1)+1 ) as Rev_ID from dual ;
    how to fix this?
    Thanks

    This should work
    select substr('abcd.x',
    instr('abcd.x', '.', 1)+1,
    (decode( (instr('abcd.x', '.', 1, 2)),
    0, length('abcd.x'),
    ( (instr('abcd.x', '.', 1, 2)-1) - (instr('abcd.x', '.', 1)))
    from dual ;
    S
    x
    select substr('abcd.x.2',
    instr('abcd.x.2', '.', 1)+1,
    (decode( (instr('abcd.x.2', '.', 1, 2)),
    0, length('abcd.x.2'),
    ( (instr('abcd.x.2', '.', 1, 2)-1) - (instr('abcd.x.2', '.', 1)))
    from dual;
    S
    x
    I came up with a similar solution at first too but it only works for the case abcd.x.02. The other requirement was that
    it work for strings like abc.x too. This statement returns a null value in that case.
    How about this.....
    select substr('abcd.x.02', instr('abcd.x.02', '.', 1)+1, ((instr('abcd.x.02', '.', 1, 2)-1) - (instr('abcd.x.02', '.', 1))))
    from dual

  • How to use Substr & Instr to get data from a file

    hi i have a Scenario
    i am getting a file like this
    1,20,ram,sales
    i am getting a file like this data as a column
    i want to split this data in 4 different column like
    1     20      ram     Sales

    Hi,
    this query will help you.
    select
         SUBSTR(C1,0,INSTR(C1,',')-1),
         SUBSTR(C1,INSTR(C1,',')+1,INSTR(C1,',',1,2)-INSTR(C1,',',1,1)-1),
         SUBSTR(C1,INSTR(C1,',',1,2)+1,INSTR(C1,',',1,3)-INSTR(C1,',',1,2)-1),
         SUBSTR(C1,INSTR(C1,',',1,3)+1,INSTR(C1,',',1,4)-INSTR(C1,',',1,3)-1),
         SUBSTR(C1,INSTR(C1,',',1,3)+1)
    from (
         select '1,20,ram,sales' C1 from dual
    remember that a comma isn't really safe as field separator
    Message was edited by: DecaXD

  • How to Split the string using Substr and instr using loop condition

    Hi every body,
    I have below requirement.
    I need to split the string and append with single quotes('') followed by , (comma) and reassign entire values into another variable. so that i can use it where clause of update statement
    for example I am reciveing value as follows
    ALN varchar2(2000):=(12ERE-3MT-4Y,4IT-5O-SD,OP-K5-456,P04-SFS9-098,90P-SSF-334,3434-KJ4-O28,AS3-SFS0-J33,989-3KL-3434);
    Note: In the above variable i see 8 transactions, where as in real scenario i donot how many transaction i may recive.
    after modification i need above transactions should in below format
    ALTR Varchar2(2000):=('12ERE-3MT-4Y','4IT-5O-SD','OP-K5-456','P04-SFS9-098','90P-SSF-334','3434-KJ4-O28','AS3-SFS0-J33','989-3KL-3434');
    kindly help how to use substr and instr in normal loop or for loop or while loop while modifying the above transactions.
    Please help me to sort out this issue.
    Many Thanks.
    Edited by: user627525 on Dec 15, 2011 11:49 AM

    Try this - may not be the best way but...:
    create or replace type myTableType as table of varchar2(255)
    declare
    v_array mytabletype;
    v_new_str varchar2(4000);
    function str2tbl
             (p_str   in varchar2,
              p_delim in varchar2 default '.')
             return      myTableType
        as
            l_str        long default p_str || p_delim;
             l_n        number;
             l_data     myTableType := myTabletype();
        begin
            loop
                l_n := instr( l_str, p_delim );
                exit when (nvl(l_n,0) = 0);
                l_data.extend;
                l_data( l_data.count ) := ltrim(rtrim(substr(l_str,1,l_n-1)));
                l_str := substr( l_str, l_n+length(p_delim) );
            end loop;
            return l_data;
       end;
    begin
      v_array := str2tbl ('12ERE-3MT-4Y,4IT-5O-SD,OP-K5-456,P04-SFS9-098,90P-SSF-334,3434-KJ4-O28,AS3-SFS0-J33,989-3KL-3434', ',');
          FOR i IN 1 .. v_array.COUNT LOOP
             v_new_str := v_new_str || ''''||v_array(i)||'''' || ',';
          END LOOP;
       dbms_output.put_line(RTRIM(v_new_str, ','));
    end;  
    OUTPUT:
    =======
    '12ERE-3MT-4Y','4IT-5O-SD','OP-K5-456','P04-SFS9-098','90P-SSF-334','3434-KJ4-O28','AS3-SFS0-J33','989-3KL-3434'HTH
    Edited by: user130038 on Dec 15, 2011 12:11 PM

  • How to use Oracle partitioning with JPA @OneToOne reference?

    Hi!
    A little bit late in the project we have realized that we need to use Oracle partitioning both for performance and admin of the data. (Partitioning by range (month) and after a year we will move the oldest month of data to an archive db)
    We have an object model with an main/root entity "Trans" with @OneToMany and @OneToOne relationships.
    How do we use Oracle partitioning on the @OneToOne relationships?
    (We'd rather not change the model as we already have millions of rows in the db.)
    On the main entity "Trans" we use: partition by range (month) on a date column.
    And on all @OneToMany we use: partition by reference (as they have a primary-foreign key relationship).
    But for the @OneToOne key for the referenced object, the key is placed in the main/source object as the example below:
    @Entity
    public class Employee {
    @Id
    @Column(name="EMP_ID")
    private long id;
    @OneToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="ADDRESS_ID")
    private Address address;
    EMPLOYEE (table)
    EMP_ID FIRSTNAME LASTNAME SALARY ADDRESS_ID
    1 Bob Way 50000 6
    2 Sarah Smith 60000 7
    ADDRESS (table)
    ADDRESS_ID STREET CITY PROVINCE COUNTRY P_CODE
    6 17 Bank St Ottawa ON Canada K2H7Z5
    7 22 Main St Toronto ON Canada     L5H2D5
    From the Oracle documentation: "Reference partitioning allows the partitioning of two tables related to one another by referential constraints. The partitioning key is resolved through an existing parent-child relationship, enforced by enabled and active primary key and foreign key constraints."
    How can we use "partition by reference" on @OneToOne relationsships or are there other solutions?
    Thanks for any advice.
    /Mats

    Crospost! How to use Oracle partitioning with JPA @OneToOne reference?

  • I have a 1TB external hard drive (NTFS) that has all my files from my old PC, how do I create a partition on it for HFS  without formatting it so that I can use it for Time Machine and the like?

    I have a 1TB external hard drive (NTFS) that has all my files from my old PC, how do I create a partition on it for HFS  without formatting it so that I can use it for Time Machine and the like?

    There aren't any 3rd party apps or anything. I use PC's and Mac's at school and the only computer connected to a printer at my house is a PC so i need access to both

  • How to use SQL OVER and PARTITION BY in OBIEE Expression Builder??

    Hi there,
    I want to create a new logical coulmn with the following SQL query.
    SUM(Inventory Detail.Qty) OVER(PARTITION BY Inventory Detail.A,Inventory Detail.B,Item.C,Inventory Detail.D,MyDATE )/SUM(Inventory Detail.Qty) OVER(PARTITION BY Inventory Detail.A,Inventory Detail.B,Item.C )
    How to use the OVER and PARTITION BY in OBIEE Expression Builder??
    Thanks in Advance

    hi bipin,
    We cant use by in Expression builder(rpd) .But use the same formula like this in Fx of answers
    SUM(Inventory Detail.Qty) OVER(PARTITION BY Inventory Detail.A,Inventory Detail.B,Item.C,Inventory Detail.D,MyDATE )/SUM(Inventory Detail.Qty) >OVER(PARTITION BY Inventory Detail.A,Inventory Detail.B,Item.C )SUM(Inventory Detail.Qty by Detail,ITEM,Mydate)/SUM(qty by detail,item)
    First check the numerator whether it was giving correct results or not then go with denominator
    compare the results with sql that u have
    Let me know if that does work
    thanks,
    saichand.v
    Edited by: Saichand Varanasi on Jul 27, 2010 9:27 PM
    Edited by: Saichand Varanasi on Jul 27, 2010 9:28 PM

  • How to use partition by instead of group by?

    Hi,
    I am having trouble using partition by clause in following case,
    column other_number with null values contains 10 records in 'some_table'
    5 records with date 11-01-2009, item_code = 1
    5 records with date 10-01-2009, item_code = 2
    This query returns all 10 records, (which suppose to return 2)
    SELECT count (a.anumber) over (partition by TO_char(a.some_date,'MM'), a.item_code) AS i_count, a.item_code,
    TO_char(a.some_date,'MM')
         FROM some_table
         WHERE to_char(a.some_date,'yyyy') = 2009
         AND a.other_number IS NULL
    Works fine if I wrote like this,
    SELECT count (a.anumber) AS i_count, a.item_code,
    TO_char(a.some_date,'MM')
         FROM some_table
         WHERE to_char(a.some_date,'yyyy') = 2009
         AND a.other_number IS NULL
    group by TO_char(a.some_date,'MM'), a.item_code
    How to use partition by in this case?

    Hi,
    Almost all of the aggregate functions (the ones you use in a GROUP BY query) have analytic counterparts.
    You seem to have already discovered that whatever values are returned by
    an aggregate funcition using "GROUP BY x, y, z" can also be found with
    an analytic function using "PARTITION BY x, y. z".
    Aggregate queries collapse the result set.
    The aggregate COUNT function:
    SELECT    deptno
    ,         COUNT (*)   AS cnt
    FROM       scott.emp
    GROUP BY  deptno
    ;tells how many of the 14 employees are in each of the 3 departments.
    So does the analytic COUNT function:
    SELECT    deptno
    ,         COUNT (*) OVER (PARTITION BY deptno)   AS cnt
    FROM       scott.emp
    ;but the first query produces 3 rows of output, the second query produces 14.
    You could get 3 rows of output using the analytic function and SELECT DISTINCT , but it's inefficient.
    Which should you use? Like so many other things, the answer depends on what data you have, and what results you want from that data.
    If you want collapsed results (one row per group), that's a striong indication that you'll want aggregate, not analytic functions.
    If you want one row of output for every row in the table, that's a strong indication that you'll want analytic functions.
    If you have a particular question, ask it. Post some sample data and the results you want from that data, as Rob said.
    There is another important difference between aggreate and analytic functions: analytic functions can easily be restricted to a window , or subset, of the data set. This is something like a WHERE clause, but a WHERE clause applies to the whole query: a wondowing condition applies only to an individual row.
    If you need to compute a SUM of rows with an earlier order_date than this row or an average of the last 5 rows, then you proabably want to use analytic function.

Maybe you are looking for

  • How do I reduce the size of a scanned PDF file?

    I scanned a document from my HP Printer to a thumb drive.  The document is too large to email.  I need to reduce the size to make it possible to email it.  I can't find anything in the Tutorials or Manual on how to do that.  Does anyone know?

  • Abap code with relevant capital lettres and small letters

    Hi all, i wrote my code in capital letters and i want to change tables and data objects and other stuff into small letters .Is there any option in abap editor to change the code  as per the SAP standards. Thanks, Madhu

  • Mac Pro (late 2013) New ssd not seen in disk utility

    Hi Guys :-) I have a quirky problem. I've run out of harddrive space, so I bought a new 1 TB SSD via Ebay, which is an original SSD from Samsung. A month ago I bought another SSD, which didn't show up, so I sent it back thinking it was a faulty drive

  • Text tool bug

    Just installed CS4. Using Flash on a new project. Whenever I try to change the font on my text tool options, Flash crashes on me. Is anyone else experiencing this? Does anyone have a solution?

  • Forecast requirement and CIF

    Hi, I have an active integration model between R/3 and APO. When I create a forecast requirement in APO in the product view (/sapapo/rrp3), it is not reflected in the R/3 (md04). Could you give me some pointers to this? Also, I have similar issue whe