I want query in following format

hi,
    i have on table 'test'..
table :- test
                 name        salary
                aaa,rdt            500
                dddd, fgh          600
                yyyyy,dfg        7000
i want 'name' column data in following format..(I want data before ',')
        name
        aaa
        dddd
        yyyyy
thanks,
Ravindra Malwal

Regular expressions can be quite heavy on the CPU processing, which is noticable if you're processing a lot of data.
For such a simple requirement, you'd probably be better just using the standard string functions... e.g.
SQL> ed
Wrote file afiedt.buf
  1  with t as (select 'aaa,rdt' as name, 500 as salary from dual union all
  2             select 'dddd, fgh', 600 from dual union all
  3             select 'yyyyy,dfg', 7000 from dual union all
  4             select 'xxxx', 2500 from dual)
  5  --
  6  -- end of test data
  7  --
  8  select substr(name,1,instr(name||',',',')-1) as name
  9        ,salary
10* from   t
SQL> /
NAME          SALARY
aaa              500
dddd             600
yyyyy           7000
xxxx            2500

Similar Messages

  • Is it possible to apply conditional formatting to a cell (or range) based upon a LOOKUP query to cell values in another sheet.? I want to alter the formatting (i.e., text and/or cell background color), but not cell content.

    Is it possible to apply conditional formatting to a cell (or range) based upon a LOOKUP query to cell values in another sheet.?
    I want to alter the formatting (i.e., text and/or cell background color), but not the content, of the target cell(s).

    Hi Tom,
    Your LOOKUP formula will return a value that it finds in the "other" table. That value can be used in conditional highlighting rules. (Numbers 3 calls it conditional highlighting, not conditional formatting. Just to keep us awake, I guess, but it works the same).
    Please explain what you are trying to do.
    Regards,
    Ian.

  • Can we generate the output of SQL Query in XML format ..

    Hi Team,
    Can we generate an XML doc for an SQL Query.
    I've seen in SQL Server 2000.It is generating the output of an SQL Query in xml format.
    select * from emp for xml auto
    The output looks like
    <emp EMPNO="7369" ENAME="SMITH" JOB="CLERK" MGR="7902" HIREDATE="1980-12-17T00:00:00" SAL="2800" DEPTNO="20"/><emp EMPNO="7370" ENAME="SMITH" JOB="CLERK" MGR="7902" HIREDATE="1980-12-17T00:00:00" SAL="2800" DEPTNO="10"/>

    Just a little bit of short hand.
    Get the XML out of your database, via HTTP
    Of course the easiest method is just to return an XMLType from a stored procedure and let the calling routine figure out what to do with it. Instead
    of that way though, I'll show you how to do it via HTTP. It's all completely built into 10g and is super easy to use.
    CREATE OR REPLACE VIEW emps_and_depts AS
    SELECT e.employee_id AS "EmployeeId",
    e.last_name AS "Name",
    e.job_id AS "Job",
    e.manager_id AS "Manager",
    e.hire_date AS "HireDate",
    e.salary AS "Salary",
    e.commission_pct AS "Commission",
    XMLFOREST (
    d.department_id AS "DeptNo",
    d.department_name AS "DeptName",
    d.location_id AS "Location"
    ) AS "Dept"
    FROM employees e, departments d
    WHERE e.department_id = d.department_id
    Some people hear web and immediately start salivating about security issues. Let me address that quickly. Just because you have the HTTP and/or
    FTP servers running in the database, that does not mean you have a security problem. For one, I would hope your databases are behind a firewall.
    Second, with the correct architecture (DMZ, app servers, etc) you can make this data available outside the firewall fairly transparently and third,
    just because it's on the web does not mean the data MUST be available on the internet. This is a good way to make your data available on your
    intranet. If you are worried about people INSIDE your firewall, that still doesn't preclude web based access. Follow Oracle security guidelines.
    Before I show you how to get to your data, let's talk about URLs and URIs. A URL is a Uniform Resource Locater and URI is a Uniform Resource
    Identifier. A URL is the way you would identify a document on the net, i.e. http://www.oracle.com is a URL. A URI is a more generic form of a URL.
    Oracle supports three types of URI: HTTPURIType - basically a URL (which would be like the URL above), XDURIType - a pointer to an XDB resource
    (usually an XML document but can be other objects), and DBURIType - a pointer to database objects.
    It's the DBURIType that we're going to concentrate on here. The DBURIType let's us reference database objects using a file/folder paradigm. The
    format for a DBURI is /oradb/<schema>/<table>. Oradb is shorthand for the database; it is not the database name or SID. My database is named XE
    but I still use oradb in the DBURI. For example, the view we created above is in my XE database, is owned by HR (at least in my case) and is called
    EMPS_AND_DEPTS. This can be referenced as /oradb/HR/EMPS_AND_DEPTS.
    If the view had many rows and you wanted only one of them, you can restrict it by including a predicate. The documentation for XDB has a great
    write up on Using DBURIs.In our case, we are going to write out the entire document. Now that you understand that the DBURI is a pointer to
    objects in our instance, we can use that to access the data as a URL.
    The format for the URL call is http://<machinename>:<port>/<DBURI>
    In my case, my XE database is running on a machine called mach1 and is listening on port 8080. So to see the view we created above, I open my
    browser and navigate to: http//mach1:8080/oradb/HR/EMPS_AND_DEPTS
    The created URL will be as http//mach1:8080/oradb/PUBLIC/EMPS_AND_DEPTS
    If your database is set up correctly and listening on port 8080 (the default), your browser should ask you to login. Login as the user who created the
    view (in my case HR). You should now get an XML document displayed in your browser.
    And that's it. It doesn't get much simpler than that. If you get rid of the descriptive text above, it basically comes down to:
    Create a table or view
    Open your web browser
    Enter a URL
    Enter a user ID and password
    View your XML
    If you notice, Oracle formatted the data as XML for us. Our view returns scalar columns and an XML fragment called Dept. Oracle formatted the
    return results into an XML format.
    And as a side note, if you look closely, you'll see that my URL has PUBLIC where I said to put HR. PUBLIC is a synonym for all objects that your
    logged in user can see. That way, if your user has been granted select access on many schemas, you can use PUBLIC and see any of them.

  • Please help to write a query in this format

    Sir,
    I am having a table like following
    Deptno job
    10 aaa
    11 bbb
    12 ccc
    10 ddd
    11 eee
    12 ffff
    10 ggg
    deptno-number
    job- varchar
    in the above table I want the out put like following in a single query ,is it possible.
    10 aaa,ddd,ggg (concatenation of all jobs under that particular deptno)
    11 bbb,eee
    12 ccc,ffff
    I tried with Connect by clause, but i am not able to successfully execute it.
    select dept,substr(max(substr(sys_connect_by_path (job,', '),2)),1,100)
    as job
    from test
    start with dept = 10
    connect by job = prior job
    and prior dept = dept
    group by dept;
    please help me.
    regards
    Mathew

    Hi Mathew,
    One approach is to write a specific function to solve the problems. The get_job function listed below returns a list of employees for the specified department.
    CREATE OR REPLACE FUNCTION get_job (p_deptno in emp.deptno%TYPE)
    RETURN VARCHAR2
    IS
    l_text VARCHAR2(32767) := NULL;
    BEGIN
    FOR cur_rec IN (SELECT Job FROM test WHERE deptno = p_deptno) LOOP
    l_text := l_text || ',' || cur_rec.ename;
    END LOOP;
    RETURN LTRIM(l_text, ',');
    END;
    SHOW ERRORS
    The function can then be incorporated into a query as follows.
    COLUMN employees FORMAT A50
    SELECT deptno,
    get_job(deptno) AS Job
    FROM test
    GROUP by deptno;
    DEPTNO JOB
    10 aaa,ddd,ggg
    11 bbb,eee
    12 ccc,ffff
    Thanks,
    Nagesh.

  • Query for particular format

    I am looking for a way to verify that data in a column adheres to a specific format.
    In this case I want to query the telephone column in the client table to verify that is in the following format:
    (555) 555-5555
    We have an inbound data feed that has numbers in all sorts of formats.  I am not sure what type of function I could use here or what I could put in my where clause for this.
    Thanks!

    phone_nbr CHAR(12) LIKE '([0-9][0-9][0-9]) [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]'
    However, it would be better to use the  International
    Telecommunication Union standard E.123.
    Display formatting should be done in the  front end, not the database. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • HT204406 I have a song that is in the following format: 256 kbps, 48 kb in size, and an AAC file format. Why would is it noted in imatch as ineligible?

    I have a song that is in the following format: 256 kbps, 48 kb in size, and an AAC file format. Why  is it tagged in imatch as ineligible?

    I ended up reformating the drive as FAT32 because I still need to use it on my Windows 98SE system also. I did have a problem with the allocation size. I wanted to use 512 bytes but it kept failing so I used the default size(8192 bytes) and then it worked fine. I didn't think there would be a problem formatting as NTFS but since you are having problems I just tried it. It failed at 512 bytes allocation size so I tried again using 4096 bytes, the default, as the allocation size and it failed again. It looks like these drives will not format as NTFS.
    Also, I think I figured out what's going on with the ReadyBoost problem. As I said initially it wouldn't work with ReadyBoost then after I had 12GB of data on the drive the ReadyBoost feature started working. After I deleted all the files it quit working again. After doing some reading on the net about Flash drives and ReadyBoost problems it appears that the memory chips on my Lenovo Flash drive are mixed with both fast memory chips that work fine with ReadyBoost and slower memory  chips that are too slow for ReadyBoost. Apparently, after I fill up the portion of memory with data that uses the slow chip(s) then ReadyBoost works fine with the fast chip(s).  I also verified the Flash drives read and write memory speeds using Vista's Event Viewer. To work with ReadyBoost the Flash drive has to read at a minimum of 2.5MB/s (for 4KB random reads) and write at a minimum of  1.75MB/s (for 512KB random writes).
    Let me know what you find out.

  • Custom batch rename files with Aperture 3 in the following format: IMG_0023.cr2 to Smith_YYMMDD_0023.cr2?  I cannot find a way to structure the date in Aperture as such, as well as extract only the camera file

    Please advise how to custom batch rename files with Aperture 3 in the following format: IMG_0023.cr2 to Smith_120816_0023.cr2?  I cannot find a way to structure the date in Aperture as such (YYMMDD), as well as extract only the camera file (0023, for example).  Adobe Bridge CS5 can do this, but NONE of the Adobe software is retina optimized, and is terrible to look at.

    In Aperture you are limited to renaming files by the entries in the File Naming preset window.
    At what point are you looking to rename, import or export? It might be possible to do what you are looking to do external to Aperture either via a script or other software.
    regards

  • I want "3" to be formatted as "03" - How do I get the 0 in front???

    I want "3" to be formatted as "03" - How do I get the 0 in front???

    You can make a custom format in the Cell Inspector that enables leading zeros:
    Highlight the cell(s), then open the cell inspector (click the "Inspector" button, top right in the toolbar), then select the "Cells" section.
    Choose "Custom" from the format menu:
    Then give the format a name, and set up the parameters.  To enable the leading zeros click the pop-up menu for the formatter tag:
    and select "Show Zeros for Unused Digits"
    Click "OK" to save new format and select

  • How to get report with following format

    Hi
    For tax reporting purpose, our company has to get a report in the following format so that they can export it to excel file.
    Customer    -       Name   -    address  -   sales/purchases
    The last column is the one we get from fd10n by entering customer number.
    Please let me know the easiest way to obtain it.
    Thanks
    PrinceofLight

    HI,
    Please consult your technical team they can easily  prepare zreport for that particular fields.
    K.satish

  • How to convert siebel date to following format?

    Hi,
    How to convert siebel date to following format?
    01-01-2011 5:00 AM (dd-mm-yyyy hh:mm AM)
    01-JAN-2011 5:00 AM (dd-MON-yyyy hh:mm AM)
    01/01/2011 5:00 AM (dd/mm/yyyy hh:mm AM)
    Please suggest functions for conversion. Have tried few but didnt work.
    Thanks.

    Excerpts from
    http://bipconsulting.blogspot.com/2010/01/my-date-doesnt-like-me-with-siebel.html
    ".. the date data generated by Siebel with the IO is in ‘MM/DD/YYYY HH:MI:SS’ format, so it is something like ‘10/09/2008 05:31:13’. And BI Publisher doesn’t recognize that this is a date data because it’s not presented in the ‘Canonical’ format!.."
    "...There are two possible and reasonable workarounds to overcome this issue. The first one is to use one of the Siebel’s extended function ‘totext()’ to convert the Siebel date format to the ‘Canonical’ date format before the BI Publisher’s date related function comes in..."
    Please read on the above link to find out how to actually resolve this issue.
    Good Luck
    (please if this provides a solution for you grant the points and close this thread. Thanks!)
    Jorge

  • I used pages to write a resume and the company wants it in pdf format.  How do I do that?

    I USED PAGES TO WRITE A RESUME AND THE COMPANY WANTS IT IN pdf FORMAT. hOW DO I DO THAT?

    file > export > pdf

  • I want to change region format back to Cambodia, but it's dose not exists in format list. So how can I do?

    I want to change region format back to Cambodia, but it's dose not exists in format list. So how can I do?

    There never has been a Cambodia region format for iPhones.  It had to have been set for something else.  Try other available formats such as Vietnam or Laos.

  • Want to change date format

    hi
    i want to change date format i m getting  date formate  this <b>20070627.</b>
    but i want this format in  <b>27.06.2007</b>
    please suggest me .
    thanks in advanced.

    Hi,
    Do this.
    DATA: lv_dt(10)  type c.
    lv_dt =  table1-f1( the field from which ur date is coming.)
    concatenate lv_dt6(2)  lv_dt4(2)  lv_dt+0(4)
                                    into lv_dt
                                    separated by '.'
    write:/ lv_dt.
    This will sove ur problem
    Regards:
    Sapna
    Do reward points if u find this helpful

  • How to Transpose the Query with following result

    Dear All,
    Can anyone tell me a method of transposing my result of the following query
    Details can be found at
    http://obiee11ge.blogspot.com/2010/07/how-to-transpose-query-with-following.html
    Regards
    Mustafa

    Hi,
    Try this
    Create a combined request with,
    criteria 1 : Dummy, Revenue (Actual),Cogs(Actual), Opex(Actual), PL(Actual)
    in the dummy column fx enter the value as 'Actual'
    criteria 2 : Dummy, Revenue (Yago),Cogs(YAgo), Opex(Yago), PL(Yago)
    in the dummy column fx enter the value as 'Yago'
    criteria 3 : Dummy,Revenue (Budget),Cogs(Budget), Opex(Budget), PL(Budget)
    in the dummy column fx enter the value as 'Budget'
    Now go to the result columns and set the coumn names (Revenue, Cogs, Opex, PL) for the result set.
    For the Dumny remove the column heading.
    In table view you will get the result.
    Thanks,
    Vino

  • I have a numbers spreadsheet for tracking company data.  I want to copy the format of the spreadsheet (rows, columns,and formulas) but have all of the data fields be blank for the new year.  How do I do that?

    I have a numbers spreadsheet for tracking company data.  I want to copy the format of the spreadsheet (rows, columns,and formulas) but have all of the data fields be blank for the new year.  How do I do that?

    click and hold on one cell, then drag to select the range, then release, then type the delete key.  Only inlude cells in the range you do not want to keey the contents of the cell.  You can remove one-off cells by holding the command key and clicking cells to add or remove as needed.
    You can download the Numbers users guide here:
    http://support.apple.com/manuals/#productivitysoftware

