Get only strings from Varchar2 Column

Hi,
How can I extract only strings form varchar2 type column?
I have data like below.
25-Abc xy
233-xyz jj
x23A
9-dd
5-aaa(pp)
I need following outputs (- also be removed)
Abc xy
xyz jj
xA
dd
aaa(pp)
Thanks,
Sujnan

Maybe...
API> WITH t AS (SELECT '25-Abc xy' AS col FROM DUAL
  2          UNION
  3          SELECT '233-xyz jj' FROM DUAL
  4          UNION
  5          SELECT 'x23A'  FROM DUAL
  6          UNION
  7          SELECT '9-dd'  FROM DUAL
  8          UNION
  9          SELECT '5-aaa(pp)'  FROM DUAL)
10    SELECT TRANSLATE(col, '1234567890-', ' ') AS RES
11    FROM t;
RES
xyz jj
Abc xy
aaa(pp)
dd
xA
Transcurrido: 00:00:00.93

Similar Messages

  • Get millisecond values from timestamp column in v$logmnr_contents

    Hello
    How do we get millisecond values from timestamp column in v$logmnr_contents.
    I tried with following query.
    select scn,To_Char(timestamp,'DD-MON-YYYY HH24:MI:SS:FF') from v$logmnr_contents WHERE OPERATION NOT IN('START') and username ='SCOTT' and sql_redo is not null and (seg_owner is null or seg_owner not in('SYS'));
    it says ORA-01821: date format not recognized. I want to find the relation of scn with timestamp. In forums i found, scn is derived from timestamp value. I dont know its correct or not.
    if i query with out FF in time format i get like
    scn timestamp
    808743 27-NOV-2007 00:12:53
    808743 27-NOV-2007 00:12:53
    808743 27-NOV-2007 00:12:53
    808744 27-NOV-2007 00:12:53
    808744 27-NOV-2007 00:12:53
    808744 27-NOV-2007 00:12:53
    if scn is derived from timestamp with milliseconds, each scn should be different right?More help please

    May be there's an easy way solving your problem, I did it like that:
    CREATE TABLE quota_test (test VARCHAR2(50))
    INSERT INTO quota_test
    VALUES ('update "SCOTT"."NEWTAB1" set a="34" and b="45"')
    SELECT test normal, REPLACE(SUBSTR(test,INSTR(test,'"',1),INSTR(test,'.',1)+2),'"','') changed
    FROM quota_test
    Result is :
    NORMAL
    update "SCOTT"."NEWTAB1" set a="34" and b="45"      
    CHANGED
    SCOTT.NEWTAB1
    If you didn't understand, I can explain what I wrote

  • How to get only seconds from the time block function?

    Hello, I want to know to get only "seconds" from the time function. I tried to find other time function but I couldn't find anything that provides only second to be written in the text file.

    It may not be the best way but it works...
    Rodéric L
    Certified LabVIEW Architect

  • Get specific Strings from File

    Good morning to every one.
    I 've got a text file which contains a customer number and an order number, coded as we see in the picture below:
    I am trying to develop a tool in Visual Studio, which it reads the file line-by-line and fills a listbox, with the order_number and the customer number. From the file above, I know that the order number are the digits on the first 'column' after the leading-zeros,
    until '/', and the customer number are the digits without zeros in the 'third' column before 'CUSTOMER_NUMBER'. My form looks like:
    The problem is, that the number of before the fields in file, are not equal in every line.
    So, my question is how I can retrieve the 'order number' and 'customer number' from the text file and copy the results to list box, after clicking on 'Get Strings' button, like:
    359962656   2238914
    359562804   2238914
    etc...
    I attach my code here:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.IO;
    namespace ReadStringFileApp
    public partial class frmMain : Form
    public frmMain()
    InitializeComponent();
    OpenFileDialog openfile = new OpenFileDialog();
    //openfiledialog to pickup filename
    private void btnFindFile_Click(object sender, EventArgs e)
    openfile.Filter = "Text|*.txt";
    if (openfile.ShowDialog() == DialogResult.OK)
    lbxResults.Items.Clear();
    txtFilepath.Text = openfile.FileName.ToString();
    //get strings from file
    private void btnGetStrings_Click(object sender, EventArgs e)
    //check if there is a file path on textbox
    if (txtFilepath.Text == "")
    MessageBox.Show("No File Select. Please select a file", "Error File Name", MessageBoxButtons.OK, MessageBoxIcon.Error);
    btnFindFile.Focus();
    return;
    //create list for all lines inside file
    List<string> lines = new List<string>();
    string line;
    using (StreamReader r = new StreamReader(@txtFilepath.Text))
    while ((line = r.ReadLine()) != null)
    string ordernum;//string for order number
    string customer;//string for customer number
    //line = ordernum + "\t" + customer; //concatenate results to fill the list box
    lbxResults.Items.Add(line);
    r.Close(); //close file
    private void btnExportToFIle_Click(object sender, EventArgs e)
    //check if listbox is empty
    if (lbxResults.Items.Count == 0)
    MessageBox.Show("Result List is empty! Choose a file to proceed.", "Error Result List", MessageBoxButtons.OK, MessageBoxIcon.Error);
    btnGetStrings.Focus();
    return;
    //read listbox contents and parse to a list object
    List<string> list = new List<string>();
    foreach (String i in lbxResults.Items)
    list.Add(i);
    //Create a file in c: with results
    File.WriteAllLines(@"C:\export-test.txt", list, Encoding.Default);
    MessageBox.Show("File export completed!", "File Export", MessageBoxButtons.OK, MessageBoxIcon.Information);
    Thank you in advanced

    @ Joel Engineer
    and@
    Val10
    I combined your responses and I get my results correctly. I attached the code I rewrite for further use:
    private void btnGetStrings_Click(object sender, EventArgs e)
    //check if there is a file path on textbox
    if (txtFilepath.Text == "")
    MessageBox.Show("No File Select. Please select a file", "Error File Name", MessageBoxButtons.OK, MessageBoxIcon.Error);
    btnFindFile.Focus();
    return;
    //create list for all lines inside file
    List<string> lines = new List<string>();
    string line;
    using (StreamReader r = new StreamReader(@txtFilepath.Text))
    while ((line = r.ReadLine()) != null)
    string order_customer;
    Regex reg = new Regex("0*");
    //set an string array, to split the file in columns positions, defining the characters
    string[] daneio = line.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
    //get order number from the first column
    var ordernum_zeros = reg.Match(daneio[0]).Value;
    daneio[0] = daneio[0].Replace(ordernum_zeros, String.Empty);
    daneio[0] = daneio[0].Substring(0, daneio[0].IndexOf("/"));
    //get customer column, without zeros
    var customer_zeros = reg.Match(daneio[5]).Value;
    daneio[2] = daneio[2].Replace(customer_zeros, String.Empty);
    daneio[2] = daneio[2].Substring(0, daneio[5].IndexOf("CUSTOMER_NUMBER"));
    //combine the result in listbox
    order_customer = daneio[0] + "\t" + daneio[2];
    lbxResults.Items.Add(order_customer);
    r.Close(); //close file
    Thank you for your help!

  • Concatenate strings from a column into a single row

    I am trying to string values from a column into a single row. I need a list of students (one row per student) with their phone number and they could have more than one number. I found a function that should do what I need but the syntax is for SQL Server, not SQL*Plus. I've tried several variations but can not come up with the correct syntax.
    This is the SQL Server version:
    CREATE FUNCTION dbo.GetPhoneList(@StudentID int)
    RETURNS varchar(500) AS
    BEGIN
    DECLARE @StringList varchar(500)
    SELECT @StringList = COALESCE(@StringList + ‘, ‘, ”) + Telephone.PhoneNumber
    FROM Telephone t
    WHERE t.StudentID = @StudentID
    IF @StringList IS NULL
    SET @StringList = ‘No Phone’
    RETURN @StringList
    END
    SQL*Plus does not like the @ symbol, so I tried taking that out. I've put semi-colons where I think they should be, but I still get various error messages. Any suggestions?
    Thanks.

    Hi,
    What you want to do is called "String Aggregation"
    You could write a PL/SQL funcrtion to do that for a specific column in a specific table, but [this page|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2196162600402] has a couple of different generic solutions that will work on any tables and columns.
    I recommend the first soluton, the user-defined function STRAGG, which you can copy from that page.
    Once you have STRAGG installed, your query can be something like:
    SELECT     s.student_id
    ,     NVL ( STRAGG (t.phone_number)
             , 'No phone'
             )     AS phone_nums
    FROM          student          s
    LEFT OUTER JOIN     telephone     t     ON s.student_id     = t.student_id
    GROUP BY     s.student_id;On Oracle 10 (and up) you may have a similar function, WM_CONCAT (owned by WMSYS), already installed.
    WM_CONCAT is not documented, so you may not want to use it in your Production applications.
    It lokks like
    Edited by: Frank Kulash on Feb 10, 2009 6:31 PM

  • Trying to get the string from javax.xml.transform.Source

    I have a SOAP client that will submit a string of data to a url and return an xml string back. It works ok besides that last part.
    I found on another site someone took the returned XML and printed it to the system print box. I want to just get the string out to a variable to pass back..
    This chunk works:
    TransformerFactory tff = TransformerFactory.newInstance();
    Transformer tf = tff.newTransformer();
    Source sc = rp.getSOAPPart().getContent();
    StreamResult result = new StreamResult(System.out);
    tf.transform(sc, result);
    System.out.println();Instead of this I just want to catch the XML string in a String variable. Thanks for the help.

    Instead of giving your StreamResult System.out, give it a StringWriter. You can then call toString on the StringWriter, and get what you're after
    StringWriter output = new StringWriter();
    TransformerFactory.newInstance().newTransformer().transform(source, new StreamResult(output));
    String xmlResult = output.toString();

  • Pull XMLDATA from Varchar2 column type

    Hi All,
    I have a column (data_xml) in a table of varchar2(400) type in which XML data is stored.
    I want to read that data through sql query.
    The Problem:
    In xml there is something called <comments>AT&T </comments> which is causing a problem because of "&" symbol.
    Without the & i am fine with query and result.
    Need help in parsing the "&" symbol while reading the column of varchar2 type from sql query.
    query:
    select id, xmltype(data_xml) as col_xml, name, last_name from emp where id = 123;
    NOTE: The query is just a gist to know what i am talking about. The actual query fetches data of xml field and displays, which i am able to do only if there is NO "&" symbol in <comment>AT&T </comment>.
    error:
    ora-31011: xml parsing failed
    ora-19202: error occurred in xml parsing
    lpx-00241: entity reference is not well formed
    Thanks,
    AAG.

    I have tried the replacing character to be "&T" , but no luck , like this..
    select xmltype(replace('<comment>AT&T</comment>','&',''&T''))The problem is not one of substitution but of valid XML.
    is their anyway that i can get the output as this...
    <comment>AT&T</comment> Not using XMLTYPE because XMLTYPE is supposed to return valid XML and '&' is not valid.
    Either don't return XML because what you think is XML is not valid,
    Or replace invalid characters with valid XML,
    Or use something like CDATA.
    But perhaps you should review what is and isn't allowable in XML?
    What is consuming the XML?
    If you're just outputting it in SQL*Plus then it doesn't need to be XML...
    If something else is consuming and outputting the XML then it should deal with the display/output.

  • Using a calculated column to pull a string from another column

    Ok let me try to explain my situation. I have a column with multiple paragraphs or text. I want a calculated column to only pull the top paragraph. This break between paragraphs would be an <Enter>. Nothing else. Is there a way to signal pull this
    string but break at the <enter>.
    I don't think it is. But thought I'd ask.

    Yes, you can do this. But you need to use the CEWP and jQuery. Refer to the following post for more information
    https://www.nothingbutsharepoint.com/sites/eusp/pages/taming-the-elusive-_e2_80_9ccalculated-column_e2_80_9d-referencing-multiple-lines-of-text-column.aspx
    http://stackoverflow.com/questions/10486939/jquery-show-only-first-paragraph-of-each-article
    --Cheers

  • SQL Query to get match string from table

    Hi Experts,
    BANNER                                                                         
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production         
    PL/SQL Release 11.1.0.7.0 - Production                                         
    CORE     11.1.0.7.0     Production                                                     
    TNS for 32-bit Windows: Version 11.1.0.7.0 - Production                        
    NLSRTL Version 11.1.0.7.0 - Production                                         
    5 rows selected.
    WITH T AS
    SELECT 'JOHN' FIRSTNAME,'PLAYER' LASTNAME FROM DUAL UNION ALL
    SELECT 'MICHEAL','SMITH' LASTNAME FROM DUAL UNION ALL
    SELECT 'SCOTT','MANAGER' LASTNAME FROM DUAL UNION ALL
    SELECT 'FIRST NAME','LAST NAME' LASTNAME FROM DUAL
    )SELECT * FROM T;
    Input String to my Query will be "JOHN NAME SMITH"
    I need to match the input string to provide result based on Firstname OR Lastname from table.
    How can i acheive this?
    Thanks,

    what the problem in constructing??
    you can use something like this....
    declare
    vStrng varchar2(100) := 'JOHN NAME SMITH';
    v_temp varchar2(1000):= 'SELECT  DISTINCT  firstname,lastname FROM employees,
      (SELECT regexp_substr('''||vStrng||''',''[[:alpha:]]+'',1,level) parsedstr
         FROM dual
        CONNECT BY level<=LENGTH(regexp_replace('''||vStrng||''',''[[:alpha:]]'',''''))+1
      ) WHERE instr(firstname,parsedstr)>0 OR instr(lastname,parsedstr)      >0';
    vSQL varchar2(1000):= 'SELECT ENAME,EMPNO,DEPT.DEPTNO FROM EMP,DEPT WHERE EMP.DEPTNO=DEPT.DEPTNO AND (firstname,lastname) in ('||v_temp||')';
    begin
    --rest of your code....
    end;edit: In the same way...you can use any of the above mentioned solutions..
    Ravi Kumar
    Edited by: ravikumar.sv on Apr 6, 2010 4:12 PM

  • I get only sound from left with 5.1 sound system on Satellite P100

    Hi!
    I have a P100-347 and a logitech 5.1 sound system.
    The logitech 5.1 has 3 connection: 1 to be plugged to the Line-In, the other to be connected to the Line-out and the 3rd to be connected to the Microphone socket.
    When using it on my desktop which has a random SIS sound card it works fine.
    Yesterday I've connected it to the P100-347 but I only get sound from the Line-out socket. I have changed the sound preferences to 5.1 but it makes no difference... I only get sound from the Line-out. Is there any drivers update that I should do or is anyone aware of this and how can I fix it??
    Just one more thing... With the laptop came this cd "Express Media Player Recovery CD", what is this? Is this something to be installed after runing the "Product Recovery CD" in order to install some drivers or whatever is in this cd comes with the Product Recovery CD as well? Does anyone knows?
    Thank you.

    Hi
    There is no problem. As you said the notebook supports Line-in; headphone & S/PDIF jack and Microphone jack.
    If you want to connect the HiFI or another device you have to choose the headphone & S/PDIF jack. Only this port provides the audio outputting.
    The both another jacks provide only the function for signal (sound) receiving!
    My notebook provides the same jacks and I have connected the notebook to HiFI (5 speakers) via Y-audio cable like this one:
    http://images.belkin.com/F8V235-06/FUL1_F8V235-06.jpg

  • Getting unique values from a column within a hierarchy

    I'm sort of new to working with databases and oracle so this is probably a beginner-ish question. I'm using oracle 9i on this.
    I have a database that contains a table with an organizational hierarchy (dept_id, dept_name, parent_id), and another that contains a list of items for each department (like dept_id, item_id). Item_id joins with another table for the actual description of the items. Each department may have many items, and the departments may overlap with the items included in each.
    I only want to contain that item list for leaf nodes in the hierarchy and for any departments that are not at the bottom, have a query pull a list of all unique items contained by its children, without the overlap. I know I can use START WITH and CONNECT BY to traverse the hierarchy but I'm not sure how I'd put all these pieces together into one query to get what I want, so I'd really appreciate help.

    can you pls post a sample data and the output you are looking for.

  • How to get a value from a column inside a table

    Hi,
    I have got the following problem. I have got a table with some data inside. And a new column, which is not in the dataprovider. Now i search for an opportunity to go through the rows of the table and check the value of this column. I cant do this with the dataprovider or the rowset. My question is now how can i do this? The table object doesnt seem to have a corresponding method.
    Thanks in advance for help
    Acinonyx

    this is some code you can use (based on Winston's and others' tips):
    put this in you page bean:
    private HashSet selectedRows = new HashSet();
    public boolean isSelected() {
    TableRowDataProvider trdp = (TableRowDataProvider)getBean("currentRow");
    if (trdp == null) {
    return false;
    RowKey rowKey = trdp.getTableRow();
    if (this.selectedRows.contains(rowKey.getRowId()))
    return true;
    else
    return false;
    public void setSelected(boolean b) {
    TableRowDataProvider trdp = (TableRowDataProvider)getBean("currentRow");
    RowKey rowKey = trdp.getTableRow();
    if (checkbox1.isChecked()) {
    this.selectedRows.add(rowKey.getRowId());
    Object v = this.t_fotoDataProvider.getValue("fieldName", rowKey);
    } else {
    this.selectedRows.remove(rowKey.getRowId());
    and then bind the "selected" property of the checkbox column to the "selected" property of the page bean.
    Now, eveytime the page is submitted, you can do something useful, for example, in the setSelected() method (the row that starts with Object v = ... get's the value of some field corresponding to the checked row)
    Mauro

  • How to get highest salary from salary column in sharepoint list

    Hello,
    I have one custom list in which there is one salary column so I want to get the highest salary.Can we do this OOTB or by using custom code by adding webpart(using CAML query).
    Thanks,

    http://stackoverflow.com/questions/516073/max-query-using-caml
    <Query>
    <OrderBy>
    <FieldRef Name="particularcolumn" Ascending="FALSE" />
    </OrderBy>
    </Query>
    http://stackoverflow.com/questions/8383616/caml-query-on-a-sharepoint-2010-list
    http://sharepoint.stackexchange.com/questions/16955/how-to-select-max-field-in-caml-query
    If this helped you resolve your issue, please mark it Answered

  • Getting a String from an applet method

    I'm writing a page where a user enters the location of a local file and lets an applet calculate a binary hash of the file contents. I want the applet to give the hash string back to an empty textfield.
    The code I'm using is:
    <script language="JavaScript">
    function hash() {
    var test;
    test = document.FtpApplet.hash('E:\downloadz\mysql-4.0.12-win.zip');
    document.form.hash.value = test;
    </script>
    <FORM name="FTForm" method="post" action="#">
    <input type="button" value="Send" onClick="document.FtpApplet.upload();"><br>
    <input type="button" value="Hash" onClick="hash()"><br>
    <input type="text" name="hash"> ...
    My applet contains a ordinary public method giving back a string.
    In IE6 I get a runtime error pointing to the hash() function. In Netscape7/Mozilla 1.3 nothing happens at all. I'm using the latest version of the java plug-in in all my browsers.
    Could anyone help me out?

    You should try to find a javascript forum.

  • Getting a String from a web page

    HI there, i want to store a String on a web page as a String in my Java program to manipulated, here is the web page:
    ftp://weather.noaa.gov/data/observations/metar/stations/EGBB.TXT
    Does anybody have an idea where i should start with such an operation, is it even possible?
    Thank you!
    oookiezooo

    1) If you have a server, you can put a server side script up
    that
    returns the time quite easily. From Director, you would use
    getNetText() to pull it down
    2) If you click on the stage where there are no sprites,
    there will be,
    in the Property Inspector, a Display Template tab. There are
    your
    Titlebar options. Uncheck the ones you don't want to see
    (like for
    example "Close Box")

Maybe you are looking for

  • Setting the function module from sap r/3 to EWM ?

    Hi Gurus,      Here i have one question, that I have a FM that will cut first 5 digits of Track number,,,so my issue is that tracking number are comming from EWM to R/3 both are in different servers, EWM also SAP component,,,so now the same functiona

  • MacBook Pro loses access to 1 memory slot upon shutdown or reboot in OS X 10.8.1

    I have had 4GB of RAM in my mid-2009 13-inch MacBook Pro since a few weeks after purchasing it in 2009.  Until a couple of weeks ago, this machine has been running OS X 10.6.8 with no RAM issues.  I wanted to wait for 10.8.1 before doing a clean inst

  • Manage devices

    I have 4 devices macbook, macbook pro, imac and iphone 3GS, apps sync from icloud to each device but in my account only shows 2 are authorised and showing in "manage devices", macbook pro and imac. Can anyone point me in the right direction please???

  • Unable to update Java

    Okay, the answer to this is pretty obvious. I still have Snow Leopard and have discovered that I cannot update Java because I don't have Lion.  I know I'm going to end up being forced to upgrade because keeping stuff updated is a really good idea. Do

  • QoS Beta(643-642), information for "QoS best practices"

    I'm preparing the "IP telephony operational specialist" exam and now for QoS beta(643-642). Can I get an URL for "QoS Best Practices" from CCO ? And any comments for the exam. Thanks,