SQL Query - Where field is NULL

Hello,
I am trying to run a simply query.  All I want to know is how many fields in a certain column are null and therefore how many columns are not null.  I tried this but my numbers do not add up.
SELECT *
FROM [table.name]
WHERE colomn.header< '%'

colomn or column? Did you try looking up MySQL IS NULL in google?
SELECT *
FROM [table.name]
WHERE column.header IS NULL

Similar Messages

  • Change my sql query where-clause in an extended controller

    Hello,
    i am trying to change my sql query where-clause in an extended controller
    personAplListVO.setWhereClause(null); // first set to null
    personAplListVO.setWhereClauseParams(null); // first set to null
    personAplListVO.setWhereClause(personAplListVOWhereClause +
    newWhereClause);
    personAplListVO.setWhereClauseParams(whereClauseParams);
    personAplListVO.executeQuery();
    System.out.println(">>>>>>>>getQuery = " + personAplListVO.getQuery());
    when i get the query ( personAplListVO.getQuery()) after executeQuery(), the new newWhereClause values are missing.
    Also i am getting null from personAplListVO.getWhereClause() after executeQuery()
    as if the above code is not making any effect.
    any ideas why?
    Thank you

    Hello,
    My Query:
    /* Formatted on 2011/06/15 15:50 (Formatter Plus v4.8.8) */
    SELECT /*+ FIRST_ROWS */
    NULL AS selectflag, ppf.full_name AS person_name,
    ppf.first_name AS person_first_name, ppf.last_name AS person_last_name,
    ppf.email_address, addr.derived_locale, addr.address_id,
    phn.phone_number, phn.phone_id, ppf.date_of_birth, addr.address_line1,
    (SELECT COUNT (*)
    FROM per_all_assignments_f paf2,
    per_all_people_f ppf2
    WHERE paf2.assignment_type = 'A'
    AND :1 BETWEEN paf2.effective_start_date AND paf2.effective_end_date
    AND paf2.person_id = ppf2.person_id
    AND paf2.effective_start_date BETWEEN ppf2.effective_start_date
    AND ppf2.effective_end_date
    AND ppf2.party_id = ppf.party_id
    HAVING COUNT (*) > 0) AS jobs_applied_for,
    (SELECT MAX (paf.effective_start_date)
    FROM per_all_assignments_f paf,
    per_all_people_f ppf2
    WHERE paf.assignment_type = 'A'
    AND :2 >= paf.effective_start_date
    AND paf.person_id = ppf2.person_id
    AND paf.effective_start_date BETWEEN ppf2.effective_start_date
    AND ppf2.effective_end_date
    AND ppf2.party_id = ppf.party_id) AS last_application,
    ppf.person_id, ppf.effective_start_date, ppf.effective_end_date,
    DECODE (vac.manager_id, :3, 'Y', 'N') AS my_applicants,
    vac.NAME AS vacancy_name, vac.vacancy_id, paf.assignment_id,
    (SELECT /*+ push_subq */
    MIN (pasf.effective_start_date)
    FROM per_all_assignments_f pasf
    WHERE pasf.assignment_id = paf.assignment_id) AS application_date,
    paf.effective_end_date AS assignment_end_date,
    ast.user_status AS application_status, ast.assignment_status_type_id,
    vac.status AS vacancy_status, mgr.full_name AS recruiting_manager,
    mgr.person_id AS recruiting_manager_id,
    mgr.effective_start_date AS effective_start_date1,
    mgr.effective_end_date AS effective_end_date1,
    rec.full_name AS recruiter, rec.person_id AS recruiter_id,
    rec.effective_start_date AS effective_start_date2,
    rec.effective_end_date AS effective_end_date2,
    ppf.per_information_category, ppf.per_information1,
    ppf.per_information2, ppf.per_information3, ppf.per_information4,
    ppf.per_information5, ppf.per_information6, ppf.per_information7,
    ppf.per_information8, ppf.per_information9, ppf.per_information10,
    ppf.per_information11, ppf.per_information12, ppf.per_information13,
    ppf.per_information14, ppf.per_information15, ppf.per_information16,
    ppf.per_information17, ppf.per_information18, ppf.per_information19,
    ppf.per_information20, ppf.per_information21, ppf.per_information22,
    ppf.per_information23, ppf.per_information24, ppf.per_information25,
    ppf.per_information26, ppf.per_information27, ppf.per_information28,
    ppf.per_information29, ppf.per_information30,
    FLOOR
    (irc_location_utility.sdo_miles (iwp.geometry, loc.geometry, 0.01)
    ) AS distance_to_location,
    loc.location_id, loc.derived_locale AS derived_locale1,
    doc.document_id, doc.file_name,
    NVL2 (doc.document_id, 'Y', 'N') AS previewenabled,
    inp.notification_preference_id, ppf.attribute_category, ppf.attribute1,
    ppf.attribute2, ppf.attribute3, ppf.attribute4, ppf.attribute5,
    ppf.attribute6, ppf.attribute7, ppf.attribute8, ppf.attribute9,
    ppf.attribute10, ppf.attribute11, ppf.attribute12, ppf.attribute13,
    ppf.attribute14, ppf.attribute15, ppf.attribute16, ppf.attribute17,
    ppf.attribute18, ppf.attribute19, ppf.attribute20, ppf.attribute21,
    ppf.attribute22, ppf.attribute23, ppf.attribute24, ppf.attribute25,
    ppf.attribute26, ppf.attribute27, ppf.attribute28, ppf.attribute29,
    ppf.attribute30, TO_CHAR (ROWNUM) AS rownumber,
    TO_CHAR
    ((irc_utilities_pkg.get_recruitment_person_id (ppf.person_id, :4))
    ) AS root_person_id,
    TO_CHAR
    (irc_skills_matching_pkg.vacancy_match_percent
    (irc_utilities_pkg.get_recruitment_person_id (ppf.person_id,
    :5
    vac.vacancy_id,
    :6
    ) AS match_percent,
    ppf.party_id, paf.effective_start_date AS assignment_start_date,
    pov.vendor_id, pov.vendor_name, regatmpt.attempt_id AS reg_attempt_id,
    TO_NUMBER (DECODE (regatmpt.raw_score, -1000, NULL, regatmpt.raw_score)
    ) AS reg_attempt_score,
    NVL2
    (regatmpt.mastery_score,
    DECODE (GREATEST (regatmpt.mastery_score, regatmpt.raw_score),
    regatmpt.raw_score, 'P',
    'F'
    NVL2 (fnd_profile.VALUE ('IRC_REGISTER_TEST'),
    NVL2 (inp.attempt_id, 'A', 'N'),
    NULL
    ) AS reg_attempt_status,
    aplatmpt.attempt_id AS apl_attempt_id,
    TO_NUMBER (DECODE (aplatmpt.raw_score, -1000, NULL, aplatmpt.raw_score)
    ) AS apl_attempt_score,
    NVL2
    (aplatmpt.mastery_score,
    DECODE (GREATEST (aplatmpt.mastery_score, aplatmpt.raw_score),
    aplatmpt.raw_score, 'P',
    'F'
    NVL2 (vac.assessment_id, NVL2 (iad.attempt_id, 'A', 'N'), NULL)
    ) AS apl_attempt_status,
    hrl.meaning, hrl.lookup_type, hrl.lookup_code,
    iad.assignment_details_id, iad.considered AS considered,
    vac.business_group_id,
    NVL
    ((SELECT iav.manage_applicants_allowed
    FROM irc_agency_vacancies iav
    WHERE iav.vacancy_id = vac.vacancy_id
    AND iav.agency_id = fnd_profile.VALUE ('IRC_AGENCY_NAME')),
    'Y'
    ) AS manage_applicants_allowed,
    DECODE (paf.source_type, 'ER', 'Y', 'N') AS referred,
    ircreferralinfoeo.start_date, ircreferralinfoeo.end_date,
    (SELECT meaning
    FROM hr_lookups
    WHERE lookup_code = ircreferralinfoeo.source_type
    AND lookup_type = 'REC_TYPE') AS sourcetype,
    DECODE (ircreferralinfoeo.source_type,
    'ER', (SELECT full_name
    FROM per_all_people_f
    WHERE person_id = ircreferralinfoeo.source_person_id
    AND SYSDATE BETWEEN effective_start_date
    AND effective_end_date),
    ircreferralinfoeo.source_name
    ) AS sourcename,
    ircreferralinfoeo.object_id, ircreferralinfoeo.object_type
    FROM per_addresses addr,
    per_phones phn,
    per_all_people_f ppf,
    per_all_assignments_f paf,
    per_all_vacancies vac,
    per_assignment_status_types_v ast,
    per_all_people_f mgr,
    per_all_people_f rec,
    irc_notification_preferences inp,
    hr_locations_all_vl loc,
    irc_documents doc,
    irc_search_criteria iwp,
    per_all_people_f irc_ppf,
    po_vendors pov,
    ota_attempts regatmpt,
    irc_assignment_details_f iad,
    ota_attempts aplatmpt,
    hr_lookups hrl,
    irc_referral_info ircreferralinfoeo
    WHERE irc_utilities_pkg.get_recruitment_person_id (ppf.person_id, :7) =
    irc_ppf.person_id
    AND :8 BETWEEN ppf.effective_start_date AND ppf.effective_end_date
    AND irc_ppf.party_id = ppf.party_id
    AND ppf.person_id = paf.person_id
    AND paf.assignment_type = 'A'
    AND paf.vacancy_id = vac.vacancy_id
    AND :9 BETWEEN paf.effective_start_date AND paf.effective_end_date
    AND paf.assignment_status_type_id = ast.assignment_status_type_id
    AND irc_ppf.person_id = doc.person_id(+)
    AND irc_ppf.person_id = phn.parent_id(+)
    AND phn.parent_table(+) = 'PER_ALL_PEOPLE_F'
    AND phn.phone_type(+) = 'H1'
    AND :10 BETWEEN NVL (phn.date_from(+), :11) AND NVL (phn.date_to(+), :12)
    AND vac.manager_id = mgr.person_id(+)
    AND :13 BETWEEN mgr.effective_start_date(+) AND mgr.effective_end_date(+)
    AND vac.recruiter_id = rec.person_id(+)
    AND :14 BETWEEN rec.effective_start_date(+) AND rec.effective_end_date(+)
    AND irc_ppf.person_id = inp.person_id(+)
    AND inp.person_id = addr.person_id(+)
    AND NVL (inp.address_id, DECODE (addr.address_type(+), 'REC', addr.address_id(+),
    -1)) = addr.address_id(+)
    AND :15 BETWEEN addr.date_from(+) AND NVL (addr.date_to(+), :16)
    AND loc.location_id(+) = vac.location_id
    AND doc.TYPE(+) LIKE '%RESUME'
    AND doc.end_date(+) IS NULL
    AND irc_ppf.person_id = iwp.object_id(+)
    AND iwp.object_type(+) = 'WPREF'
    AND :17 BETWEEN irc_ppf.effective_start_date AND irc_ppf.effective_end_date
    AND ( inp.agency_id = fnd_profile.VALUE ('IRC_AGENCY_NAME')
    OR fnd_profile.VALUE ('IRC_AGENCY_NAME') IS NULL
    AND inp.agency_id = pov.vendor_id(+)
    AND inp.attempt_id = regatmpt.attempt_id(+)
    AND paf.assignment_id = iad.assignment_id(+)
    AND :18 BETWEEN iad.effective_start_date(+) AND iad.effective_end_date(+)
    AND iad.latest_details(+) = 'Y'
    AND iad.attempt_id = aplatmpt.attempt_id(+)
    AND hrl.lookup_type(+) = 'VACANCY_STATUS'
    AND vac.status = hrl.lookup_code(+)
    AND paf.assignment_id = ircreferralinfoeo.object_id(+)
    AND SYSDATE BETWEEN ircreferralinfoeo.start_date(+) AND ircreferralinfoeo.end_date(+)
    AND ( 1 = 1
    AND (NVL (doc.document_id, 1) =
    NVL ((SELECT MAX (idoc1.document_id)
    FROM irc_documents idoc1
    WHERE idoc1.person_id = irc_ppf.person_id
    AND idoc1.TYPE IN ('RESUME', 'AUTO_RESUME')
    AND idoc1.end_date IS NULL
    AND idoc1.last_update_date =
    (SELECT MAX (idoc2.last_update_date)
    FROM irc_documents idoc2
    WHERE idoc2.person_id = irc_ppf.person_id
    AND idoc2.TYPE IN
    ('RESUME', 'AUTO_RESUME')
    AND idoc2.end_date IS NULL)),
    1
    and my where clause that i want to append to the existing one:
    and ppf.sex = 'M' and ppf.nationality = '1680'
    my processFormRequest function in my extended CO
    public void processFormRequest(OAPageContext pageContext,
    OAWebBean webBean) {
    super.processFormRequest(pageContext, webBean);
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    String genderValue = pageContext.getParameter("gender");
    String nationality = pageContext.getParameter("nationality");
    ViewObject personAplListVO = am.findViewObject("PersonAplListVO");
    String personAplListVOWhereClause = personAplListVO.getWhereClause();
    Object[] whereClauseParams = personAplListVO.getWhereClauseParams();
    String newWhereClause = "";
    //gender
    if (genderValue != null && !genderValue.trim().equals("")) {
    newWhereClause += " and ppf.sex = '" + genderValue + "'";
    //nationality
    if (nationality != null && !nationality.trim().equals("")) {
    newWhereClause += " and ppf.nationality = '" + nationality + "'";
    System.out.println("\n>>>>>>>>getQuery = " + personAplListVO.getQuery());
    System.out.println("\n>>>>>>>>newWhereClause = " + newWhereClause);
    if (!newWhereClause.equals("")) {
    personAplListVO.clearCache();
    personAplListVO.setWhereClause(null); // first set to null
    personAplListVO.setWhereClauseParams(null); // first set to null
    personAplListVO.setWhereClause(personAplListVOWhereClause +
    newWhereClause);
    personAplListVO.setWhereClauseParams(whereClauseParams);
    personAplListVO.executeQuery();
    // System.out.println(">>>>>>>>newWhereClause" +
    // personAplListVOWhereClause + newWhereClause);
    // System.out.println(">>>>>>>>getWhereClause" +
    // personAplListVO.getWhereClause());
    // System.out.println(">>>>>>>>getQuery = " +
    // personAplListVO.getQuery());
    any tips?
    thanks a lot

  • JSTL sql:query date field has zero time part

    I have a little JSP where I am using JSTL to do a query against a table "ph_application" that has a date field "rundate". This field has many different dates and times in it.
    Here is the code snippet:
    <sql:setDataSource url="jdbc:oracle:thin:@oraprd02:1521:ipp4" user="site" password="pmc_site"/>
    <sql:query var="application" sql="select * from ph_application"/>
    <c:forEach items="${application.rows}" var="row">
    <tr>
    <td><c:out value="${row.name}" default=" " escapeXml="false"/></td>
    <td><fmt:formatDate value="${row.rundate}" type="both"/></td>
    </tr>
    </c:forEach>
    The resulting date/time output always has a 12:00:00 AM time regardless of what is actually in the table. I have changed the fmt:formatDate to a c:out of the row.rundate.time value and it appears that the time part of the date is actually zero at this point.
    Is there an inconsistancy between the oracle date type and what JSTL is expecting (somewhere)?
    Any help and/or verification is appreciated.
    Richard

    I'm running this from within JDeveloper 10g.

  • How to construct a sql query when field having single quote

    Hi all,
    I have been working on web application , here is my requirement:
    I'm constructing sql statement dynamically from dynamic user input (form data). In one of the field having single quote.
    while executing the query it is getting problem because of single quote .. so how do i resolve my problem.
    single quote should be there. (I'm using Ms-Access as my database).
    Thanks in advance
    abel

    Use PreparedStatement. Always. It not only eases setting Java objects in a SQL query, but also protects you against SQL injections.
    Prepare yourself: [http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html].

  • SQL Server Expcts Value Where Field Is NullI

    I am working on an application in Visual Basic 2010 using an SQL Server 2005 Express
    The field in the database causing a problem is one of 25 similarly named fields(Track1 through Track 25 with several other fields preceding the tracks, My Visual Basic program consists of fields dragged form the data source.
    When trying to add the first record to the database I get an error telling me that Track 20 is has a null value.  The exact message is "No Null Allowed Exception Was Unhandled" and identifies track 20 as the culprit.
    I had deleted an re-dragged the control several time, checked and re-checked the table definitions in SQL Server To no avail.
    Any suggestion?
    sirmilt

    The exact message is "No Null Allowed Exception Was Unhandled" and identifies track 20 as the culprit.
    I had deleted an re-dragged the control several time ...
    You can do this as often as you like; if the column track20 is defined as NOT NULL, then you cannot write a NULL value to this column. Either change the column definition or take care that you write a not NULL value to it.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Linq to XML query where clause excluding null attribute in child

    I'm quite new to linq/XML and although I'm making progress I'm stuck at combining two levels of elements in a where clause. The XML is something like this
    <employees type="cashier">
    <employee hired="Jun 1 2000" fired="Jun 1 2013">
    <stats name="jane doe">
    ... other stuff ...
    <stats />
    <employee/> <employee hired="Jun 1 2000">
            <stats name="john doe">
                ... other stuff ...
            <stats />
        <employee/>
    <employees/>
    I'm trying to retrieve all employees of type "cashier" that haven't been fired.
    I tried this
    IEnumerable<XElement> CashierElements = from el in xDoc.Root.Descendants("employees")
    where (string)el.Attribute("type")=="cashier"
    && (string)el.Element("stats").Attribute("fired") != null
    select el;
    But that returns entries where the fired attribute doesn't exist. I'm not even sure I can reference the stats element attribute in this way but VS2013 doesn't complain about it.
    I have managed to muddle past by using two linq selections, the one above without the stats comparison followed by a second on the results that checks for "fired" being null.
    How would I achieve this with one select statement?
    Thanks!

    Hi,
    1) Your XML contains the attribute "fired" on "employee" element. Your query search this attribute on the "stats" element.
    2) you say "that haven't been fired" by you search an attribute fired != null ? I'm not sure about your logic.
    If I understand your request, your LINQ Query is more than :
    IEnumerable<XElement> CashierElements =
    // Loop on <employees>
    from emps in xDoc.Root.Descendants("employees")
    // only 'cashier' type
    where (string)emps.Attribute("type") == "cashier"
    // Loop on <employee> in filtered <employees>
    from emp in emps.Elements("employee")
    // only the employee not fired
    where emp.Attribute("fired") == null
    // select the employee element
    select emp;
    Regards
    Yan Grenier
    Merci de bien vouloir "Marquer comme réponse", les réponses qui ont répondues à votre question, et de noter les réponses que vous avez trouvé utiles.

  • SQL Query - Where cause where only exists once...?

    I have a query/result set that I'm trying to query/filter.
    What I need is, in two of the 5 columns in the resultset, I need returned where the record only exists once. In the other 3, they have to meet certain criteria.
    So, logically it would true for all: give me results where results in column 1,2 only exist once AND column3 is null and column3 is null and column5 =Server
    Not sure if this make sense....? :/
    a
    Edited by: Topher34 on Mar 11, 2010 4:18 PM

    Topher34 wrote:
    Not sure if this make sense....? :/
    I can give a example table....how do I ''code'' the script?An example certainly would help (also please mention your database version).
    Put your example between the tag (put the tag before and after your example).
    Use CTAS or CREATE TABLE + INSERT statements, and the desired output you want from that.
    See the FAQ for more information regarding tags:
    http://forums.oracle.com/forums/help.jspa (scroll down a bit)
    CTAS =  Create Table As Select ....<your query>.
    It is less work than providing CREATE TABLE and INSERT INTO statements.
    If your database version allows for it, you can achieve the same using the WITH clause.
    But in the end: providing working and (small but complete) examples will boost the response to your question.
    Also, chances are that when you put up an example, you'll see the answer yourself.
    +edit+
    Never mind, bedtime for me ;)
    Edited by: hoek on Mar 11, 2010 11:26 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Inserting field text into sql query and comparing values to another table

    I have an issue in Visual Web Developer 2010 that I need help with.
    The code below is a Gridview Sql query where I'm extracting PART_NUMBER from various tables.  I would like to add the table name in a separate field named Table.  The end result should appear as follows:
    PART_NUMBER     Table
    010-0075-06       Resistors (or Capacitors, etc.)
    Sql query:
    SELECT     PART_NUMBER
    FROM         Capacitors
    EXCEPT
    SELECT     PART_NUMBER
    FROM         [CIS Manufacturer Parts]
    UNION
    SELECT     PART_NUMBER
    FROM         Connectors
    EXCEPT
    SELECT     PART_NUMBER
    FROM         [CIS Manufacturer Parts]
    UNION
    SELECT     PART_NUMBER
    FROM         Diodes
    EXCEPT
    SELECT     PART_NUMBER
    FROM         [CIS Manufacturer Parts]
    UNION
    SELECT     PART_NUMBER
    FROM         ICs
    EXCEPT
    SELECT     PART_NUMBER
    FROM         [CIS Manufacturer Parts]
    UNION
    SELECT     PART_NUMBER
    FROM         Inductors
    EXCEPT
    SELECT     PART_NUMBER
    FROM         [CIS Manufacturer Parts]
    UNION
    SELECT     PART_NUMBER
    FROM         Misc
    EXCEPT
    SELECT     PART_NUMBER
    FROM         [CIS Manufacturer Parts]
    UNION
    SELECT     PART_NUMBER
    FROM         Relays
    EXCEPT
    SELECT     PART_NUMBER
    FROM         [CIS Manufacturer Parts]
    UNION
    SELECT     PART_NUMBER
    FROM         Resistors
    EXCEPT
    SELECT     PART_NUMBER
    FROM         [CIS Manufacturer Parts]
    UNION
    SELECT     PART_NUMBER
    FROM         Switches
    EXCEPT
    SELECT     PART_NUMBER
    FROM         [CIS Manufacturer Parts]
    UNION
    SELECT     PART_NUMBER
    FROM         Transformers
    EXCEPT
    SELECT     PART_NUMBER
    FROM         [CIS Manufacturer Parts]
    UNION
    SELECT     PART_NUMBER
    FROM         Transistors
    EXCEPT
    SELECT     PART_NUMBER
    FROM         [CIS Manufacturer Parts]
    UNION
    SELECT     PART_NUMBER
    FROM         [Crystals and Oscillators]
    EXCEPT
    SELECT     PART_NUMBER
    FROM         [CIS Manufacturer Parts]
    ORDER BY PART_NUMBER
    I have a separate table (CIS Manufacturer Parts) that contains manufacturer data for the above parts.  Multiple manufacturer rows can exist.  The connection between tables in the PART_NUMBER field.  What I would like to do is make this query
    add the table name to the gridview output listing only parts without manufacturer data and the table they can be found in.
    This is a lot for a newbie so I will appreciate any help, thanks!

    Hello Bulldog248,
    Thank you for your post.
    Your issue is out of support range of VS General Question forum which mainly discusses the usage issue of Visual Studio IDE such as
    WPF & SL designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System
    and Visual Studio Editor.
    I am moving your question to the moderator forum ("Where is the forum for..?"). The owner of the forum will direct you to a right forum.
    Best regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • SQL Query + long execution time.

    Dear Gurus/masters/All,
    I request you all to help me in tuning the SQL query which is taking more time. DB Version : 10.2.0.4
    SQL Query WHERE condition:
    select column1, column2, .........
    FROM
    SIEBEL.S_ORG_EXT T1,
    SIEBEL.S_PROD_INT T2,
    SIEBEL.S_VOD T3,
    SIEBEL.S_ORG_EXT T4,
    SIEBEL.S_ORG_EXT T5,
    SIEBEL.S_ORG_EXT_X T6,
    SIEBEL.S_PROD_LN T7,
    SIEBEL.S_ASSET_OM T8,
    SIEBEL.S_VOD_VER T9,
    SIEBEL.S_CTLG_CAT T10,
    SIEBEL.S_CONTACT T11,
    SIEBEL.S_PARTY T12,
    SIEBEL.S_PARTY T13,
    SIEBEL.S_PROD_INT T14,
    SIEBEL.S_ASSET_BU T15,
    SIEBEL.S_CTLG_CAT T16,
    SIEBEL.S_ORG_EXT T17,
    SIEBEL.S_ORG_EXT T18,
    SIEBEL.S_ASSET T19,
    SIEBEL.S_ADDR_PER T20,
    SIEBEL.S_ORG_EXT T21,
    SIEBEL.S_ASSET_X T22,
    SIEBEL.S_ASSET T23
    WHERE
    T16.PAR_CAT_ID = T10.ROW_ID (+) AND
    T14.CG_PR_CTLG_CAT_ID = T16.ROW_ID (+) AND
    T3.ROW_ID = T9.VOD_ID AND
    T14.CFG_MODEL_ID = T3.OBJECT_NUM AND
    T23.OWNER_CON_ID = T11.ROW_ID (+) AND
    T23.OWNER_ACCNT_ID = T6.PAR_ROW_ID (+) AND
    T23.PER_ADDR_ID = T20.ROW_ID (+) AND
    T23.PROD_ID = T14.ROW_ID AND
    T23.OWNER_ACCNT_ID = T21.PAR_ROW_ID (+) AND
    T14.PR_PROD_LN_ID = T7.ROW_ID (+) AND
    T23.ROOT_ASSET_ID = T19.ROW_ID (+) AND
    T19.PROD_ID = T2.ROW_ID (+) AND
    T23.BILL_ACCNT_ID = T18.PAR_ROW_ID (+) AND
    T23.RTNG_DLR_ID = T1.PAR_ROW_ID (+) AND
    T23.PREF_SRV_DLR_ID = T17.PAR_ROW_ID (+) AND
    T23.DLR_ID = T4.PAR_ROW_ID (+) AND
    T23.ROW_ID = T22.PAR_ROW_ID (+) AND
    T23.ROW_ID = T8.PAR_ROW_ID (+) AND
    T23.PR_CON_ID = T12.ROW_ID (+) AND
    T23.BU_ID = T15.BU_ID (+) AND T23.ROW_ID = T15.ASSET_ID (+) AND
    T15.BU_ID = T13.ROW_ID (+) AND
    T15.BU_ID = T5.PAR_ROW_ID (+) AND
    ((T23.SERIAL_NUM IS NOT NULL AND T23.PAR_ASSET_ID IS NULL OR T23.X_PHONE_NUMBER IS NOT NULL AND T23.PAR_ASSET_ID IS NOT NULL) AND
    (T9.VER_NUM = :1));Query Exection Plan:
    PLAN_TABLE_OUTPUT
    Plan hash value: 967177145
    | Id  | Operation                                         | Name           | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                                  |                | 54117 |    92M|  4435K  (1)| 01:58:43 |
    |   1 |  NESTED LOOPS OUTER                               |                | 54117 |    92M|  4435K  (1)| 01:58:43 |
    |   2 |   NESTED LOOPS OUTER                              |                | 54117 |    87M|  4261K  (1)| 01:54:04 |
    |   3 |    NESTED LOOPS OUTER                             |                | 54117 |    86M|  4154K  (1)| 01:51:13 |
    |   4 |     NESTED LOOPS OUTER                            |                | 54117 |    85M|  4111K  (1)| 01:50:03 |
    |   5 |      NESTED LOOPS OUTER                           |                | 54117 |    84M|  3980K  (1)| 01:46:33 |
    |   6 |       NESTED LOOPS OUTER                          |                | 54117 |    83M|  3937K  (1)| 01:45:24 |
    |   7 |        NESTED LOOPS OUTER                         |                | 54117 |    81M|  3763K  (1)| 01:40:44 |
    |   8 |         NESTED LOOPS OUTER                        |                | 54117 |    81M|  3751K  (1)| 01:40:25 |
    |   9 |          NESTED LOOPS OUTER                       |                | 54117 |    80M|  3621K  (1)| 01:36:57 |
    |  10 |           NESTED LOOPS OUTER                      |                | 54117 |    73M|  3515K  (1)| 01:34:07 |
    |  11 |            NESTED LOOPS OUTER                     |                | 54117 |    71M|  3410K  (1)| 01:31:18 |
    |  12 |             NESTED LOOPS OUTER                    |                | 54117 |    69M|  3410K  (1)| 01:31:18 |
    |  13 |              NESTED LOOPS OUTER                   |                | 54117 |    67M|  3410K  (1)| 01:31:18 |
    |  14 |               NESTED LOOPS OUTER                  |                | 54117 |    66M|  3410K  (1)| 01:31:18 |
    |  15 |                NESTED LOOPS OUTER                 |                | 54117 |    64M|  3324K  (1)| 01:28:59 |
    |  16 |                 NESTED LOOPS OUTER                |                | 54117 |    62M|  3237K  (1)| 01:26:40 |
    |  17 |                  NESTED LOOPS                     |                | 54117 |    57M|  3106K  (1)| 01:23:10 |
    |  18 |                   NESTED LOOPS OUTER              |                |    71 | 43665 |   381   (2)| 00:00:01 |
    |  19 |                    NESTED LOOPS OUTER             |                |    71 | 42316 |   323   (2)| 00:00:01 |
    |  20 |                     NESTED LOOPS OUTER            |                |    71 | 41322 |   322   (2)| 00:00:01 |
    |  21 |                      NESTED LOOPS                 |                |    71 | 24708 |   265   (3)| 00:00:01 |
    |  22 |                       NESTED LOOPS                |                |    77 |  2772 |   141   (4)| 00:00:01 |
    |* 23 |                        TABLE ACCESS FULL          | S_VOD_VER      |    75 |  1350 |    72   (7)| 00:00:01 |
    |  24 |                        TABLE ACCESS BY INDEX ROWID| S_VOD          |     1 |    18 |     1   (0)| 00:00:01 |
    |* 25 |                         INDEX UNIQUE SCAN         | S_VOD_P1       |     1 |       |     1   (0)| 00:00:01 |
    |  26 |                       TABLE ACCESS BY INDEX ROWID | S_PROD_INT     |     1 |   312 |     2   (0)| 00:00:01 |
    |* 27 |                        INDEX RANGE SCAN           | S_PROD_INT_F9  |     1 |       |     1   (0)| 00:00:01 |
    |  28 |                      TABLE ACCESS BY INDEX ROWID  | S_PROD_LN      |     1 |   234 |     1   (0)| 00:00:01 |
    |* 29 |                       INDEX UNIQUE SCAN           | S_PROD_LN_P1   |     1 |       |     1   (0)| 00:00:01 |
    |  30 |                     TABLE ACCESS BY INDEX ROWID   | S_CTLG_CAT     |     1 |    14 |     1   (0)| 00:00:01 |
    |* 31 |                      INDEX UNIQUE SCAN            | S_CTLG_CAT_P1  |     1 |       |     1   (0)| 00:00:01 |
    |  32 |                    TABLE ACCESS BY INDEX ROWID    | S_CTLG_CAT     |     1 |    19 |     1   (0)| 00:00:01 |
    |* 33 |                     INDEX UNIQUE SCAN             | S_CTLG_CAT_P1  |     1 |       |     1   (0)| 00:00:01 |
    |* 34 |                   TABLE ACCESS BY INDEX ROWID     | S_ASSET        |   760 |   375K| 43753   (1)| 00:01:11 |
    |* 35 |                    INDEX RANGE SCAN               | S_ASSET_U2     | 55873 |       |   312   (3)| 00:00:01 |
    |  36 |                  TABLE ACCESS BY INDEX ROWID      | S_ASSET_OM     |     1 |    94 |     2   (0)| 00:00:01 |
    |* 37 |                   INDEX RANGE SCAN                | S_ASSET_OM_U1  |     1 |       |     2   (0)| 00:00:01 |
    |  38 |                 TABLE ACCESS BY INDEX ROWID       | S_CONTACT      |     1 |    39 |     2   (0)| 00:00:01 |
    |* 39 |                  INDEX UNIQUE SCAN                | S_CONTACT_P1   |     1 |       |     1   (0)| 00:00:01 |
    |  40 |                TABLE ACCESS BY INDEX ROWID        | S_ADDR_PER     |     1 |    29 |     2   (0)| 00:00:01 |
    |* 41 |                 INDEX UNIQUE SCAN                 | S_ADDR_PER_P1  |     1 |       |     1   (0)| 00:00:01 |
    |  42 |               TABLE ACCESS BY INDEX ROWID         | S_ORG_EXT      |     1 |    32 |     1   (0)| 00:00:01 |
    |* 43 |                INDEX UNIQUE SCAN                  | S_ORG_EXT_U3   |     1 |       |     1   (0)| 00:00:01 |
    |  44 |              TABLE ACCESS BY INDEX ROWID          | S_ORG_EXT      |     1 |    32 |     1   (0)| 00:00:01 |
    |* 45 |               INDEX UNIQUE SCAN                   | S_ORG_EXT_U3   |     1 |       |     1   (0)| 00:00:01 |
    |  46 |             TABLE ACCESS BY INDEX ROWID           | S_ORG_EXT      |     1 |    32 |     1   (0)| 00:00:01 |
    |* 47 |              INDEX UNIQUE SCAN                    | S_ORG_EXT_U3   |     1 |       |     1   (0)| 00:00:01 |
    |  48 |            TABLE ACCESS BY INDEX ROWID            | S_ORG_EXT      |     1 |    36 |     2   (0)| 00:00:01 |
    |* 49 |             INDEX UNIQUE SCAN                     | S_ORG_EXT_U3   |     1 |       |     1   (0)| 00:00:01 |
    |  50 |           TABLE ACCESS BY INDEX ROWID             | S_ORG_EXT      |     1 |   139 |     2   (0)| 00:00:01 |
    |* 51 |            INDEX UNIQUE SCAN                      | S_ORG_EXT_U3   |     1 |       |     1   (0)| 00:00:01 |
    |  52 |          TABLE ACCESS BY INDEX ROWID              | S_ORG_EXT_X    |     1 |    16 |     2   (0)| 00:00:01 |
    |* 53 |           INDEX RANGE SCAN                        | S_ORG_EXT_X_U1 |     1 |       |     2   (0)| 00:00:01 |
    |* 54 |         INDEX UNIQUE SCAN                         | S_PARTY_P1     |     1 |    12 |     1   (0)| 00:00:01 |
    |  55 |        TABLE ACCESS BY INDEX ROWID                | S_ASSET_BU     |     1 |    34 |     3   (0)| 00:00:01 |
    |* 56 |         INDEX RANGE SCAN                          | S_ASSET_BU_U1  |     1 |       |     2   (0)| 00:00:01 |
    |* 57 |       INDEX UNIQUE SCAN                           | S_PARTY_P1     |     1 |    12 |     1   (0)| 00:00:01 |
    |  58 |      TABLE ACCESS BY INDEX ROWID                  | S_ASSET        |     1 |    37 |     2   (0)| 00:00:01 |
    |* 59 |       INDEX UNIQUE SCAN                           | S_ASSET_P1     |     1 |       |     2   (0)| 00:00:01 |
    |  60 |     TABLE ACCESS BY INDEX ROWID                   | S_PROD_INT     |     1 |    16 |     1   (0)| 00:00:01 |
    |* 61 |      INDEX UNIQUE SCAN                            | S_PROD_INT_P1  |     1 |       |     1   (0)| 00:00:01 |
    |  62 |    TABLE ACCESS BY INDEX ROWID                    | S_ORG_EXT      |     1 |    14 |     2   (0)| 00:00:01 |
    |* 63 |     INDEX UNIQUE SCAN                             | S_ORG_EXT_U3   |     1 |       |     1   (0)| 00:00:01 |
    |  64 |   TABLE ACCESS BY INDEX ROWID                     | S_ASSET_X      |     1 |    93 |     3   (0)| 00:00:01 |
    |* 65 |    INDEX RANGE SCAN                               | S_ASSET_X_U1   |     1 |       |     2   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
      23 - filter("T9"."VER_NUM"=TO_NUMBER(:1))
      25 - access("T3"."ROW_ID"="T9"."VOD_ID")
      27 - access("T14"."CFG_MODEL_ID"="T3"."OBJECT_NUM")
      29 - access("T14"."PR_PROD_LN_ID"="T7"."ROW_ID"(+))
      31 - access("T14"."CG_PR_CTLG_CAT_ID"="T16"."ROW_ID"(+))
      33 - access("T16"."PAR_CAT_ID"="T10"."ROW_ID"(+))
      34 - filter("T23"."PAR_ASSET_ID" IS NULL AND "T23"."SERIAL_NUM" IS NOT NULL OR "T23"."X_PHONE_NUMBER" IS
                  NOT NULL AND "T23"."PAR_ASSET_ID" IS NOT NULL)
      35 - access("T23"."PROD_ID"="T14"."ROW_ID")
      37 - access("T23"."ROW_ID"="T8"."PAR_ROW_ID"(+))
      39 - access("T23"."OWNER_CON_ID"="T11"."ROW_ID"(+))
      41 - access("T23"."PER_ADDR_ID"="T20"."ROW_ID"(+))
      43 - access("T23"."RTNG_DLR_ID"="T1"."PAR_ROW_ID"(+))
      45 - access("T23"."DLR_ID"="T4"."PAR_ROW_ID"(+))
      47 - access("T23"."PREF_SRV_DLR_ID"="T17"."PAR_ROW_ID"(+))
      49 - access("T23"."BILL_ACCNT_ID"="T18"."PAR_ROW_ID"(+))
      51 - access("T23"."OWNER_ACCNT_ID"="T21"."PAR_ROW_ID"(+))
      53 - access("T23"."OWNER_ACCNT_ID"="T6"."PAR_ROW_ID"(+))
      54 - access("T23"."PR_CON_ID"="T12"."ROW_ID"(+))
      56 - access("T23"."ROW_ID"="T15"."ASSET_ID"(+) AND "T23"."BU_ID"="T15"."BU_ID"(+))
      57 - access("T15"."BU_ID"="T13"."ROW_ID"(+))
      59 - access("T23"."ROOT_ASSET_ID"="T19"."ROW_ID"(+))
      61 - access("T19"."PROD_ID"="T2"."ROW_ID"(+))
      63 - access("T15"."BU_ID"="T5"."PAR_ROW_ID"(+))
      65 - access("T23"."ROW_ID"="T22"."PAR_ROW_ID"(+))
    Note
       - dynamic sampling used for this statement
    105 rows selected.

    out put of dbms_xplan.display_cursor :
    SQL> select * from table(dbms_xplan.display_cursor('xxxxxxxxxxxxxx',NULL,'iostats last'));
    PLAN_TABLE_OUTPUT
    SQL_ID  xxxxxxxxxxxxxx, child number 0
    SELECT       T23.CONFLICT_ID,       T23.LAST_UPD,       T23.CREATED,       T23.LAST_UPD_BY,       T23.CREATED_BY,
    T23.MODIFICATION_NUM,       T23.ROW_ID,       T23.ASSET_NUM,       T21.LOC,       T21.NAME,       T23.INSTALL_DT,
    T23.INVLOC_ID,       T23.NAME,       T23.OU_ADDR_ID,       T23.OWNER_ACCNT_ID,       T23.PAR_ASSET_ID,       T23.PER_ADDR_ID,
         T20.STATE,       T23.PR_CON_ID,       T23.PR_EMP_ID,       T14.DESC_TEXT,       T23.PROD_ID,       T14.NAME,
    T21.INTEGRATION_ID,       T23.COST_LST_ID,       T14.SERIALIZED_FLG,       T23.REGISTERED_DT,       T23.SERIAL_NUM,
    T23.VERSION,       T23.STATUS_CD,       T14.PR_PROD_LN_ID,       T7.NAME,       T23.QTY,       T23.ASSET_COND_CD,
    T23.PR_ACCNT_ID,       T23.OWNERSHIP_TYPE_CD,       T23.XA_CLASS_ID,       T23.OPER_STATUS_CD,       T23.SP_NUM,
    T23.BILL_ACCNT_ID,       T23.SERV_ACCT_ID,       T9.RELEASED_FLG,       T23.CFG_TYPE_CD,       T9.VER_NUM,       T23.END_DT,
        T23.ASSEMBLY_PORT_ID,
    Plan hash value: xxxxxxxxxxxxxx
    | Id  | Operation                                         | Name           | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  |
    |   1 |  NESTED LOOPS OUTER                               |                |      1 |     10 |     10 |00:23:58.99 |    1236K|    460K|
    |   2 |   NESTED LOOPS OUTER                              |                |      1 |     10 |     10 |00:23:58.99 |    1236K|    460K|
    |   3 |    NESTED LOOPS OUTER                             |                |      1 |     10 |     10 |00:23:58.85 |    1236K|    460K|
    |   4 |     NESTED LOOPS OUTER                            |                |      1 |     10 |     10 |00:23:58.69 |    1236K|    460K|
    |   5 |      NESTED LOOPS OUTER                           |                |      1 |     10 |     10 |00:23:58.69 |    1236K|    460K|
    |   6 |       NESTED LOOPS OUTER                          |                |      1 |     10 |     10 |00:23:58.69 |    1236K|    460K|
    |   7 |        NESTED LOOPS OUTER                         |                |      1 |     11 |     10 |00:23:58.47 |    1236K|    460K|
    |   8 |         NESTED LOOPS OUTER                        |                |      1 |     11 |     10 |00:23:58.47 |    1236K|    460K|
    |   9 |          NESTED LOOPS OUTER                       |                |      1 |     11 |     10 |00:23:58.37 |    1236K|    460K|
    |  10 |           NESTED LOOPS OUTER                      |                |      1 |     11 |     10 |00:23:58.22 |    1236K|    460K|
    |  11 |            NESTED LOOPS OUTER                     |                |      1 |     11 |     10 |00:23:58.16 |    1236K|    460K|
    |  12 |             NESTED LOOPS OUTER                    |                |      1 |     11 |     10 |00:23:58.16 |    1236K|    460K|
    |  13 |              NESTED LOOPS OUTER                   |                |      1 |     11 |     10 |00:23:58.16 |    1236K|    460K|
    |  14 |               NESTED LOOPS OUTER                  |                |      1 |     11 |     10 |00:23:58.16 |    1236K|    460K|
    |  15 |                NESTED LOOPS OUTER                 |                |      1 |     11 |     10 |00:23:58.09 |    1236K|    460K|
    |  16 |                 NESTED LOOPS OUTER                |                |      1 |     11 |     10 |00:23:57.99 |    1236K|    460K|
    |  17 |                  NESTED LOOPS                     |                |      1 |     11 |     10 |00:23:57.98 |    1236K|    460K|
    |  18 |                   NESTED LOOPS OUTER              |                |      1 |      1 |     57 |00:00:00.02 |     828 |      0 |
    |  19 |                    NESTED LOOPS OUTER             |                |      1 |      2 |     57 |00:00:00.02 |     828 |      0 |
    |  20 |                     NESTED LOOPS OUTER            |                |      1 |      2 |     57 |00:00:00.02 |     828 |      0 |
    |  21 |                      NESTED LOOPS                 |                |      1 |      2 |     57 |00:00:00.01 |     786 |      0 |
    |  22 |                       NESTED LOOPS                |                |      1 |      2 |    232 |00:00:00.01 |     493 |      0 |
    |* 23 |                        TABLE ACCESS FULL          | S_VOD_VER      |      1 |     75 |    246 |00:00:00.01 |      12 |      0 |
    |  24 |                        TABLE ACCESS BY INDEX ROWID| S_VOD          |    246 |      1 |    232 |00:00:00.01 |     481 |      0 |
    |* 25 |                         INDEX UNIQUE SCAN         | S_VOD_P1       |    246 |      1 |    232 |00:00:00.01 |     249 |      0 |
    |  26 |                       TABLE ACCESS BY INDEX ROWID | S_PROD_INT     |    232 |      1 |     57 |00:00:00.01 |     293 |      0 |
    |* 27 |                        INDEX RANGE SCAN           | S_PROD_INT_F9  |    232 |      1 |     57 |00:00:00.01 |     236 |      0 |
    |  28 |                      TABLE ACCESS BY INDEX ROWID  | S_PROD_LN      |     57 |      1 |     39 |00:00:00.01 |      42 |      0 |
    |* 29 |                       INDEX UNIQUE SCAN           | S_PROD_LN_P1   |     57 |      1 |     39 |00:00:00.01 |       3 |      0 |
    |  30 |                     TABLE ACCESS BY INDEX ROWID   | S_CTLG_CAT     |     57 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |* 31 |                      INDEX UNIQUE SCAN            | S_CTLG_CAT_P1  |     57 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |  32 |                    TABLE ACCESS BY INDEX ROWID    | S_CTLG_CAT     |     57 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |* 33 |                     INDEX UNIQUE SCAN             | S_CTLG_CAT_P1  |     57 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |* 34 |                   TABLE ACCESS BY INDEX ROWID     | S_ASSET        |     57 |     10 |     10 |00:23:57.97 |    1235K|    460K|
    |* 35 |                    INDEX RANGE SCAN               | S_ASSET_U2     |     57 |    734 |    627K|00:00:01.34 |    4295 |   2032 |
    |  36 |                  TABLE ACCESS BY INDEX ROWID      | S_ASSET_OM     |     10 |      1 |      0 |00:00:00.01 |      26 |      2 |
    |* 37 |                   INDEX RANGE SCAN                | S_ASSET_OM_U1  |     10 |      1 |      0 |00:00:00.01 |      26 |      2 |
    |  38 |                 TABLE ACCESS BY INDEX ROWID       | S_CONTACT      |     10 |      1 |     10 |00:00:00.11 |      36 |     12 |
    |* 39 |                  INDEX UNIQUE SCAN                | S_CONTACT_P1   |     10 |      1 |     10 |00:00:00.06 |      26 |      6 |
    |  40 |                TABLE ACCESS BY INDEX ROWID        | S_ADDR_PER     |     10 |      1 |     10 |00:00:00.07 |      36 |     18 |
    |* 41 |                 INDEX UNIQUE SCAN                 | S_ADDR_PER_P1  |     10 |      1 |     10 |00:00:00.04 |      26 |      8 |
    |  42 |               TABLE ACCESS BY INDEX ROWID         | S_ORG_EXT      |     10 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |* 43 |                INDEX UNIQUE SCAN                  | S_ORG_EXT_U3   |     10 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |  44 |              TABLE ACCESS BY INDEX ROWID          | S_ORG_EXT      |     10 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |* 45 |               INDEX UNIQUE SCAN                   | S_ORG_EXT_U3   |     10 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |  46 |             TABLE ACCESS BY INDEX ROWID           | S_ORG_EXT      |     10 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |* 47 |              INDEX UNIQUE SCAN                    | S_ORG_EXT_U3   |     10 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |  48 |            TABLE ACCESS BY INDEX ROWID            | S_ORG_EXT      |     10 |      1 |     10 |00:00:00.05 |      46 |     12 |
    |* 49 |             INDEX UNIQUE SCAN                     | S_ORG_EXT_U3   |     10 |      1 |     10 |00:00:00.03 |      26 |      6 |
    |  50 |           TABLE ACCESS BY INDEX ROWID             | S_ORG_EXT      |     10 |      1 |     10 |00:00:00.15 |      55 |     23 |
    |* 51 |            INDEX UNIQUE SCAN                      | S_ORG_EXT_U3   |     10 |      1 |     10 |00:00:00.04 |      26 |      6 |
    |  52 |          TABLE ACCESS BY INDEX ROWID              | S_ORG_EXT_X    |     10 |      1 |     10 |00:00:00.10 |      40 |     12 |
    |* 53 |           INDEX RANGE SCAN                        | S_ORG_EXT_X_U1 |     10 |      1 |     10 |00:00:00.05 |      30 |      6 |
    |* 54 |         INDEX UNIQUE SCAN                         | S_PARTY_P1     |     10 |      1 |      0 |00:00:00.01 |       5 |      0 |
    |  55 |        TABLE ACCESS BY INDEX ROWID                | S_ASSET_BU     |     10 |      1 |     10 |00:00:00.22 |      50 |     29 |
    |* 56 |         INDEX RANGE SCAN                          | S_ASSET_BU_U1  |     10 |      1 |     10 |00:00:00.15 |      40 |     19 |
    |  57 |       TABLE ACCESS BY INDEX ROWID                 | S_ORG_EXT      |     10 |      1 |     10 |00:00:00.01 |      36 |      0 |
    |* 58 |        INDEX UNIQUE SCAN                          | S_ORG_EXT_U3   |     10 |      1 |     10 |00:00:00.01 |      26 |      0 |
    |* 59 |      INDEX UNIQUE SCAN                            | S_PARTY_P1     |     10 |      1 |     10 |00:00:00.01 |      26 |      0 |
    |  60 |     TABLE ACCESS BY INDEX ROWID                   | S_ASSET_X      |     10 |      1 |     10 |00:00:00.16 |      50 |     20 |
    |* 61 |      INDEX RANGE SCAN                             | S_ASSET_X_U1   |     10 |      1 |     10 |00:00:00.09 |      40 |     10 |
    |  62 |    TABLE ACCESS BY INDEX ROWID                    | S_ASSET        |     10 |      1 |     10 |00:00:00.14 |      46 |     19 |
    |* 63 |     INDEX UNIQUE SCAN                             | S_ASSET_P1     |     10 |      1 |     10 |00:00:00.04 |      36 |      9 |
    |  64 |   TABLE ACCESS BY INDEX ROWID                     | S_PROD_INT     |     10 |      1 |     10 |00:00:00.01 |      26 |      0 |
    |* 65 |    INDEX UNIQUE SCAN                              | S_PROD_INT_P1  |     10 |      1 |     10 |00:00:00.01 |      16 |      0 |
    Predicate Information (identified by operation id):
      23 - filter("T9"."VER_NUM"=:1)
      25 - access("T3"."ROW_ID"="T9"."VOD_ID")
      27 - access("T14"."CFG_MODEL_ID"="T3"."OBJECT_NUM")
      29 - access("T14"."PR_PROD_LN_ID"="T7"."ROW_ID")
      31 - access("T14"."CG_PR_CTLG_CAT_ID"="T16"."ROW_ID")
      33 - access("T16"."PAR_CAT_ID"="T10"."ROW_ID")
      34 - filter((("T23"."PAR_ASSET_ID" IS NULL AND "T23"."SERIAL_NUM" IS NOT NULL) OR ("T23"."X_PHONE_NUMBER" IS NOT NULL AND
                  "T23"."PAR_ASSET_ID" IS NOT NULL)))
      35 - access("T23"."PROD_ID"="T14"."ROW_ID")
      37 - access("T23"."ROW_ID"="T8"."PAR_ROW_ID")
      39 - access("T23"."OWNER_CON_ID"="T11"."ROW_ID")
      41 - access("T23"."PER_ADDR_ID"="T20"."ROW_ID")
      43 - access("T23"."RTNG_DLR_ID"="T1"."PAR_ROW_ID")
      45 - access("T23"."DLR_ID"="T4"."PAR_ROW_ID")
      47 - access("T23"."PREF_SRV_DLR_ID"="T17"."PAR_ROW_ID")
      49 - access("T23"."BILL_ACCNT_ID"="T18"."PAR_ROW_ID")
      51 - access("T23"."OWNER_ACCNT_ID"="T21"."PAR_ROW_ID")
      53 - access("T23"."OWNER_ACCNT_ID"="T6"."PAR_ROW_ID")
      54 - access("T23"."PR_CON_ID"="T12"."ROW_ID")
      56 - access("T23"."ROW_ID"="T15"."ASSET_ID" AND "T23"."BU_ID"="T15"."BU_ID")
      58 - access("T15"."BU_ID"="T5"."PAR_ROW_ID")
      59 - access("T15"."BU_ID"="T13"."ROW_ID")
      61 - access("T23"."ROW_ID"="T22"."PAR_ROW_ID")
      63 - access("T23"."ROOT_ASSET_ID"="T19"."ROW_ID")
      65 - access("T19"."PROD_ID"="T2"."ROW_ID")
    SQL_ID  xxxxxxxxxxxxxx, child number 1
    SELECT       T23.CONFLICT_ID,       T23.LAST_UPD,       T23.CREATED,       T23.LAST_UPD_BY,       T23.CREATED_BY,
    T23.MODIFICATION_NUM,       T23.ROW_ID,       T23.ASSET_NUM,       T21.LOC,       T21.NAME,       T23.INSTALL_DT,
    T23.INVLOC_ID,       T23.NAME,       T23.OU_ADDR_ID,       T23.OWNER_ACCNT_ID,       T23.PAR_ASSET_ID,       T23.PER_ADDR_ID,
         T20.STATE,       T23.PR_CON_ID,       T23.PR_EMP_ID,       T14.DESC_TEXT,       T23.PROD_ID,       T14.NAME,
    T21.INTEGRATION_ID,       T23.COST_LST_ID,       T14.SERIALIZED_FLG,       T23.REGISTERED_DT,       T23.SERIAL_NUM,
    T23.VERSION,       T23.STATUS_CD,       T14.PR_PROD_LN_ID,       T7.NAME,       T23.QTY,       T23.ASSET_COND_CD,
    T23.PR_ACCNT_ID,       T23.OWNERSHIP_TYPE_CD,       T23.XA_CLASS_ID,       T23.OPER_STATUS_CD,       T23.SP_NUM,
    T23.BILL_ACCNT_ID,       T23.SERV_ACCT_ID,       T9.RELEASED_FLG,       T23.CFG_TYPE_CD,       T9.VER_NUM,       T23.END_DT,
        T23.ASSEMBLY_PORT_ID,
    Plan hash value: xxxxxxxxxxxxxx
    | Id  | Operation                                         | Name           | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  |
    |   1 |  NESTED LOOPS OUTER                               |                |      1 |     10 |     10 |00:28:15.04 |    1237K|    512K|
    |   2 |   NESTED LOOPS OUTER                              |                |      1 |     10 |     10 |00:28:15.04 |    1237K|    512K|
    |   3 |    NESTED LOOPS OUTER                             |                |      1 |     10 |     10 |00:28:14.92 |    1237K|    512K|
    |   4 |     NESTED LOOPS OUTER                            |                |      1 |     10 |     10 |00:28:14.82 |    1237K|    512K|
    |   5 |      NESTED LOOPS OUTER                           |                |      1 |     10 |     10 |00:28:14.82 |    1237K|    512K|
    |   6 |       NESTED LOOPS OUTER                          |                |      1 |     10 |     10 |00:28:14.82 |    1237K|    512K|
    |   7 |        NESTED LOOPS OUTER                         |                |      1 |     11 |     10 |00:28:14.64 |    1237K|    512K|
    |   8 |         NESTED LOOPS OUTER                        |                |      1 |     11 |     10 |00:28:14.63 |    1237K|    512K|
    |   9 |          NESTED LOOPS OUTER                       |                |      1 |     11 |     10 |00:28:14.51 |    1237K|    512K|
    |  10 |           NESTED LOOPS OUTER                      |                |      1 |     11 |     10 |00:28:14.42 |    1237K|    512K|
    |  11 |            NESTED LOOPS OUTER                     |                |      1 |     11 |     10 |00:28:14.33 |    1236K|    512K|
    |  12 |             NESTED LOOPS OUTER                    |                |      1 |     11 |     10 |00:28:14.33 |    1236K|    512K|
    |  13 |              NESTED LOOPS OUTER                   |                |      1 |     11 |     10 |00:28:14.33 |    1236K|    512K|
    |  14 |               NESTED LOOPS OUTER                  |                |      1 |     11 |     10 |00:28:14.33 |    1236K|    512K|
    |  15 |                NESTED LOOPS OUTER                 |                |      1 |     11 |     10 |00:28:14.23 |    1236K|    512K|
    |  16 |                 NESTED LOOPS OUTER                |                |      1 |     11 |     10 |00:28:14.12 |    1236K|    512K|
    |  17 |                  NESTED LOOPS                     |                |      1 |     11 |     10 |00:28:14.12 |    1236K|    512K|
    |  18 |                   NESTED LOOPS OUTER              |                |      1 |      1 |     57 |00:00:00.02 |     828 |      0 |
    |  19 |                    NESTED LOOPS OUTER             |                |      1 |      1 |     57 |00:00:00.02 |     828 |      0 |
    |  20 |                     NESTED LOOPS OUTER            |                |      1 |      1 |     57 |00:00:00.01 |     828 |      0 |
    |  21 |                      NESTED LOOPS                 |                |      1 |      1 |     57 |00:00:00.01 |     786 |      0 |
    |  22 |                       NESTED LOOPS                |                |      1 |      2 |    232 |00:00:00.01 |     493 |      0 |
    |* 23 |                        TABLE ACCESS FULL          | S_VOD_VER      |      1 |     74 |    246 |00:00:00.01 |      12 |      0 |
    |  24 |                        TABLE ACCESS BY INDEX ROWID| S_VOD          |    246 |      1 |    232 |00:00:00.01 |     481 |      0 |
    |* 25 |                         INDEX UNIQUE SCAN         | S_VOD_P1       |    246 |      1 |    232 |00:00:00.01 |     249 |      0 |
    |  26 |                       TABLE ACCESS BY INDEX ROWID | S_PROD_INT     |    232 |      1 |     57 |00:00:00.01 |     293 |      0 |
    |* 27 |                        INDEX RANGE SCAN           | S_PROD_INT_F9  |    232 |      1 |     57 |00:00:00.01 |     236 |      0 |
    |  28 |                      TABLE ACCESS BY INDEX ROWID  | S_PROD_LN      |     57 |      1 |     39 |00:00:00.01 |      42 |      0 |
    |* 29 |                       INDEX UNIQUE SCAN           | S_PROD_LN_P1   |     57 |      1 |     39 |00:00:00.01 |       3 |      0 |
    |  30 |                     TABLE ACCESS BY INDEX ROWID   | S_CTLG_CAT     |     57 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |* 31 |                      INDEX UNIQUE SCAN            | S_CTLG_CAT_P1  |     57 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |  32 |                    TABLE ACCESS BY INDEX ROWID    | S_CTLG_CAT     |     57 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |* 33 |                     INDEX UNIQUE SCAN             | S_CTLG_CAT_P1  |     57 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |* 34 |                   TABLE ACCESS BY INDEX ROWID     | S_ASSET        |     57 |     10 |     10 |00:28:14.10 |    1236K|    512K|
    |* 35 |                    INDEX RANGE SCAN               | S_ASSET_U2     |     57 |    734 |    627K|00:00:01.26 |    4299 |   3327 |
    |  36 |                  TABLE ACCESS BY INDEX ROWID      | S_ASSET_OM     |     10 |      1 |      0 |00:00:00.01 |      26 |      2 |
    |* 37 |                   INDEX RANGE SCAN                | S_ASSET_OM_U1  |     10 |      1 |      0 |00:00:00.01 |      26 |      2 |
    |  38 |                 TABLE ACCESS BY INDEX ROWID       | S_CONTACT      |     10 |      1 |     10 |00:00:00.10 |      36 |     18 |
    |* 39 |                  INDEX UNIQUE SCAN                | S_CONTACT_P1   |     10 |      1 |     10 |00:00:00.04 |      26 |      9 |
    |  40 |                TABLE ACCESS BY INDEX ROWID        | S_ADDR_PER     |     10 |      1 |     10 |00:00:00.11 |      36 |     20 |
    |* 41 |                 INDEX UNIQUE SCAN                 | S_ADDR_PER_P1  |     10 |      1 |     10 |00:00:00.04 |      26 |     10 |
    |  42 |               TABLE ACCESS BY INDEX ROWID         | S_ORG_EXT      |     10 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |* 43 |                INDEX UNIQUE SCAN                  | S_ORG_EXT_U3   |     10 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |  44 |              TABLE ACCESS BY INDEX ROWID          | S_ORG_EXT      |     10 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |* 45 |               INDEX UNIQUE SCAN                   | S_ORG_EXT_U3   |     10 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |  46 |             TABLE ACCESS BY INDEX ROWID           | S_ORG_EXT      |     10 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |* 47 |              INDEX UNIQUE SCAN                    | S_ORG_EXT_U3   |     10 |      1 |      0 |00:00:00.01 |       0 |      0 |
    |  48 |            TABLE ACCESS BY INDEX ROWID            | S_ORG_EXT      |     10 |      1 |     10 |00:00:00.09 |      46 |     18 |
    |* 49 |             INDEX UNIQUE SCAN                     | S_ORG_EXT_U3   |     10 |      1 |     10 |00:00:00.05 |      26 |      9 |
    |  50 |           TABLE ACCESS BY INDEX ROWID             | S_ORG_EXT      |     10 |      1 |     10 |00:00:00.09 |      55 |     32 |
    |* 51 |            INDEX UNIQUE SCAN                      | S_ORG_EXT_U3   |     10 |      1 |     10 |00:00:00.02 |      26 |      8 |
    |  52 |          TABLE ACCESS BY INDEX ROWID              | S_ORG_EXT_X    |     10 |      1 |     10 |00:00:00.13 |      40 |     18 |
    |* 53 |           INDEX RANGE SCAN                        | S_ORG_EXT_X_U1 |     10 |      1 |     10 |00:00:00.06 |      30 |      9 |
    |* 54 |         INDEX UNIQUE SCAN                         | S_PARTY_P1     |     10 |      1 |      0 |00:00:00.01 |       5 |      0 |
    |  55 |        TABLE ACCESS BY INDEX ROWID                | S_ASSET_BU     |     10 |      1 |     10 |00:00:00.18 |      50 |     29 |
    |* 56 |         INDEX RANGE SCAN                          | S_ASSET_BU_U1  |     10 |      1 |     10 |00:00:00.11 |      40 |     19 |
    |  57 |       TABLE ACCESS BY INDEX ROWID                 | S_ORG_EXT      |     10 |      1 |     10 |00:00:00.01 |      36 |      0 |
    |* 58 |        INDEX UNIQUE SCAN                          | S_ORG_EXT_U3   |     10 |      1 |     10 |00:00:00.01 |      26 |      0 |
    |* 59 |      INDEX UNIQUE SCAN                            | S_PARTY_P1     |     10 |      1 |     10 |00:00:00.01 |      26 |      0 |
    |  60 |     TABLE ACCESS BY INDEX ROWID                   | S_ASSET_X      |     10 |      1 |     10 |00:00:00.10 |      50 |     20 |
    |* 61 |      INDEX RANGE SCAN                             | S_ASSET_X_U1   |     10 |      1 |     10 |00:00:00.03 |      40 |     10 |
    |  62 |    TABLE ACCESS BY INDEX ROWID                    | S_ASSET        |     10 |      1 |     10 |00:00:00.12 |      46 |     20 |
    |* 63 |     INDEX UNIQUE SCAN                             | S_ASSET_P1     |     10 |      1 |     10 |00:00:00.06 |      36 |     10 |
    |  64 |   TABLE ACCESS BY INDEX ROWID                     | S_PROD_INT     |     10 |      1 |     10 |00:00:00.01 |      26 |      0 |
    |* 65 |    INDEX UNIQUE SCAN                              | S_PROD_INT_P1  |     10 |      1 |     10 |00:00:00.01 |      16 |      0 |
    Predicate Information (identified by operation id):
      23 - filter("T9"."VER_NUM"=:1)
      25 - access("T3"."ROW_ID"="T9"."VOD_ID")
      27 - access("T14"."CFG_MODEL_ID"="T3"."OBJECT_NUM")
      29 - access("T14"."PR_PROD_LN_ID"="T7"."ROW_ID")
      31 - access("T14"."CG_PR_CTLG_CAT_ID"="T16"."ROW_ID")
      33 - access("T16"."PAR_CAT_ID"="T10"."ROW_ID")
      34 - filter((("T23"."PAR_ASSET_ID" IS NULL AND "T23"."SERIAL_NUM" IS NOT NULL) OR ("T23"."X_PHONE_NUMBER" IS NOT NULL AND
                  "T23"."PAR_ASSET_ID" IS NOT NULL)))
      35 - access("T23"."PROD_ID"="T14"."ROW_ID")
      37 - access("T23"."ROW_ID"="T8"."PAR_ROW_ID")
      39 - access("T23"."OWNER_CON_ID"="T11"."ROW_ID")
      41 - access("T23"."PER_ADDR_ID"="T20"."ROW_ID")
      43 - access("T23"."RTNG_DLR_ID"="T1"."PAR_ROW_ID")
      45 - access("T23"."DLR_ID"="T4"."PAR_ROW_ID")
      47 - access("T23"."PREF_SRV_DLR_ID"="T17"."PAR_ROW_ID")
      49 - access("T23"."BILL_ACCNT_ID"="T18"."PAR_ROW_ID")
      51 - access("T23"."OWNER_ACCNT_ID"="T21"."PAR_ROW_ID")
      53 - access("T23"."OWNER_ACCNT_ID"="T6"."PAR_ROW_ID")
      54 - access("T23"."PR_CON_ID"="T12"."ROW_ID")
      56 - access("T23"."ROW_ID"="T15"."ASSET_ID" AND "T23"."BU_ID"="T15"."BU_ID")
      58 - access("T15"."BU_ID"="T5"."PAR_ROW_ID")
      59 - access("T15"."BU_ID"="T13"."ROW_ID")
      61 - access("T23"."ROW_ID"="T22"."PAR_ROW_ID")
      63 - access("T23"."ROOT_ASSET_ID"="T19"."ROW_ID")
      65 - access("T19"."PROD_ID"="T2"."ROW_ID")
    226 rows selected.
    SQL >

  • Neea a sql query for inverting the table

    Hi,
    I am facing the problem in forming a SQL statement in oracle 10g
    Table structure:
    user field1 field2 field3 field4 field5 field6 .......
    one 11 12 13 14 15 16
    two 21 22 23 24 25 26
    three 31 32 33 34 35 36
    i want a SQL query where the out put is
    field1 11 21 31
    field2 12 22 32
    field3 13 23 33
    field4 14 24 34
    Regards,
    Balu CH

    check this Forums page
    <http://forums.oracle.com/forums/search.jspa?threadID=&q=Rows+to+Columns&objID=f75&dateRange=last90days&userID=&numResults=15>
    will help u.
    Rgds
    Sudar

  • Need help with sql query dates

    Hi,
    I have a sql query where i need to extract some info between given dates. The where clause of this query is as follows:
    WHERE CPD_BUS_UNIT=:ESI_PRM_1
    AND CPD_VOUCHER_DATE >= :P_DATE_FROM
    AND CPD_VOUCHER_DATE < (:P_DATE_TO+1)
    When i execute the query in toad, i can view the data but not the execution plan.It gives an error ORA-00932-Inconsistent Datatypes.
    But when i remove (+1) from :P_DATE_TO, i can c the execution plan and data. Will the data be different from the previous one.
    Please suggest how to rewrite the query.

    Can you please give it a try?
    WHERE CPD_BUS_UNIT=:ESI_PRM_1
    AND CPD_VOUCHER_DATE >= :to_date(P_DATE_FROM)
    AND CPD_VOUCHER_DATE < (to_date(:P_DATE_TO)+1) Regards

  • Need sql query to remove duplicates using UNION ALL clause

    Hi,
    I have a sql query which has UNION clause.But the UNION clause is causing some performance issues.
    To overcome that I have used UNION ALL to improve performance but its returning duplicates.
    Kindly anyone send a sample SQL query where my primary objective is used to use UNION ALL clause and to consider unique rows (elimating duplicate
    ones)
    Any help will be needful for me
    Thanks and Regards

    why not UNION? :(
    another way also use MINUS
    SQL>
    SQL> with t as
      2  (
      3  select 1 if from dual union all
      4  select 2 if from dual union all
      5  select 1 if from dual union all
      6  select 3 if from dual union all
      7  select 3 if from dual
      8  )
      9  ,t2 as
    10  (
    11  select 1 if from dual union all
    12  select 2 if from dual union all
    13  select 3 if from dual union all
    14  select 4 if from dual union all
    15  select 5 if from dual
    16  )
    17  (select if from t
    18  union all
    19  select if from t2)
    20  /
            IF
             1
             2
             1
             3
             3
             1
             2
             3
             4
             5
    10 rows selected
    SQL> so
    SQL>
    SQL> with t as
      2  (
      3  select 1 if from dual union all
      4  select 2 if from dual union all
      5  select 1 if from dual union all
      6  select 3 if from dual union all
      7  select 3 if from dual
      8  )
      9  ,t2 as
    10  (
    11  select 1 if from dual union all
    12  select 2 if from dual union all
    13  select 3 if from dual union all
    14  select 4 if from dual union all
    15  select 5 if from dual
    16  )
    17  (select if from t
    18  union all
    19  select if from t2)
    20  minus
    21  select -99 from dual
    22  /
            IF
             1
             2
             3
             4
             5
    SQL>

  • SQL Query to Join by Comma  - Help an assistance

    Hi,
    Thanks for your help in advance.
    Requirement is as follows.
    Table1
    =======
    Col1 Col2
    ============
    1 John
    2 Jocky
    3 Silk
    Table2
    ========
    Col1 Col2
    =========
    1 John, Marry, Joseph
    2 Silk, David
    3 Jocky, Prem
    I need an sql query where the join condition has to satisfy as follows
    Table1.col2=Table2.Col2 (If any of the col2 in table1 matches with Table2.Col2 i need to return the record).
    How to do this.
    Please guide me on this.

    nazzu wrote:
    Thanks a lot for your response ...
    But if a table1 and table2 had different numbers of rows then ?
    I may be behaving like a fool ... but my requrirement is such a fashion.
    Please help ...
    Thanks again for your help.
    Edited by: nazzu on Mar 14, 2013 8:22 AMHi,
    try to be clear in your requirement. You mentioned in your initial question:
    I need an sql query where the join condition has to satisfy as followsWhat happen if you have different number of rows in table1 and table2?
    Rows from table2 will be returned for any match in table1 if you are using a normal join. However if you have 2 rows in table1 that are matching table2 then that row in table2 will return twice.
    Let me just show you an example:
    WITH table1(col1, col2) AS
       SELECT 1, 'John'  FROM DUAL UNION ALL
       SELECT 2, 'Jocky' FROM DUAL UNION ALL
       SELECT 3, 'Silk'  FROM DUAL UNION ALL
       SELECT 4, 'Marry' FROM DUAL
    , table2(col1, col2) AS
       SELECT 1, 'John, Marry, Joseph'  FROM DUAL UNION ALL
       SELECT 2, 'Silk, David'          FROM DUAL UNION ALL
       SELECT 3, 'Jocky, Prem'          FROM DUAL
    SELECT t2.col1, t2.col2, t1.col2
      FROM table2 t2
           JOIN table1 t1
              ON(INSTR(', '||t2.col2||',', ', '||t1.col2||',')>0);
          COL1 COL2                COL2_1
             1 John, Marry, Joseph John 
             1 John, Marry, Joseph Marry
             2 Silk, David         Silk 
             3 Jocky, Prem         Jocky As you can see the first row from table2 is returned twice because it matches 2 records on table1.
    In case you want to display only rows from table2 which has a match in table1 you can either do a distinct:
    SELECT DISTINCT t2.col1, t2.col2
      FROM table2 t2
           JOIN table1 t1
              ON(INSTR(', '||t2.col2||',', ', '||t1.col2||',')>0);
          COL1 COL2              
             1 John, Marry, Joseph
             2 Silk, David       
             3 Jocky, Prem        or use EXISTS operator:
    SELECT t2.col1, t2.col2
      FROM table2 t2
    WHERE EXISTS (SELECT 1
                     FROM table1 t1
                    WHERE INSTR(', '||t2.col2||',', ', '||t1.col2||',')>0
          COL1 COL2              
             1 John, Marry, Joseph
             2 Silk, David       
             3 Jocky, Prem   Regards.
    Al

  • Sql query substring

    Hi,
    In my table i am having employee name like this
    EX:
    BOSE, Mr. BIRAT
    NANDY, Mr. AMITABHA
    The name before comma is the last name and after that is first Name
    Now i want to show in the front end like this for the above two
    Mr. BIRAT BOSE
    Mr. AMITABHA NANDY
    How to write an Sql query where you can get the Name before comma and place at the end of the name and remove the comma from it also for display purpose.
    Thanks,

    Non RegExp Solution
    SQL> with t
      2  as
      3  (
      4  select 'BOSE, Mr. BIRAT' name from dual union all
      5  select 'NANDY, Mr. AMITABHA' from dual
      6  )
      7  select name,
      8         substr(name, instr(name, ',', 1,1)+1) || ' ' || substr(name, 1, instr(name, ',',1,1)-1) new_name
      9    from t
    10  /
    NAME                NEW_NAME
    BOSE, Mr. BIRAT      Mr. BIRAT BOSE
    NANDY, Mr. AMITABHA  Mr. AMITABHA NANDY
    SQL>

  • How Can I Change the  Where Condition In the First SQL Query?

    SELECT IND_SSN, BEG_SVC_DT, END_SVC_DT,
    TRUNC(MONTHS_BETWEEN((TO_DATE('19'||END_SVC_DT,'YYYYMMDD')),BEG_SVC_DT)/12),
    mod(trunc(months_between((to_date('19'||end_svc_dt,'YYYYMMDD')),BEG_SVC_DT)),12),
    DECODE((SUBSTR(END_SVC_DT,5,2) - SUBSTR(BEG_SVC_DT,1,2)+1),-1,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -2,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -3,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -4,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -5,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -6,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -7,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -8,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -9,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -10,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -11,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -12,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -13,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -14,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -15,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -16,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -17,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -18,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -19,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -20,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -21,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -22,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -23,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -24,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -25,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -26,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -27,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -28,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -29,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -30,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    -31,((SUBSTR(END_SVC_DT,5,2)+ 31) - SUBSTR(BEG_SVC_DT,1,2)),
    30,0,
    (SUBSTR(END_SVC_DT,5,2) - SUBSTR(BEG_SVC_DT,1,2)+1))
    FROM SVC_OCCURRENCES
    WHERE end_svc_dt not in ('PRESENT')
    AND SUBSTR(END_SVC_DT,1,1) IN '9'
    AND SUBSTR(END_SVC_DT,5,2) NOT IN ('31')
    and (SUBSTR(END_SVC_DT,5,2) - SUBSTR(BEG_SVC_DT,1,2)+1) not in ('30')
    UNION
    SELECT IND_SSN, BEG_SVC_DT, END_SVC_DT, NULL, NULL, NULL
    FROM SVC_OCCURRENCES
    WHERE SUBSTR(END_SVC_DT,1,1) IN 'P'
    The above code works fine and I get the correct numeric values from the SQL
    query when the varchar2 end_svc_dt field is numeric however if I have encoded
    the word 'PRESENT' in the varchar2 end_svc dt field the SQL query aborts at
    the last statement in the WHERE condition. The beg_svc_dt field is a Date field.
    and (SUBSTR(END_SVC_DT,5,2) - SUBSTR(BEG_SVC_DT,1,2)+1) not in ('30')
    I get the following error message
    ERROR ORA-0722 INVALID NUMBER
    I encode the word 'PRESENT' in a varchar2 end_svc_dt field on an Oracle form. This is the only word that can be encoded.
    Is there some way that I can bypass the last statement in the where condition and
    compute the values from the SQL query without having the SQL query abort?
    Eventually I want to do this in a report. I know that this sounds strange but can it be done?

    The above code works fine and I get the correct
    numeric values from the SQL
    query when the varchar2 end_svc_dt field is numeric
    however if I have encoded
    the word 'PRESENT' in the varchar2 end_svc dt field
    the SQL query aborts at
    the last statement in the WHERE condition.Ouch!
    Storting dates in VARCHAR2 columns is bad practice, poor design and makes for horrible code.
    The beg_svc_dt field is a Date field.
    and (SUBSTR(END_SVC_DT,5,2) -
    SUBSTR(BEG_SVC_DT,1,2)+1) not in ('30')If it's a date field then why on earth are you trying to SUBSTR it. SUBSTR = sub-string i.e. take a sub section of a string not sub-date.
    I get the following error message
    ERROR ORA-0722 INVALID NUMBERAnd you're surprised by this?
    Is there some way that I can bypass the last
    statement in the where condition and
    compute the values from the SQL query without having
    the SQL query abort?Store your dates properly, use additional flag columns for non-date information and code your SQL properly.
    Eventually I want to do this in a report. I know
    that this sounds strange but can it be done?Yes, most things are possible.

Maybe you are looking for

  • Cant connect my 9pin to 4pin firewire to final cut express HD

    for some reason my firewire wont connect it the firewire on final cut expressHD is a 9pin to 4pin my computer only has one fire wire port and it is 9pin.

  • Predictive Analysis - Alogorithm determination

    Dear Experts, We are working on a Scenario, and try to build a Predictive Analysis reports on the same, as we are new to HANA , please help us  on the same. Scenario 1) Machine are sending the consumption of liquid to HANA continuously, following are

  • Attachment icon visible in Mail 5.1 but attachment is not visible

    Running a couple of iMac's with OSX Lion and Mail 5.1. Quite often we have problems receiving mails with attachments. Lately in the list of received emails you do see the attachment icon (paper clip) yet in the message itself there is no attachment v

  • Download software site not working for Financial Data Quality

    Hi Financial data quality management site download site not working. it's showing error message below error message. Error message: "We're sorry,the page you requested was not found.We have recorded this error (404) to help us fix the problem" Site:

  • My retina macbook pro's audio has a very low voice.

    I just have my retina macbook pro yesterday. I played a movie with Mplayer and some video on Youtube, but the output audio was very low. I compared with my macbook air(2011), with the same video and movie, use the same audio level, it is obviously th