Maybe you are looking for

  • Problem with HP Officejet Pro 8500 printer: cleans printheads every time it's turned on

    Hello everybody, the printer HP Officejet Pro all-in-one 8500 (A909a - product n. CB022A) cleans printheads every time I turn it on. This problem affects any HP Officejet Pro 8500 printer, it isn't a problem only of that one I purchased. It is an ann

  • Photo orientation in i-pad

    When I try to send photos from my i-pad in an e-mail, they always appear upside-down to the recipient.  Is there a way to either prevent this or rotate the photo before sending it?  Any suggestions would be greatly appreciated.

  • ODS Capability of 2LIS_02_SCL

    All, I am having an issue with the 2LIS_02_SCL (Purchasing Schedule lines extractor) that I just cannot figure out. Here is the situation.... I have created an ODS layer in front of a set of data targets...one data target is a cube that is modeled fr

  • A problem with placing images

    I have been working on my graduate profolio, and final projects. When I import a file that is at high res, it appears blurry and pixelated after resizing with autofit. (When I resize using autofit, I use shift.) Is there anything I can do to remedy t

  • Troubles with internet on IPhone 4s

    Hi.. This morning I suddenly lost my internetconnection. NOT wifi, as I dont us that where I am. I did a reboot, checked the sim-card, did a reset on the network settings and finaly a restore through ITunes. And still not working... I can talk and te