I HAVE ONE VARCHAR2 COLUMN.

hI
i HAVE ONE VARCHAR2 COLUMN. IN THIS COLUMN I STROED ALL CHARECTER DATA .SOME EXCTION FILE NAME ,
TEST.DOC,TEST2.DOC,TEST3.DOC AND TEXT_MAIN.DOC NOW I WANT EXTRACT STRING UP TO . CHARECTER WHICH FUNCTION I WANT USE TO GET THE VALUE UP TO . CHERECTER,MEANS I DON'T WANT TO EXTENSION I WANT ONLY FILE NAME.
thank's

You did not mention the version of Oracle you are using
SQL> with d as
    ( select 'test.doc' name from dual union all
      select 'test2.doc' from dual
    select name, regexp_substr(name,'[^.]+') str
    , substr(name,1,instr(name,'.')-1) str9iVersion
   from d
NAME      STR       STR9IVERS
test.doc  test      test
test2.doc test2     test2SS

Similar Messages

  • Updating one varray  column in a table

    Hi ,
    We are using 10gR2 on AIX . I have one varray column in a table which has be updated ..To update this column , data is fetched in a query by using 2 tables.Is there any way to reduce the update time?
    Edited by: Minu on 25-Apr-2011 20:24

    HOW TO: Post a SQL statement tuning request - template posting

  • How to Read the one Source Column data and Display the Results

    Hi All,
         I have one PR_ProjectType Column in my Mastertable,Based on that Column we need to reed the column data and Display the Results
    Ex:
    Pr_ProjectType
    AD,AM
    AD
    AM
    AD,AM,TS,CS.OT,TS
    AD,AM          
    like that data will come now we need 1. Ad,AM then same we need 2. AD also same we need 3. AM also we need
    4.AD,AM,TS,CS.OT,TS in this string we need AD,AM  only.
    this logic we need we have thousand of data in the table.Please help this is urgent issue
    vasu

    Hi Vasu,
    Based on your description, you want to eliminate the substrings (eliminated by comma) that are not AD or AM in each value of the column. Personally, I don’t think this can be done by just using an expression in the Derived Column. To achieve your goal, here
    are two approaches for your reference:
    Method 1: On the query level. Replace the target substrings with different integer characters, and create a function to eliminate non-numeric characters, then replace the integer characters with the corresponding substrings. The statements
    for the custom function is as follows:
    CREATE FUNCTION dbo.udf_GetNumeric
    (@strAlphaNumeric VARCHAR(256))
    RETURNS VARCHAR(256)
    AS
    BEGIN
    DECLARE @intAlpha INT
    SET @intAlpha = PATINDEX('%[^0-9]%', @strAlphaNumeric)
    BEGIN
    WHILE @intAlpha > 0
    BEGIN
    SET @strAlphaNumeric = STUFF(@strAlphaNumeric, @intAlpha, 1, '' )
    SET @intAlpha = PATINDEX('%[^0-9]%', @strAlphaNumeric )
    END
    END
    RETURN ISNULL(@strAlphaNumeric,0)
    END
    GO
    The SQL commands used in the OLE DB Source is like:
    SELECT
    ID, REPLACE(REPLACE(REPLACE(REPLACE(dbo.udf_GetNumeric(REPLACE(REPLACE(REPLACE(REPLACE([ProjectType],'AD,',1),'AM,',2),'AD',3),'AM',4)),4,'AM'),3,'AD'),2,'AM,'),1,'AD,')
    FROM MyTable
    Method 2: Using a Script Component. Add a Derived Column Transform to replace the target substrings as method 1, use Regex in script to remove all non-numeric characters from the string, add another Derived Column to replace the integer
    characters to the corresponding substring. The script is as follows:
    using System.Text.RegularExpressions;
    Row.OutProjectType= Regex.Replace(Row.ProjectType, "[^.0-9]", "");
    References:
    http://blog.sqlauthority.com/2008/10/14/sql-server-get-numeric-value-from-alpha-numeric-string-udf-for-get-numeric-numbers-only/ 
    http://labs.kaliko.com/2009/09/c-remove-all-non-numeric-characters.html 
    Regards,
    Mike Yin
    TechNet Community Support

  • Coding Datagrid to adjust the width of one of column?

    I have one special column with long content, so I want to
    display it with different width column. Is there any interface let
    me do that?
    thanks.

    Set the DataGridColumn width property? Perhaps I am not
    understanding your question.
    Tracy

  • In ITunes I don't have a listing in the column for "Devices" so I can check to see if I have sync all ringtones.  I have one downloaded but can't get it synced to my Iphone.

    In Itunes I don't have a listing in the column for "Devices" so I can check to see if my Iphone can sync all my new ringtones.  I have one ready to go but cannot get it downloaded to my Iphone.  Where is my "Devices" heading in the column on the left side of my Itunes page?

    Connect your device to computer.  In iTunes left Pane, select your iPhone under 'Devices'.  Then on th right Pane, select Tones tab.

  • More than one SDO_GEOMETRY columns in one Oracle 8i spatial table

    I have a spatial table as follows:
    CREATE TABLE TEST(
    ID VARCHAR2(255) NOT NULL,
    POINT MDSYS.SDO_GEOMETRY,
    LINE MDSYS.SDO_GEOMETRY,
    POLYGON MDSYS.SDO_GEOMETRY,
    PRIMARY KEY(ID));
    Is it a good practice to have more than one SDO_GEOMETRY columns
    in one spatial table? What are the drawbacks if any to have a
    spatial with more than one layer?

    I have one question about more than one SDO_GEOMETRY columns
    in one table in Oracle 8.1.7. When I wanted to create two
    spatial indices for this table, every time I got some error.
    Can anyone tell me how to figure it out?
    Thanks very much,
    Fan Fan,
    You need to insert metadata record before creating spatial
    indices.
    Try the following:
    REM USER_SDO_GEOM_METADATA :
    REM insert a row for the geom layer for TEST TEST2 tables
    REM
    INSERT INTO USER_SDO_GEOM_METADATA
    ( TABLE_NAME, COLUMN_NAME, DIMINFO, SRID)
    VALUES ('TEST', 'POINT', MDSYS.SDO_DIM_ARRAY
    (MDSYS.SDO_DIM_ELEMENT('LON', -180,
    180, .000005),MDSYS.SDO_DIM_ELEMENT('LAT', -90, 90, .000005)),
    NULL);
    INSERT INTO USER_SDO_GEOM_METADATA
    ( TABLE_NAME, COLUMN_NAME, DIMINFO, SRID)
    VALUES ('TEST', 'LINE', MDSYS.SDO_DIM_ARRAY
    (MDSYS.SDO_DIM_ELEMENT('LON', -180,
    180, .000005),MDSYS.SDO_DIM_ELEMENT('LAT', -90, 90, .000005)),
    NULL);
    INSERT INTO USER_SDO_GEOM_METADATA
    ( TABLE_NAME, COLUMN_NAME, DIMINFO, SRID)
    VALUES ('TEST', 'POLYGON', MDSYS.SDO_DIM_ARRAY
    (MDSYS.SDO_DIM_ELEMENT('LON', -180,
    180, .000005),MDSYS.SDO_DIM_ELEMENT('LAT', -90, 90, .000005)),
    NULL);
    REM create a spatial index based on TRAFFIC.GEOM
    REM
    REM
    CREATE INDEX TEST_G_POINT_IDX ON TEST(POINT) INDEXTYPE IS
    MDSYS.SPATIAL_INDEX;
    CREATE INDEX TEST_G_LINE_IDX ON TEST(LINE) INDEXTYPE IS
    MDSYS.SPATIAL_INDEX;
    CREATE INDEX TEST_G_POLYGON_IDX ON TEST(POLYGON) INDEXTYPE IS
    MDSYS.SPATIAL_INDEX;

  • How to add one date column and charecter column

    hi all,
    i have 3 column start_date(date),end_date( date),duration (varchar2)
    i am trying to add start_time and duration like this
    end_date := to_char(start_time) + duration;
    but its showing value_error
    how to add one date column and charecter column.
    Thanks

    you need something that does:
    end_date (DATE) := start_date (DATE) + <number of
    days> (NUMBER)Not necessarily, because if the duration is just a string representation of a number then it will be implicitly converted to a number and not cause an error
    e.g.
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select to_date('01/07/2007','DD/MM/YYYY') as start_dt, '3' as duration_days from dual)
      2  -- END OF TEST DATA
      3  select start_dt + duration_days
      4* from t
    SQL> /
    START_DT+
    04-JUL-07

  • Storing more than 2000 characters in a varchar2 column in Oracle 11g?

    We have a table in Oracle 11g with a varchar2 column. We use a proprietary programming language where this column is defined as string. Maximum we can store 2000 characters (4000 bytes) in this column. Now the requirement is such that the column needs to store more than 2000 characters. The DBAs don't like BLOB, CLOB or LONG datatypes for maintenance reasons.
    There are 2 solutions I can think of -
    1. Remove this column from the original table and have a separate table for this column and then store each character in a row, in order to get more than 2000 characters. This table will be joined with the original table for queries.
    2. If maximum I need is 8000 characters, can I just add 3 more columns so that I will have 4 columns with 2000 char each to get 8000 chars. So when the first column is full, values would be spilled over to the next column and so on.
    Which one is a better and easier approach? Please suggest.

    Visu - Some people also do not like to use LOBs because of difficulty in reclaiming space and ever increasing LOB segments. Some of these problems were caused by Oracle bugs (eg, Bug 2944866 Free space in LOB table / tablespace not reused with ASSM, Bug 3019979 Space may not be reused efficiently in a LOB segment) - albeit in 9.2. I've seen a few bug reports for similar things in 10.2 (don't have the references). Still, if there is a workaround/patch is this reason enough to steer the application development into a new direction?

  • Sort Order for a VARCHAR2 Column

    Hello Everyone,
    This is probably quite simple, however I cannot see it. I am trying to sort on a varchar2 column that has numbers, text, dashes, tildes, carets and underscores which are mixed to compose a wire number. I have come up with an order by that changes the sort order from alpha to numeric satisfying one portion of the requirement.
    select wirenbr,fromitem "from",frompin,diagnbr,sht,toitem,topin,effect
    from acft_wires
    order by decode(to_char(nvl(length(translate(wirenbr,'A1234567890','A')),0)),'0',lpad(wirenbr,18),wirenbr);
    The select returns:
    1
    2
    3
    20
    21
    200
    201
    1000
    A
    ADT1
    AEN1
    AE1
    AE9
    AFA
    B
    1A
    2U7230A-ZZ
    2000A
    213-22
    22X100A20
    220-11
    The customer preferred sort looks like:
    1
    2
    3
    10
    10A
    11
    200
    201
    201-01
    202
    1000
    1000A
    1001
    I will build a shrine in my hall of honor to this forum if someone can point me in the right direction on how to solve this problem.
    Thanks everyone for your help.

    ok, start with this
    order by
    translate(substr(wirenbr,1,1),'1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ-','0000000000ZZZZZZZZZZZZZZZZZZZZZZZZZZZ')
    , nvl(length(substr(wirenbr,1,instr(translate(wirenbr,'1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ-','1234567890XXXXXXXXXXXXXXXXXXXXXXXXXXX'),'X')-1)),length(wirenbr))
    , to_number(translate(wirenbr,'1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ-','123456789000000000000000000000000000'))
    First, all that start with number go to the beginning and all that start with a letter go to the end.
    Next, sort by the length of the first numerical part, as per Al's first solution.
    Next, sort by the numerical part.
    I started getting what I think is the right sort by that point. However, I think that you'll also have to add
    stuff to sort by the alpha part, mine was
    , NVL(RTRIM(LTRIM(wirenbr,'0123456789'),'0123456789'),0)
    The biggest problem I see is all of the different number-letter-number
    number-letter-number-letter formats. How many levels of recursion you'll have to go through to get it perfectly sorted, could you have ZZ999ZZ99Z9Z9Z9Z99?
    Any ideas for breaking this value up?

  • Range Partitioning on Varchar2 column???

    We hava table and it has a date column and its type is varchar2.
    This column's format is '16021013' ('ddmmyyyy').
    We want to make range partition on this column. What will be the best way?
    do you think virtal column partitioning will be efficient?

    >
    I'm not a new DBA:-) You can be sure. I asked only about range partitioning trick with varchar2 column because we did our examination about this table. We will need to archive this table quarter by quarter to the other archive database. Then, off course, nearly all queries are coming firstly by using this date column and they can have different filtering inside "where" conditions. Already, this table has index on this column but with huge number of data, index performance is not enough for us. This is a 7x24 banking system and we are lately joined to this project. Because of this, we cant change everything like changing data type of that column after this moment.
    >
    You are taking things way too personally. No one said anything about whether you were, or were not, a DBA or made any other comments about your skill or abilities.
    What we ask was for you to tell us WHAT the problem was that you were trying to solve and WHY you thought partitioning would solve it.
    And now, after several generic posts, you have finally provided that information. We can only comment based on the information that you post. We can't guess as to what types of queries you use or what kinds of predicates you use in those queries. But we need to know that information in order to provide the best advice.
    Next time you post put the important information in your original question:
    1. A table column is VARCHAR2 but contains a date value. We are unable to change the datatype of this column.
    2. We need to archive data quarterly based on this date value
    3. Nearly all queries use this date value and then also may have additional filter conditions
    4. This date column is indexed but we would like to improve the performance beyond what this index can give us.
    The above is a summary that includes all important information that is needed to know how best to help you.
    And I made a pretty good guess since two replies ago I provided you with example code that shows just how to partition the table.
    >
    Now, our only aim is how to make range partitioning this varchar2 date column.
    >
    As I showed you in my example code earlier you can add a virtual column to the table and partition on it. My example code creates a monthly partitioned table that allows you to archive by month or archive every three months to archive by quarter.
    You can modify that example to use quarterly partitions if you want but I would recommend that you use standard monthly partitions since they will satisfy the widest range of predicates.

  • Format varchar2 column which stores a number and display it in 10,000 forma

    Problem Description
    I am having a Standard VO , which has a varchar2 datatype attribute.
    In my view page i am dispaly this vo in a OATABLE.
    I want to foramt one of the varchar2 column to display it in a requried format
    Eg :- if the value in the column is 9999 i want to display it as 9,999.
    I have tried few sources but i did not work...
    I tried all the sources metioned below
    OAMessageStyledTextBean arcmrecovalue1=(OAMessageStyledTextBean)oawebbean.findChildRecursive("Arcmrecovalue2");
    arcmrecovalue1.setDataType("NUMBER");
    arcmrecovalue1.setAttributeValue(TABULAR_FUNCTION_VALUE_ATTR,formatter);
    String currency = "USD";
    arcmrecovalue1.setAttributeValue(CURRENCY_CODE,currency);
    arcmrecovalue1.setAttributeValue(OAWebBeanConstants.CURRENCY_CODE,"USD");;
    arcmrecovalue1.setAttributeValue(*ON_SUBMIT_VALIDATER_ATTR*,*formatter*);
    OAMessageStyledTextBean arcmrecovalue2=(OAMessageStyledTextBean)oawebbean.findChildRecursive("Arcmrecovalue2");
    if(arcmrecovalue2 != null)
    String arcmrecovalue = (String)((OAMessageStyledTextBean)oawebbean.findChildRecursive("Arcmrecovalue2")).getValue(oapagecontext);
    String retValue = null;
    try
    OADBTransaction oadbtransaction = l_rootAM.getOADBTransaction();
    String s = "{? = call convert_string(?)}";
    OracleCallableStatement oraclecallablestatement = (OracleCallableStatement)oadbtransaction.createCallableStatement(s,0);
    oraclecallablestatement.registerOutParameter(1,Types.VARCHAR);
    oraclecallablestatement.setString(2,arcmrecovalue);
    oraclecallablestatement.execute();
    retValue = oraclecallablestatement.getString(1);
    catch(SQLException sqlexception)
    throw OAException.wrapperException(sqlexception);
    catch(Exception exception)
    throw OAException.wrapperException(exception);
    arcmrecovalue2.setAttributeValue("Arcmrecovalue2",retValue);
    * The sql function wil return the formatted string.. but it is able to format only the first value of the table.. the second row is not formatted.
    Can anyone help me

    Problem Description
    I am having a Standard VO , which has a varchar2 datatype attribute.
    In my view page i am dispaly this vo in a OATABLE.
    I want to foramt one of the varchar2 column to display it in a requried format
    Eg :- if the value in the column is 9999 i want to display it as 9,999.
    I have tried few sources but i did not work...
    I tried all the sources metioned below
    OAMessageStyledTextBean arcmrecovalue1=(OAMessageStyledTextBean)oawebbean.findChildRecursive("Arcmrecovalue2");
    arcmrecovalue1.setDataType("NUMBER");
    arcmrecovalue1.setAttributeValue(TABULAR_FUNCTION_VALUE_ATTR,formatter);
    String currency = "USD";
    arcmrecovalue1.setAttributeValue(CURRENCY_CODE,currency);
    arcmrecovalue1.setAttributeValue(OAWebBeanConstants.CURRENCY_CODE,"USD");;
    arcmrecovalue1.setAttributeValue(*ON_SUBMIT_VALIDATER_ATTR*,*formatter*);
    OAMessageStyledTextBean arcmrecovalue2=(OAMessageStyledTextBean)oawebbean.findChildRecursive("Arcmrecovalue2");
    if(arcmrecovalue2 != null)
    String arcmrecovalue = (String)((OAMessageStyledTextBean)oawebbean.findChildRecursive("Arcmrecovalue2")).getValue(oapagecontext);
    String retValue = null;
    try
    OADBTransaction oadbtransaction = l_rootAM.getOADBTransaction();
    String s = "{? = call convert_string(?)}";
    OracleCallableStatement oraclecallablestatement = (OracleCallableStatement)oadbtransaction.createCallableStatement(s,0);
    oraclecallablestatement.registerOutParameter(1,Types.VARCHAR);
    oraclecallablestatement.setString(2,arcmrecovalue);
    oraclecallablestatement.execute();
    retValue = oraclecallablestatement.getString(1);
    catch(SQLException sqlexception)
    throw OAException.wrapperException(sqlexception);
    catch(Exception exception)
    throw OAException.wrapperException(exception);
    arcmrecovalue2.setAttributeValue("Arcmrecovalue2",retValue);
    * The sql function wil return the formatted string.. but it is able to format only the first value of the table.. the second row is not formatted.
    Can anyone help me

  • Oracle Best practices for changing  Byte to Char on Varchar2 columns

    Dear Team,
    Application Team wanted to change Byte to Char on Varchar2 columns to accommodate Multi byte character  on couple of production tables.
    Wanted to know is it safe to have mixture of BYTE and CHAR semantics in the same table i have read on the couple of documents that It's good practice to avoid using a mixture of BYTE and CHAR semantics columns in the same table.
    What happens if we have mixture of BYTE and CHAR semantics columns in the same table?
    Do we need to gather stats & rebuild indexes on the table after these column changes .
    Thanks in Advance !!!
    SK

    Application Team wanted to change Byte to Char on Varchar2 columns to accommodate Multi byte character  on couple of production tables.
    Wanted to know is it safe to have mixture of BYTE and CHAR semantics in the same table i have read on the couple of documents that It's good practice to avoid using a mixture of BYTE and CHAR semantics columns in the same table.
    No change is needed to 'accommodate Multibyte characters'. That support has NOTHING to do with whether a column is specified using BYTE or CHAR.
    In 11g the limit for a VARCHAR2 column is 4000 bytes, period. If you specify CHAR and try to insert 1001 characters that each take 4 bytes you will get an exception since that would require 4004 bytes and the limit is 4000 bytes.
    In practice the use of CHAR is mostly a convenience to the developer when defining columns for multibyte characters. For example for a NAME column you might want to make sure Oracle will allocate room for 50 characters REGARDLESS of the actual length in bytes.
    If you provide a name of 50 one byte characters then only 50 bytes will be used. Provide a name of 50 four byte characters and 200 bytes will be used.
    So if  that NAME column was defined using BYTE how would you know what length to use for the column? Fifty BYTES will seldom be long enough and 200 bytes SEEMS large since the business user wants a limit of FIFTY characters.
    That is why such columns would typically use CHAR; so that the length (fifty) defined for the column matches the logical length of the number of characters.
    What happens if we have mixture of BYTE and CHAR semantics columns in the same table?
    Nothing happens - Oracle could care less.
    Do we need to gather stats & rebuild indexes on the table after these column changes .
    No - not if you by 'need' you mean simply because you made ONLY that change.
    But that begs the question: if the table already exists, has data and has been in use without their being any problems then why bother changing things now?
    In other words: if it ain't broke why try to fix it?
    So back to your question of 'best practices'
    Best practices is to set the length semantics at the database level when the database is first created and to then use that same setting (BYTE or CHAR) when you create new objects or make DDL changes.
    Best practices is also to not fix things that aren't broken.
    See the 'Length Semantics' section of the globalization support guide for more best practices
    http://docs.oracle.com/cd/E11882_01/server.112/e10729/ch2charset.htm#i1006683

  • How to get date prompts from one date column

    i have a requirement where i have to filter the data between two date prompts. i have only one date column and the date in the prompts shuld be selected by calendar.
    i have seen may approaches to do this and i got one where two dummy date columns should be declared in repository and used to define the date prompts.
    but using other methods i could not get the calendar option in prompt.
    but is there any other way to get the prompts with calndar selection without defining the dummy columns in repository
    thanks

    you can do that first select the date column you want to use in dashboard prompt then select another column and in the dashboard prompts then open the fx of the date prompt you first selected copy that and paste it in the second column and in the control section click on calender it will work you can use same date column as two prompts with out creating new column.

  • Report on BEx query with 2 structures (one in rows and one in columns)

    Hi, experts! I have to make Crystall report on BEx query with 2 structures, one in columns (with KF's), and one in rows. Is it possible to create such report? Because when I create such report, I cant see fields in structures, only characteristics fields.
    Ok, I found samr problem in another thread. Sorry.
    Edited by: Mikhail Sychev on Dec 5, 2009 9:53 PM

    Hey Flora,
    Happy to hear that its working now.
    Answering your question, again its upto the connection and report format you are using. Based on your question i hope you your report output should be like this.
    You cannot map to two labels for the series, again this report format is possible only in cross tab through Webi. I would suggest you to concatenate the material and month in a dimension in webi like below.
    I have done the concatenation in excel level, i would suggest you to do that in webi. Try to reduce the formula as much in excel.
    or
    If you are using Query browser connection, then i would suggest you to create a separate report which will display the actual vs plan material wise, here you need to pass the material as a prompt.
    Hope this helps in clear, please revert me for any clarification.

  • Spatial index creation for table with more than one geometry columns?

    I have table with more than one geometry columns.
    I'v added in user_sdo_geom_metadata table record for every column in the table.
    When I try to create spatial indexes over geometry columns in the table - i get error message:
    ERROR at line 1:
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-13203: failed to read USER_SDO_GEOM_METADATA table
    ORA-13203: failed to read USER_SDO_GEOM_METADATA table
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD", line 8
    ORA-06512: at line 1
    What is the the solution?

    I'v got errors in my user_sdo_geom_metadata.
    The problem does not exists!

Maybe you are looking for

  • How to prevent concurrent Logon from same User ID

    I have my project setup in the following way : The User enters the UserName / Password in an html file and when authenticated is directed to the welcome.jsp which is a jsf jsp in the 'restricted' folder. Code for html file: <form  name="loginFrm" met

  • Insert PDF CS2

    Trying to get a PDF into a GoLIve page. I can't find the proper object. Can someone tell me how to get a multipage PDF into GL CS2, and have it capable of opening in a browser as a PDF? Thank you.

  • New App store interface tabs greyed out sometimes..

    Since the new app store look came out, often I see the tabs but they are unresponsive and I have to close app store and reopen it to be able to click on Updates for instance. Anyone else see this?

  • When i launch mfireforx a page opens(mozillafirefox start page) with just only ffox ICON and nothing else(no sheet similar to yahoo)

    2 weeks back our internet ofc changed my mozilla home page due to some minor mis-information from their side. Asked them to correct the situation. they told me to go to Tools and clean all History. After that problem started. When I launch mozilla fr

  • Unable to import core flash, fl packages

    I recenlty installed Flash CS3, and yesterday, everything was working beautifully. I'm not sure what happened, but I can no longer import any package starting from "flash" or "fl". Here's what I'm trying: 1) New Flash Document (AS3). 2) Create an act