EXTRACT VALUES WITHOUT DUPLICATES

How can I extract data without duplicates??
I can't use DISTINCT....
Thank you

Hi,
DISTINCT and UNIQUE keywords performs same in SQL and no difference in usage. Just write,
SELECT UNIQUE <column_name>
FROM <table_name>
WHERE ...
Regards,
Dilek

Similar Messages

  • How to display all distinct values without duplicates.

    Hi Pros,
          I want to present a values list in dashboard, but this list have much duplicates, so when dispalying, I want to display all distinct values without duplicates.

    Hi,
    You can avoid the duplicates from the source side or use a filtered row option in the component.
    Arun

  • [Forum FAQ] SharePoint 2013: Extracting values from a multi-value enabled lookup column and merge values to a multi-value enabled column

    For some business requirements, users want to extract values from a multi-value enabled lookup column
    and add items to another list based on each separate value. In contrast, others want to find duplicate values in the list and merge associated values to a multi-value enabled column and then
    add items to another list based on the merged value. All of these can be achieved using SharePoint Designer 2013 Workflow.
    How to extract values from a multi-value enabled lookup column and add items to another list based
    on each separate value using SharePoint Designer 2013.
    Important actions: Loop Shape; Utility Actions
    Three scenarios
    Things to note
    Steps to create Workflow
    How to merge values to a multi-value enabled column and add item to another list based on the
    merged value using SharePoint Designer 2013.
    Important actions: Call HTTP Web Service; Build Dictionary
    Things to note
    Steps to create Workflow
    How to
    extract values from a multi-value enabled lookup column and
    add items to another list based on each separate value using SharePoint Designer 2013.
    For example, they have three lists as below. They want to
    extract values from the Destinations column
    in Lookup2 and add items to Lookup3 based on each country and set Title to current item: ID.
    Lookup1:
    Title (Single line of text)
    Lookup2:
    Title (Single line of text), Destinations (Lookup; Get information from: Lookup1 in Title column).\
    Lookup3:
    Title (Single line of text), Country (Single line of text).
    Important action
    1. Loop Shape: SharePoint Designer 2013 support two types of loops: loop n times and loop with condition.
    Loops must also conform to the following rules:
    Loops must be within a stage, and stages cannot be within a loop.
    Steps may be within a loop.
    Loops may have only one entry and one exit point.
    2. Utility Actions: It contains many actions, such as ‘Extract Substring from Index of String’ and ‘Find substring in String’.
    Three scenarios
    We need to loop through the string returned from the look up column and look for commas. There are three
    scenarios:
    1.  No comma but string is non-empty so there is only one country.
    2.  At least one comma so there is at least two or more countries to loop.
    3.  In the loop we have consumed all the commas so we have found the last country. 
    Things to note
    There are two things to note:
    1. "Find string in string (output to Variable:index)"  will return -1 if doesn't find
    the searched for string.
    2. In the opening statement "Set Variable: Countries to Current Item:Destinations" set the return
    field as  "Lookup Values, Comma Delimited".
    Steps to create Workflow
    Create a custom list named Lookup1.
    Create a custom list named Lookup2, add column: Destinations (Lookup; Get information from: Lookup1 in Title column).
    Create a custom list named Lookup3, add column: Country (Single line of text).
    Create a workflow associated to Lookup2.
    Add conditions and actions:
    Start the workflow automatically when an item is created.
    Add item to Lookup2, then workflow will be started automatically and create multiple items to lookup3.
    See the below in workflow History List:
    How to merge values to a multi-value enabled column and add item to another list based on the
    merged value using SharePoint Designer 2013
    For example, they have three lists as below. They want to find duplicate values in the Title column in
    Lookup3 and merge country column to a multi-value enabled column and then add item to lookup2 and set the Title to Current Item: Title.
    Lookup1:
    Title (Single line of text)
    Lookup3:
    Title (Single line of text), Country (Single line of text).
    Lookup2:
    Title (Single line of text), Test (Single line of text).
    Important actions
    "Call HTTP Web Service"
    action: In SharePoint 2013 workflows, we can call a web service using a new action introduced in SharePoint 2013 named Call HTTP Web Service. This action
    is flexible and allows you to make simple calls to a web service easily, or, if needed, you can create more complex calls using HTTP verbs as well as allowing you to add HTTP headers.
    “Build Dictionary"
    action:
    The Dictionary variable type is a new variable type in the SharePoint 2013 Workflow.
    The following are the three actions specifically designed for the Dictionary variable type: Build Dictionary, Count Items in a Dictionary and Get an Item from a Dictionary.
    The "Call HTTP Web Service" workflow action would be useless without the new "Dictionary" workflow action.
    Things to note
    The
    HTTP URI is set to https://sitename/_api/web/lists/GetByTitle('listname')/items?$orderby=Id%20desc and the HTTP method is set to “GET”. Then the list will be sort by Id in descending order.
    Use Get
    d/results(0)/Id form
    Variable: ResponseContent (Output to
    Variable: maxid) to get the Max ID.
    Use Set
    Variable: minid to Current List:ID to get the Min ID.
    Use Copy from
    Variable: destianation , starting at
    1 (Output to
    Variable: destianation) to remove the space.
    Steps to create Workflow
    Create a custom list named Lookup1.
    Create a custom list named Lookup2, add column: Test (Single line of text).
    Create a custom list named Lookup3, add column: Country (Single line of text).
    Create a workflow associated to Lookup3.
    Add a new "Build Dictionary" action
    to define the http request header:
    Add a Call HTTP Web Serviceaction, click on
    this and paste your http request.
    To associate the
    RequestHeader variable, select the Call action property,
    set the
    RequestHeaders property to
    RequestHeader:
    In the Call action, click on
    response and associate the response to a new
    variable: ResponseContent (of type Dictionary).
    After the Call action add Get item from Dictionary action to get the Max ID.
    Add Set Workflow Variable action to get the Min ID.
    Add Loop Shape (Loop with Condition) to get all the duplicate titles and integrate them to a string.
    Create item in Lookup2.
    The final Stage should look like this:
    Start the workflow automatically when an item is created.
    Add item to Lookup3, then workflow will be started automatically and create item to lookup2.
    See the below in workflow History List:
    References
    SharePoint Designer 2013 - Extracting values from a multi-value enabled lookup column into a dictionary as separate items:
    http://social.technet.microsoft.com/Forums/en-US/97d34468-1b53-4741-88b0-958472f8ca9a/sharepoint-designer-2013-extracting-values-from-a-multivalue-enabled-lookup-column-into-a
    Workflow actions quick reference (SharePoint 2013 Workflow platform):
    http://msdn.microsoft.com/en-us/library/jj164026.aspx
    Understanding Dictionary actions in SharePoint Designer 2013:
    http://msdn.microsoft.com/en-us/library/office/jj554504.aspx
    Working with Web Services in SharePoint 2013 Workflows using SharePoint Designer 2013:
    http://msdn.microsoft.com/en-us/library/office/dn567558.aspx
    Calling the SharePoint 2013 Rest API from a SharePoint Designer Workflow:
    http://sergeluca.wordpress.com/2013/04/09/calling-the-sharepoint-2013-rest-api-from-a-sharepoint-designer-workflow/

    GREAT info, but it may be helpful to note that when replacing a portion of the variable "Countries" with a whitespace character, you may cause the workflow to fail in a few specific cases (certain lookup fields will not accept this and will automatically
    cancel).  I only found this out when recreating your workflow on a similar, but much more complex list set.  
    To resolve this issue, I used another utility action (Extract Substring from Index of List) to clear out the whitespace.  I configured it as "Copy from
    Variable: Countries, starting at
    1 (Output to Variable: Countries), which takes care of this issue in those few cases.
    Otherwise, WOW!  AWESOME JOB!  Thanks!  :)

  • How to get the day as numeric value without formatting the date?

    Hello,
    to reduce the costs of a sql-statement I need to get the day of a date-value as number (to compare it to a numeric value) without any formatting. Every formatting results in a full table scan of the table with the date field. Is there any function to solve this problem?
    Oracle version is 11g.
    Thanks Carsten

    CarstenDD wrote:
    select T1.SYSID from T2,T1
    where T2.SysT1 = T1.SYSID
    and T2.Date1 < '01.03.2011' --German date format
    and to_number(to_char(T2.Date2,'DD')) = 1
    and T2.Inactive = 0
    The explain plan shows a full table scan on T2. With EXTRACT(DAY FROM T2.Date2) there is no difference.It probably would and should in any case.
    Look at your predicates, which of them would reduce the resultset to a fair size compared to the total number of records in the table?.
    - You may have a huge number of records when you say date less than
    - Of these perhaps one seventh have day = 1
    - My guess is that most have Inactive = 0
    Besides, you should not rely on implictit char to date conversion, always use TO_DATE
    How many records are in the table? - How many will that query return?
    Regards
    Peter

  • Receiver Determination, condition to select receiver doesn't extract values

    Dear all!
    I have SAP PI 7.1
    I am facing problem in Receiver Determination while using Condition to select receiver based on the values in the payload.
    I need, if Identificador = 1 then receiver BC_1 and if Identificador = 2 then the receiver BC_2
    My payload has the value:
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:p1="http://pruebas.endesa.es/AME4S_2">
      <soap:Body>
        <p1:MT_WS_SENDER_Q>
          <IDENTIFICADOR>1</IDENTIFICADOR>
          <OBJECT_ID>7600000009</OBJECT_ID>
        </p1:MT_WS_SENDER_Q>
      </soap:Body>
    </soap:Envelope>
    But, the trace shows following:
    <Trace level="2" type="T">......extracting (new) for Extractor: XP /p1:MT_WS_SENDER_Q/IDENTIFICADOR </Trace>
    <Trace level="2" type="T">......extracting values found: 0 </Trace>
    I tried with double quotes, simple quotes, without quotes...
    I tried too with a Receiver Rule (with context) and local rule with xpath....
    Can someone please advise?
    Thanks in advanced!!

    Hello,
    /p1:MT_WS_SENDER_Q/IDENTIFICADOR = 1
    Can you try //p1:MT_WS_SENDER_Q/IDENTIFICADOR = 1 ? I'm sure I read it somewhere here in SDN regarding the xPath difference for stateless and stateless XI 3.0 compatible version is an additional /. It's worth to try
    Hope this helps,
    Mark

  • How to link the same horizontal page for two different vertical pages without duplicate them?

    Hey guys,
    Is there a way to link the same horizontal page on two different vertical pages without duplicate the horizontal page?
    I have a doublepage of a book splitted in two parts in different vertical pages but i want link the fullsized image in the horizontal page for both of them. Got that? hahaha
    Thank you all

    Confusing But interesing.
    I think it's possible. I have a idea. It will need one advanced trick.
    To explain it, I need test simply haha.

  • Extracting Values of a Field from a Database Table in SAP ECC System

    Hi,
    I downloaded Extracting Values of a Field from a Database Table in SAP ECC System Using MII 12.0
    senario from sdn. I'm trying to do that senario in MII 12.05. But I have problem with section 6 in page 7 (you can supply senario from sdn)
    "6- Under the loop of Repeater, use action u2018Rowu2019 to append just the string part of the WA which will display only values for field u2018Batchu2019"
    I did not find WA elemen in Output element of Repeater_0
    How can I create WA element?
    Thanks.

    Cemil,
    Set up a SAP JCo Interface action block.  Use the RFC name RFC_READ_TABLE.
    In the link editor map the table to "MARA", set RowCount to something small (20 is good sample size) and create an xml transaction property named FIELDS and copy the following into it:
    <?xml version="1.0" encoding="UTF-8"?><FIELDS>
          <item>
            <FIELDNAME>MATNR</FIELDNAME>
            <OFFSET/>
            <LENGTH/>
            <TYPE/>
            <FIELDTEXT/>
          </item>
          <item>
            <FIELDNAME>MTART</FIELDNAME>
            <OFFSET/>
            <LENGTH/>
            <TYPE/>
            <FIELDTEXT/>
          </item>
          <item>
            <FIELDNAME>BSTME</FIELDNAME>
            <OFFSET/>
            <LENGTH/>
            <TYPE/>
            <FIELDTEXT/>
          </item>
          <item>
            <FIELDNAME>XCHPF</FIELDNAME>
            <OFFSET/>
            <LENGTH/>
            <TYPE/>
            <FIELDTEXT/>
          </item>
          <item>
            <FIELDNAME>DATAB</FIELDNAME>
            <OFFSET/>
            <LENGTH/>
            <TYPE/>
            <FIELDTEXT/>
          </item>
        </FIELDS>
    Then link the Transaction.FIELDS to SAP_JCo_Interface_0.Request{/RFC_READ_TABLE/TABLES/FIELDS}.  You may run into problems with two other fields and optionally they can be removed (set link type to remove xml).  I usually remove them initially for testing.  The two fields are:
    SAP_JCo_Interface_0.Request{/RFC_READ_TABLE/INPUT/NO_DATA}
    SAP_JCo_Interface_0.Request{/RFC_READ_TABLE/INPUT/DELIMITER} (or you can set this to something like a semicolon,";" or tilda,"~".  I find it easier to caclulate position by length, but that is my own idiosyncrasy.)
    Once you get this one working, we can explore how to do filtering on the dataset.  Your output should be something like this:
    <?xml version="1.0" encoding="utf-8"?>
    <RFC_READ_TABLE>
      <INPUT>
        <DELIMITER />
        <NO_DATA />
        <QUERY_TABLE>MARA</QUERY_TABLE>
        <ROWCOUNT>20</ROWCOUNT>
        <ROWSKIPS>0</ROWSKIPS>
      </INPUT>
      <TABLES>
        <DATA>
          <item>
            <WA>000000000000000023ROH 00000000</WA>
          </item>
          <item>
            <WA>000000000000000038HALB 00000000</WA>
          </item>
          <item>
            <WA>000000000000000043HAWA 00000000</WA>
          </item>
          <item>
            <WA>000000000000000058HIBE 00000000</WA>
          </item>
          <item>
            <WA>000000000000000059HIBE 00000000</WA>
          </item>
          <item>
            <WA>000000000000000068FHMI 00000000</WA>
          </item>
          <item>
            <WA>000000000000000078DIEN 00000000</WA>
          </item>
          <item>
            <WA>000000000000000088FERT 00000000</WA>
          </item>
          <item>
            <WA>000000000000000089FERT 00000000</WA>
          </item>
          <item>
            <WA>000000000000000098HALB 00000000</WA>
          </item>
          <item>
            <WA>000000000000000170NLAG 00000000</WA>
          </item>
          <item>
            <WA>000000000000000178NLAG 00000000</WA>
          </item>
          <item>
            <WA>000000000000000188NLAG 00000000</WA>
          </item>
          <item>
            <WA>000000000000000288HALB 00000000</WA>
          </item>
          <item>
            <WA>000000000000000358HAWA 00000000</WA>
          </item>
          <item>
            <WA>000000000000000359HAWA 00000000</WA>
          </item>
          <item>
            <WA>000000000000000521HAWA 00000000</WA>
          </item>
          <item>
            <WA>000000000000000578FERT 00000000</WA>
          </item>
          <item>
            <WA>000000000000000597HAWA 00000000</WA>
          </item>
          <item>
            <WA>000000000000000598VERP 00000000</WA>
          </item>
        </DATA>
        <FIELDS>
          <item>
            <FIELDNAME>MATNR</FIELDNAME>
            <OFFSET>000000</OFFSET>
            <LENGTH>000018</LENGTH>
            <TYPE>C</TYPE>
            <FIELDTEXT>Material Number</FIELDTEXT>
          </item>
          <item>
            <FIELDNAME>MTART</FIELDNAME>
            <OFFSET>000018</OFFSET>
            <LENGTH>000004</LENGTH>
            <TYPE>C</TYPE>
            <FIELDTEXT>Material Type</FIELDTEXT>
          </item>
          <item>
            <FIELDNAME>BSTME</FIELDNAME>
            <OFFSET>000022</OFFSET>
            <LENGTH>000003</LENGTH>
            <TYPE>C</TYPE>
            <FIELDTEXT>Purchase Order Unit of Measure</FIELDTEXT>
          </item>
          <item>
            <FIELDNAME>XCHPF</FIELDNAME>
            <OFFSET>000025</OFFSET>
            <LENGTH>000001</LENGTH>
            <TYPE>C</TYPE>
            <FIELDTEXT>Batch management requirement indicator</FIELDTEXT>
          </item>
          <item>
            <FIELDNAME>DATAB</FIELDNAME>
            <OFFSET>000026</OFFSET>
            <LENGTH>000008</LENGTH>
            <TYPE>D</TYPE>
            <FIELDTEXT>Valid-From Date</FIELDTEXT>
          </item>
        </FIELDS>
        <OPTIONS />
      </TABLES>
    </RFC_READ_TABLE>
    Add a repeater sourced on:
    SAP_JCo_Interface_0.Response{/RFC_READ_TABLE/TABLES/DATA/item}
    Link your repeater output to a tracer with this:
    Repeater_0.Output{/item/WA}
    What you will see in each tracer message is a single line of data with all the fields contents concatenated together.  You can look up what each field in the string represents by the length of the field as returned in the Response segment of the RFC_READ_TABLE rfc.  Then you can parse out the data you are interested in.
    Give this a try and let me know how you succeeded.
    By the way, I could not find the scenario you referred to.  Can you post a link?
    Regards,
    Mike
    Edited by: Michael Appleby on Jan 12, 2009 5:16 PM

  • How to print extract value in dbms_output.put_line

    CREATE OR REPLACE PROCEDURE pr_srch_data
    AS
    xml_data_val xmltype:=null;
    vPropertyName clob;
    vstr varchar2(1000);
    operation varchar2(1000);
    vQuery VARCHAR2(4000):=NULL;
    vQry VARCHAR2(4000):=NULL;
    vPartyid VARCHAR2(2000):=NULL;
    vPerson varchar2(4000);
    BEGIN
    FOR I IN (SELECT EAPP_XML_DATA
    FROM binary_xml
    WHERE extractvalue(eapp_xml_data,'/OLifE/Party[@id="Party1"]/Person/LastName') Like 'Rajesh%'
    LOOP
    BEGIN
         SELECT extractvalue(value(t),'/Relation/@RelatedObjectID')
         INTO vPartyid
         FROM TABLE (XMLSEQUENCE (EXTRACT (xml_data_val,'/OLifE/Relation'))) t
         WHERE extractvalue(value(t),'/Relation/RelationRoleCode')='Owner'
    AND existsnode(value(t),'/Relation/@RelatedObjectID')=1 ;
    END;
    SELECT extract(value(t),'/OLifE/Party[@id='''||vPartyid ||''']/Person')
    INTO vPerson
    FROM TABLE (XMLSEQUENCE (EXTRACT (I.EAPP_XML_DATA,'/OLifE')))t;
    dbms_output.put_line('vPerson'||'--'||vPerson);
    END LOOP;
    END;
    But when i am printing vPerson i am getting error. I need to print that extract value.

    Things to remember (that you should know by now)
    Please remind us of which version of 11g you are using in this post and all future posts.
    Look at the FAQ under your sign-in name to see how to use the tag to retain formatting of your code as you have seen our examples to you look like.
    We can't see your screen or your data so how about the error message and some data from your table?
    Please start using either XMLTable or XMLCast/XMLQuery as odie_63 as shown you.
    What are you trying to do?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Using XSLT to extract value of a XML node with namespace

    I have a XML source code here.
    <?xml version="1.0" encoding="utf-8" ?>
    <rss version="2.0" xmlns:job="http://www.pageuppeople.com">
      <channel>
        <title>SMH Jobs</title>
        <link>internalrecruitment.smhgroup.com.au/jobsrss.ashx?stp=di</link>
        <description>A listing of jobs available here</description>
        <item>
          <title>eCommerce Optimisation Advisor</title>
          <description>A new and exciting opportunity exists for an experienced eCommerce Advisor to join</description>
          <job:location PUReferenceID="3711">Sydney - Inner Suburbs & CBD</job:location>
        </item>
      </channel>
    </rss>
    I want to use XSLT to extract value of a XML node with namespace <job:location>, and the returned value should be string 'Sydney - Inner Suburbs & CBD'. I tried a few XSL code below, but failed with error or nothing was returned.
    <xsl:value-of select="job:location" disable-output-escaping="yes"/>
    <xsl:value-of select="job/location" disable-output-escaping="yes"/>
    <xsl:value-of select="job\location" disable-output-escaping="yes"/>
    <xsl:value-of select="location" disable-output-escaping="yes"/>
    This might be an easy question for you, but I would appreciate if anyone can help.

    Hi Suncorp IT Learner,
    We need to tell the XSLT that some elements are in another namespace. Copy the xmls declarations for the prefixes you need to use. Then use the xsl format as:
    <xsl: value-of select=”job:location/@PUReferenceID”/>
    In following issue, Chriztian has a good explanation:
    http://our.umbraco.org/forum/developers/xslt/33353-XSLT-reading-XML-attribute-value
    Thanks,
    Qiao Wei
    TechNet Community Support

  • How to add 5.1 track without duplicate timelines?

    To add  a 5.1 track to my project I duplicate the movie timeline and change the stereo track for the 5.1. The problem is the program duplicate the capacity (3,50gb are now 7gb). I don't know if I can add the 5.1 as a second track in the same timeline to avoid the increasing in gb.
    is possible to add the 5.1 in a second track of the movie timeline? and how can I link a button in the menu to link to the movie with this second 5.1 track?
    If this isn't possible, how can I do a 5.1 option without duplicate the weight?
    sorry my poor English!
    Thanks

    Jeff, if I have one timeline with two audio tracks (stereo and 5.1) and the video track. If I have two buttons, stereo and 5.1, how I link the button to the video track with it correct audio track avoiding the other? I need to link the button direct to the audio track and this link also include the video track?
    Thanks for your help

  • Random numbers without duplicates

    Hello,
    I'm having trouble locating an explained example for selecting a set of random numbers without duplicates. Specifically, I'm working on this example from Ivor Horton's Beginning Java, chapter 3.
    3. A lottery program requires that you select six different numbers from the integers 1-49. Write a program to do this for you and generate five sets of entries.
    This is not homework, I'm just trying to teach myself Java to eventually work my way up to servlets and JSPs.
    This is what I have so far. I tried to use array sorting but it didn't work (the first three numbers in my entries was always 0), so I commented out that part. I've included sample output after the code. I don't necessarily need the exact code although that would be nice; I just need at least an explanation of how to go about making sure that if a number has been picked for an entry, not to pick it again.
    Thanks for any help,
    javahombre
    package model;
    import java.util.Random;
    import java.lang.Math.*;
    import java.util.Arrays;
    public class Lottery {
    public static void main(String[] args) {
    // Lottery example.
    // We need the following data:
    // - An integer to store the lottery number range (in this case 59).
    // - A mechanism to choose a number randomly from the range.
    // - An array to store the entries (6 different numbers per entry).
    // - A loop to generate 5 sets of entries.
    int numberRange = 59;
    int currentPick = 0;
    int[] entry = new int[6]; // For storing entries.
    //int slot = -1; // For searching entry array.
    Random rn = new Random();
    for (int n = 0; n < 5; n++)
    // Generate entry.
    for (int i = 0; i < 6; i++)
    currentPick = 1 + Math.abs(rn.nextInt()) % numberRange;
    //Arrays.sort(entry);
    //slot = Arrays.binarySearch(entry, currentPick);
    //System.out.println("i: " + i + "\t| slot: " + slot + "\t| pick: " + currentPick + "\t| compare: " + (slot < 0));
    // Add the current pick if it is not already in the entry.
    //if (slot < 0)
    entry[i] = currentPick;
    System.out.println("pick entered: " + currentPick);
    // Output entry.
    System.out.print("Entry " + (n + 1) + ": ");
    for (int j = 0; j < 6; j++)
    System.out.print(entry[j] + "\t");
    System.out.println("");
    // Set the array contents back to 0 for next entry.
    Arrays.fill(entry,0);
    Sample output (notice duplicates, as in Entry 3):
    pick entered: 11
    pick entered: 29
    pick entered: 33
    pick entered: 8
    pick entered: 14
    pick entered: 54
    Entry 1: 11     29     33     8     14     54     
    pick entered: 51
    pick entered: 46
    pick entered: 25
    pick entered: 30
    pick entered: 44
    pick entered: 22
    Entry 2: 51     46     25     30     44     22     
    pick entered: 49
    pick entered: 39
    pick entered: 9
    pick entered: 6
    pick entered: 46
    pick entered: 46
    Entry 3: 49     39     9     6     46     46     
    pick entered: 23
    pick entered: 26
    pick entered: 2
    pick entered: 21
    pick entered: 51
    pick entered: 32
    Entry 4: 23     26     2     21     51     32     
    pick entered: 27
    pick entered: 48
    pick entered: 19
    pick entered: 10
    pick entered: 8
    pick entered: 18
    Entry 5: 27     48     19     10     8     18     

    NOTE: the array reference to [ i ] seems to be misinterpreted as italics by the posting form. I've reposted the message here, hopefully it will show the code properly.
    Thanks again,
    javahombre
    Hello,
    I'm having trouble locating an explained example for
    selecting a set of random numbers without duplicates.
    Specifically, I'm working on this example from Ivor
    Horton's Beginning Java, chapter 3.
    3. A lottery program requires that you select six
    different numbers from the integers 1-49. Write a
    program to do this for you and generate five sets of
    entries.
    This is not homework, I'm just trying to teach myself
    Java to eventually work my way up to servlets and
    JSPs.
    This is what I have so far. I tried to use array
    sorting but it didn't work (the first three numbers in
    my entries was always 0), so I commented out that
    part. I've included sample output after the code. I
    don't necessarily need the exact code although that
    would be nice; I just need at least an explanation of
    how to go about making sure that if a number has been
    picked for an entry, not to pick it again.
    Thanks for any help,
    javahombre
    package model;
    import java.util.Random;
    import java.lang.Math.*;
    import java.util.Arrays;
    public class Lottery {
    public static void main(String[] args) {
    // Lottery example.
    // We need the following data:
    // - An integer to store the lottery number range (in
    this case 59).
    // - A mechanism to choose a number randomly from the
    range.
    // - An array to store the entries (6 different
    numbers per entry).
    // - A loop to generate 5 sets of entries.
    int numberRange = 59;
    int currentPick = 0;
    int[] entry = new int[6]; // For storing entries.
    //int slot = -1; // For searching entry
    array.
    Random rn = new Random();
    for (int n = 0; n < 5; n++)
    // Generate entry.
    for (int i = 0; i < 6; i++)
    currentPick = 1 + Math.abs(rn.nextInt()) %
    numberRange;
    //Arrays.sort(entry);
    //slot = Arrays.binarySearch(entry, currentPick);
    //System.out.println("i: " + i + "\t| slot: " + slot +
    "\t| pick: " + currentPick + "\t| compare: " + (slot <
    0));
    // Add the current pick if it is not already in the
    entry.
    //if (slot < 0)
    entry[ i ] = currentPick;
    System.out.println("pick entered: " + currentPick);
    // Output entry.
    System.out.print("Entry " + (n + 1) + ": ");
    for (int j = 0; j < 6; j++)
    System.out.print(entry[j] + "\t");
    System.out.println("");
    // Set the array contents back to 0 for next entry.
    Arrays.fill(entry,0);
    Sample output (notice duplicates, as in Entry 3):
    pick entered: 11
    pick entered: 29
    pick entered: 33
    pick entered: 8
    pick entered: 14
    pick entered: 54
    Entry 1: 11     29     33     8     14     54
    pick entered: 51
    pick entered: 46
    pick entered: 25
    pick entered: 30
    pick entered: 44
    pick entered: 22
    Entry 2: 51     46     25     30     44     22
    pick entered: 49
    pick entered: 39
    pick entered: 9
    pick entered: 6
    pick entered: 46
    pick entered: 46
    Entry 3: 49     39     9     6     46     46
    pick entered: 23
    pick entered: 26
    pick entered: 2
    pick entered: 21
    pick entered: 51
    pick entered: 32
    Entry 4: 23     26     2     21     51     32
    pick entered: 27
    pick entered: 48
    pick entered: 19
    pick entered: 10
    pick entered: 8
    pick entered: 18
    Entry 5: 27     48     19     10     8     18

  • And operation in extract value

    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE 11.1.0.6.0 Production
    TNS for Solaris: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    This is my input xml
    - <OLifE>
    - <SourceInfo>
    <SourceInfoName>Client Profile</SourceInfoName>
    </SourceInfo>
    - <Activity id="Act1" PartyID="Party1">
    <ActivityStatus tc="2">In Progress</ActivityStatus>
    <UserCode>123456</UserCode>
    <Opened>2010-08-17</Opened>
    <ActivityCode>CP10001</ActivityCode>
    - <Attachment>
    <Description>LastScreenName</Description>
    <AttachmentData>CP Create</AttachmentData>
    <AttachmentType tc="2">OLI_ATTACH_COMMENT</AttachmentType>
    <AttachmentLocation tc="1">OLI_INLINE</AttachmentLocation>
    </Attachment>
    - <OLifEExtension VendorCode="05" ExtensionCode="Activity">
    - <ActivityExtension>
    <SubActivityCode>CP20001</SubActivityCode>
    </ActivityExtension>
    </OLifEExtension>
    </Activity>
    - <Relation OriginatingObjectID="Holding1" id="Relation4" RelatedObjectID="Party1">
    <OriginatingObjectType tc="4">Holding</OriginatingObjectType>
    <RelatedObjectType tc="6">Party</RelatedObjectType>
    <RelationRoleCode tc="8">Owner</RelationRoleCode>
    </Relation>
    Here xml_data_val is the input xml.
    BEGIN
    SELECT extractvalue(value(t),'OLifE/Activity[@PartyID=/OLifE/Relation[RelationRoleCode/@tc=8]/@RelatedObjectID]/ActivityStatus/@tc'),
    extractvalue(value(t),'/OLifE/Activity[@PartyID=/OLifE/Relation[RelationRoleCode/@tc=8]/@RelatedObjectID]/Opened'),
    extractvalue(value(t),'/OLifE/Activity[@PartyID=/OLifE/Relation[RelationRoleCode/@tc=8]/@RelatedObjectID AND /OLifE/Activity/ActivityCode=CP10001]/UserCode'),
    extract(value(t),'/OLifE'),
    extractvalue(value(t),'/OLifE/Relation[RelationRoleCode/@tc=8]/@RelatedObjectID')
    INTO nActstat,
    vDate,
    vUsercreated,
    xml_data_val,
    vPartyid
    FROM TABLE
    XMLSEQUENCE
    EXTRACT (xml_data_val,'/TXLife/TXLifeRequest/OLifE')
    )t;
    dDate:=TO_DATE(vDate,'YYYY-MM-DD');
    Exception
    WHEN OTHERS THEN
    ncode:=5;
         nErrcode:=2003;
    vStatus:='FAILURE';
         vStatusinfo:='Required Element Missing';
         Raise_application_error(-20201,'Required information not available');
    END;
    I am facing problem here is i am not able to retrive UserCode value.
    Edited by: user13444979 on Dec 13, 2010 8:09 AM

    Is this what you are looking for ?
    SQL> column ACTIVITY format A80
    SQL> --
    SQL> set lines 256 long 10000
    SQL> --
    SQL> VAR XMLTEXT CLOB
    SQL> --
    SQL> begin
      2    :XMLTEXT :=
      3  '<TXLife Version="2.15.00" xmlns="http://ACORD.org/Standards/Life/2">
      4     <UserAuthRequest>
      5             <UserLoginName>CPUser</UserLoginName>
      6     </UserAuthRequest>
      7     <TXLifeRequest>
      8             <TransRefGUID>10bc80e7d60e59b0:a134d0:10d7c4674ad:-7ffc</TransRefGUID>
      9             <TransType tc="301">OLI_TRANS_SRCPAR</TransType>
    10             <TransExeDate>2010-08-24</TransExeDate>
    11             <TransExeTime>12:01:01</TransExeTime>
    12             <InquiryLevel tc="3">OLI_INQUIRY_OBJRELOBJ</InquiryLevel>
    13             <InquiryView>
    14                     <InquiryViewCode>CS-301-002</InquiryViewCode>
    15             </InquiryView>
    16             <MaxRecords>20</MaxRecords>
    17             <CriteriaExpression>
    18                     <CriteriaOperator tc="2">AND</CriteriaOperator>
    19                     <Criteria>
    20                             <ObjectType tc="6">Party</ObjectType>
    21                             <PropertyName>LastName</PropertyName>
    22                             <PropertyValue>AXA</PropertyValue>
    23                             <Operation tc="1">OLI_OP_EQUAL</Operation>
    24                     </Criteria>
    25                     <Criteria>
    26                             <ObjectType tc="6">Party</ObjectType>
    27                             <PropertyName>GovtID</PropertyName>
    28                             <PropertyValue>123456789</PropertyValue>
    29                             <Operation tc="1">OLI_OP_EQUAL</Operation>
    30                     </Criteria>
    31                     <Criteria>
    32                             <ObjectType tc="6">Party</ObjectType>
    33                             <PropertyName>GovtIDTc</PropertyName>
    34                             <PropertyValue>1</PropertyValue>
    35                             <Operation tc="1">OLI_OP_EQUAL</Operation>
    36                     </Criteria>
    37                     <Criteria>
    38                             <ObjectType tc="6">Party</ObjectType>
    39                             <PropertyName>ResidenceState</PropertyName>
    40                             <PropertyValue>AL</PropertyValue>
    41                             <Operation tc="1">OLI_OP_EQUAL</Operation>
    42                     </Criteria>
    43                     <CriteriaExpression>
    44                             <CriteriaOperator tc="2">AND</CriteriaOperator>
    45                             <Criteria>
    46                                     <ObjectType tc="7">Activity</ObjectType>
    47                                     <PropertyName>ActivityTypeCode</PropertyName>
    48                                     <PropertyValue>CIH10028</PropertyValue>
    49                                     <Operation tc="1">OLI_OP_EQUAL</Operation>
    50                             </Criteria>
    51                             <Criteria>
    52                                     <ObjectType tc="7">Activity</ObjectType>
    53                                     <PropertyName>ActivityDescription</PropertyName>
    54                                     <PropertyValue>CIH50167</PropertyValue>
    55                                     <Operation tc="1">OLI_OP_EQUAL</Operation>
    56                             </Criteria>
    57                             <Criteria>
    58                                     <ObjectType tc="7">Activity</ObjectType>
    59                                     <PropertyName>UserCode</PropertyName>
    60                                     <PropertyValue>123456</PropertyValue>
    61                                     <Operation tc="1">OLI_OP_EQUAL</Operation>
    62                             </Criteria>
    63                     </CriteriaExpression>
    64                     <CriteriaExpression>
    65                             <CriteriaOperator tc="2">AND</CriteriaOperator>
    66                             <Criteria>
    67                                     <ObjectType tc="7">Activity</ObjectType>
    68                                     <PropertyName>ActivityTypeCode</PropertyName>
    69                                     <PropertyValue>CIH10028</PropertyValue>
    70                                     <Operation tc="1">OLI_OP_EQUAL</Operation>
    71                             </Criteria>
    72                             <Criteria>
    73                                     <ObjectType tc="7">Activity</ObjectType>
    74                                     <PropertyName>ActivityStatus</PropertyName>
    75                                     <PropertyValue>4</PropertyValue>
    76                                     <Operation tc="1">OLI_OP_EQUAL</Operation>
    77                             </Criteria>
    78                     </CriteriaExpression>
    79                     <CriteriaExpression>
    80                             <CriteriaOperator tc="2">AND</CriteriaOperator>
    81                             <Criteria>
    82                                     <ObjectType tc="7">Activity</ObjectType>
    83                                     <PropertyName>ActivityTypeCode</PropertyName>
    84                                     <PropertyValue>CIH10028</PropertyValue>
    85                                     <Operation tc="1">OLI_OP_EQUAL</Operation>
    86                             </Criteria>
    87                             <Criteria>
    88                                     <ObjectType tc="7">Activity</ObjectType>
    89                                     <PropertyName>Closed</PropertyName>
    90                                     <PropertyValue>2010-08-16</PropertyValue>
    91                                     <Operation tc="4">OLI_OP_GREATERTHAN</Operation>
    92                             </Criteria>
    93                             <Criteria>
    94                                     <ObjectType tc="7">Activity</ObjectType>
    95                                     <PropertyName>Closed</PropertyName>
    96                                     <PropertyValue>2010-08-24</PropertyValue>
    97                                     <Operation tc="3">OLI_OP_LESSTHAN</Operation>
    98                             </Criteria>
    99                     </CriteriaExpression>
    100             </CriteriaExpression>
    101             <OLifE>
    102                     <SourceInfo>
    103                             <SourceInfoName>Client Profile</SourceInfoName>
    104                     </SourceInfo>
    105                     <Activity id="Act1" PartyID="Party1">
    106                             <ActivityStatus tc="2">In Progress</ActivityStatus>
    107                             <UserCode>123456</UserCode>
    108                             <Opened>2010-08-17</Opened>
    109                             <ActivityCode>CP10001</ActivityCode>
    110                             <Attachment>
    111                                     <Description>LastScreenName</Description>
    112                                     <AttachmentData>CP Create</AttachmentData>
    113                                     <AttachmentType tc="2">OLI_ATTACH_COMMENT</AttachmentType>
    114                                     <AttachmentLocation tc="1">OLI_INLINE</AttachmentLocation>
    115                             </Attachment>
    116                             <OLifEExtension VendorCode="05" ExtensionCode="Activity">
    117                                     <ActivityExtension>
    118                                             <SubActivityCode>CP20001</SubActivityCode>
    119                                     </ActivityExtension>
    120                             </OLifEExtension>
    121                     </Activity>
    122                     <Relation OriginatingObjectID="Holding1" id="Relation4" RelatedObjectID="Party1">
    123                             <OriginatingObjectType tc="4">Holding</OriginatingObjectType>
    124                             <RelatedObjectType tc="6">Party</RelatedObjectType>
    125                             <RelationRoleCode tc="8">Owner</RelationRoleCode>
    126                     </Relation>
    127             </OLifE>
    128     </TXLifeRequest>
    129  </TXLife>';
    130  end;
    131  /
    PL/SQL procedure successfully completed.
    SQL> column XML FORMAT A128
    SQL> set heading on lines 256 pages 20 long 10000
    SQL> --
    SQL> with TXLIFE_TABLE
      2  as
      3  (
      4    select XMLTYPE(:XMLTEXT) as OBJECT_VALUE
      5      from DUAL
      6  )
      7  select NACTSTAT, VPARTYID, VDATE, VUSERCREATED,
      8         XMLSERIALIZE(DOCUMENT ACTIVITY AS CLOB INDENT SIZE=2) ACTIVITY
      9    from TXLIFE_TABLE,
    10         XMLTable
    11         (
    12           xmlNamespaces
    13           (
    14             default 'http://ACORD.org/Standards/Life/2'
    15           ),
    16           'for $OLifE in $TX/TXLife/TXLifeRequest/OLifE
    17             for $RELATION in $OLifE/Relation[RelationRoleCode/@tc=8], $ACTIVITY in $OLifE/Activity[@PartyID=$RELATION/@RelatedObjectID and ActivityCode="CP10001"]
    18               return
    19                 <Result>
    20                 {
    21                   <ACTSTAT>{fn:data($ACTIVITY/ActivityStatus/@tc)}</ACTSTAT>,
    22                   <PARTYID>{fn:data($RELATION/@RelatedObjectID)}</PARTYID>,
    23                   $ACTIVITY/Opened,
    24                   $ACTIVITY/UserCode,
    25                   $ACTIVITY
    26                 }
    27                 </Result>'
    28           passing OBJECT_VALUE as "TX"
    29           columns
    30           NACTSTAT        NUMBER(2) PATH 'ACTSTAT',
    31           VPARTYID     VARCHAR2(10) PATH 'PARTYID',
    32           VDATE                DATE PATH 'Opened',
    33           VUSERCREATED VARCHAR2(20) PATH 'UserCode',
    34           ACTIVITY          XMLTYPE PATH 'Activity'
    35         ) t
    36  /
      NACTSTAT VPARTYID   VDATE     VUSERCREATED         ACTIVITY
             2 Party1     17-AUG-10 123456               <Activity xmlns="http://ACORD.org/Standards/Life/2" id="Act1" PartyID="Party1">
                                                           <ActivityStatus tc="2">In Progress</ActivityStatus>
                                                           <UserCode>123456</UserCode>
                                                           <Opened>2010-08-17</Opened>
                                                           <ActivityCode>CP10001</ActivityCode>
                                                           <Attachment>
                                                             <Description>LastScreenName</Description>
                                                             <AttachmentData>CP Create</AttachmentData>
                                                             <AttachmentType tc="2">OLI_ATTACH_COMMENT</AttachmentType>
                                                             <AttachmentLocation tc="1">OLI_INLINE</AttachmentLocation>
                                                           </Attachment>
                                                           <OLifEExtension VendorCode="05" ExtensionCode="Activity">
                                                             <ActivityExtension>
                                                               <SubActivityCode>CP20001</SubActivityCode>
                                                             </ActivityExtension>
                                                           </OLifEExtension>
                                                         </Activity>
      NACTSTAT VPARTYID   VDATE     VUSERCREATED         ACTIVITY
    SQL>

  • How can I extract value based on the specific tag?

    Hello,
    I have a sample xml file:
    <?xml version="1.0" encoding="UTF-8"?>
    <listings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://local.google.com/local_feed.xsd">
    <language>en</language>
    <datum>WGS84</datum>
    <listing>
    <id>242238</id>
    <name>Baskin-Robbins</name>
    <date month="5" day="13" year="2010" />
    <content>
    <text type="menu">
    <link>http://www.allmenus.com/ca/san-fernando-valley/242238-baskin-robbins/menu/</link>
    <title>Baskin-Robbins</title>
    <author>Allmenus.com</author>
    <body>View this menu online at Allmenus.com</body>
    </text>
    <attributes>
    <link>http://www.allmenus.com/ca/san-fernando-valley/242238-baskin-robbins/menu/</link>
    <title>Baskin-Robbins</title>
    <attr name="Average Entree">$41.95</attr>
    <attr name="Cuisine">Ice Cream</attr>
    <attr name="Cuisine">American</attr>
    <attr name="Payment accepted">Cash</attr>
    <attr name="Feature">Cheap Eats</attr>
    <attr name="Feature">Kid Friendly</attr>
    <attr name="Feature">Fast Food</attr>
    <date month="5" day="13" year="2010" />
    </attributes>
    </content>
    </listing>
    <listing>
    <id>243810</id>
    <name>Villa Maria Pizzeria &amp; Restaurant</name>
    <date month="5" day="13" year="2010" />
    <content>
    <text type="menu">
    <link>http://www.allmenus.com/ny/nassau-county/243810-villa-maria-pizzeria--restaurant/menu/</link>
    <title>Villa Maria Pizzeria &amp; Restaurant</title>
    <author>Allmenus.com</author>
    <body>View this menu online at Allmenus.com</body>
    </text>
    <attributes>
    <link>http://www.allmenus.com/ny/nassau-county/243810-villa-maria-pizzeria--restaurant/menu/</link>
    <title>Villa Maria Pizzeria &amp; Restaurant</title>
    <attr name="Hours">Sun 12pm-9pm; Mon 11am-10pm; Tue 11am-10pm; Wed 11am-10pm; Thu 11am-10pm; Fri 11am-10pm; Sat 11am-10pm</attr>
    <attr name="Last Delivery">Sun 9pm; Mon 10pm; Tue 10pm; Wed 10pm; Thu 10pm; Fri 10pm; Sat 10pm</attr>
    <attr name="Order Online">http://orders.allmenus.com/restaurant.asp?restid=5999&amp;campusid=835</attr>
    <attr name="Average Entree">$7.95</attr>
    <attr name="Minimum for Delivery">$25.00</attr>
    <attr name="Cuisine">Pizza</attr>
    <attr name="Cuisine">Sandwiches</attr>
    <attr name="Cuisine">Calzones</attr>
    <attr name="Payment accepted">Cash</attr>
    <attr name="Payment accepted">Visa</attr>
    <attr name="Payment accepted">Mastercard</attr>
    <attr name="Payment accepted">Discover</attr>
    <attr name="Payment accepted">Amex</attr>
    <attr name="Nearby School">Hofstra University</attr>
    <attr name="Nearby School">SUNY-Farmingdale</attr>
    <attr name="Feature">Free Delivery</attr>
    <attr name="Feature">Open 7 Days</attr>
    <attr name="Online Order">Yes</attr>
    <date month="5" day="13" year="2010" />
    </attributes>
    </content>
    </listing>
    </listings>
    As you can see, some row has <attr name="Order Online"> and some don't. I want to extract value of this attribute. It can be null for rows that don't have this attribute. How can I do it with extractvalue function? THANKS A LOT!

    I figured it out that I should do the following:
    select extractvalue(value(x),'/listing/content/attributes/attr[@name="Order Online"]')
    from load_xml_file t, table(xmlsequence(extract(t.xml,'/listings/listing'))) x
    Thanks!

  • The maximum value of a maximum value without making two querys of the same

    Hi,
    In the table cmp_lineas_cotizacion i need to take only rows with the maximum lc.mto_precio_venta of the maximum l.fec_ini_vigencia_costo of l.cod_producto, but I have the problem that cmp_lineas_cotizacion is a very load table with take to much resources of the database, I can't modify or agregate indexes, so I need a way to make this query more efficient. I want to find a way to replace the last 6 lines of this query and make it faster.
    select b.segment1 || '.' || b.segment2 as ITEM,
            case when b.organization_id in (125,89,90,92,95,97,99,101,104,106,108,110,112,115,83,85,
                                                        87,88,91,93,94,96,98,100,102,103,107,109,111,113,114,116,
                                                        117,120,123,124,128,130,132,134,135,133,131,129,118,182)
                      then 1
                 when b.organization_id in (105, 126)
                      then 2
            end as ZONE_ID,
            replace(l.mto_precio_venta,',','.') as STANDARD_RETAIL,
           'VEF' as STANDARD_RETAIL_CURRENCY,
            case when b.primary_unit_of_measure like '%KG%' then 'KG'
                 when b.primary_unit_of_measure like '%Kg%' then 'KG'
                 when b.primary_unit_of_measure like '%UND%' then 'EA'
                 when b.primary_unit_of_measure = 'Kilogramo' then 'KG'
                 when b.primary_unit_of_measure = 'Litro' then 'L'
                 when b.primary_unit_of_measure = 'Unidad' then 'EA'
                 else null
            end as STANDARD_UOM,
            case when l.Mto_precio_venta_cm_emp is not null then replace(l.Mto_precio_venta_cm_emp,',','.')
                 else '0'
            end as SELLING_RETAIL,
            'VEF' as SELLING_RETAIL_CURRENCY,
             case   when b.PRIMARY_UNIT_OF_MEASURE like '%Barril%' then 'BA'
                    when b.PRIMARY_UNIT_OF_MEASURE like '%Bolsa%' then 'KG'
                    when b.PRIMARY_UNIT_OF_MEASURE like '%Bulto%' then 'BE'
                    when b.PRIMARY_UNIT_OF_MEASURE like '%Caja%' then 'CS'
                    when b.PRIMARY_UNIT_OF_MEASURE like '%Docena%' then 'CS'
                    when b.PRIMARY_UNIT_OF_MEASURE like '%Kg%' then 'CS'
                    when b.PRIMARY_UNIT_OF_MEASURE like '%Kilogramo%' then 'CS'
                    when b.PRIMARY_UNIT_OF_MEASURE like '%Litro%' then 'Po'
                    when b.PRIMARY_UNIT_OF_MEASURE like '%Paquete%' then 'PACK'
                    when b.PRIMARY_UNIT_OF_MEASURE like '%Unidad%' then 'CS'
                    else 'CS'
            end as SELLING_UOM,
            null as MULTI_UNITS,
            null as MULTI_UNIT_RETAIL,
            null as MULTI_UNIT_RETAIL_CURRENCY,
            null as MULTI_SELLING_UOM,
            null as LOCK_VERSION
    from cmp_lineas_cotizacion l,
         inv.mtl_system_items_b b
    where b.segment1 || '.' || b.segment2 = l.cod_producto
          and (l.cod_producto in ((select codigo
                                 from tmp.viveres_vegetales)
                                 UNION
                                 (select codigo
                                 from tmp.genericos)
                                 UNION
                                 (select codigo
                                 from tmp.hijos_genericos)))
    and l.fec_ini_vigencia_precio > to_date('01/09/2008','DD/MM/YYYY')
          and (b.segment1 || '.' || b.segment2, l.fec_ini_vigencia_costo, l.mto_precio_venta) in
                          select lc.cod_producto, max(lc.fec_ini_vigencia_costo), max(lc.mto_precio_venta)
                          from  cmp_lineas_cotizacion lc
                          where lc.fec_ini_vigencia_precio > to_date('01/09/2008','DD/MM/YYYY')
                          group by lc.cod_producto
                          )

    Without table definitions, input data, and expected output, it's hard to test. But I would expect that analytic functions would be what you're after (assuming that omitting the "l.cod_producto in" clause from your main query in the subquery where you are getting the MAX values doesn't change any results). Something like
    SELECT <<all your columns>>,
           l.fec_ini_vigencia_costo,
           l.mto_precio_venta,
           max(l.fec_ini_vigencia_costo) over (partition by l.cod_producto) max_vigencia_costo,
           max(l.mto_precio_venta) over (partition by l.cod_producto) max_precio_venta
      FROM <<the rest of your query>>will include the MAX values and the current row values without needing to hit the table a second time. Then you should be able to do
    SELECT <<list of columns>>
      FROM (<<whole query from the last step>>)
    WHERE fec_ini_vigencia_costo = max_vigencia_costo
       AND mto_precio_venta = max_precio_ventaJustin

  • Any std funtion(s) for Zero-padded, 2 decimal value, without the deci point

    Hi,
    We want Zero-padded, two decimal value, without the decimal point. For example if it is 14.31, we need 001431.
    I have done "multiply" with 100 and "formatNumber" as '000000'
    SFIeld --> multiply * 100 --> formatNumber (000000) --> TField
    It works good for values with decimal like above 14.31, does it work for everything else too? I mean for 12 it is populating as 001200. Is this best approach? Is there any other std funtions or UDF sample available?
    Regards,
    N@v!n

    >
    N@v!n Kumar wrote:
    > Hi,
    >
    > We want Zero-padded, two decimal value, without the decimal point. For example if it is 14.31, we need 001431.
    > I have done "multiply" with 100 and "formatNumber" as '000000'
    >
    > SFIeld --> multiply * 100 --> formatNumber (000000) --> TField
    >
    > It works good for values with decimal like above 14.31, does it work for everything else too? I mean for 12 it is populating as 001200. Is this best approach? Is there any other std funtions or UDF sample available?
    >
    > Regards,
    > N@v!n
    public void convert_number(String[] FieldValue,ResultList result,Container container){
    FieldValue = FieldValue * 100;
    result.addValue(FieldValue);

Maybe you are looking for

  • Active session Spike on Oracle RAC 11G R2 on HP UX

    Dear Experts, We need urgent help please, as we are facing very low performance in production database. We are having oracle 11G RAC on HP Unix environment. Following is the ADDM report. Kindly check and please help me to figure it out the issue and

  • Super User of the Month

    Hi Everyone, The Nokia Support Discussion's team is very appreciative of the active participation of our members and recognizes the value being provided on a regular basis. Last September, we started identifying some of the top contributors in the fo

  • BOE XI 3.1 - Upgrade vs. Update

    We are running BOE XI 3.0 and are investigating how to upgrade to version 3.1, in doing so we came across a terminology problem. Some documents refers to the BOE XI 3.1 upgrade software whereas other refers to the BOE XI 3.1 update software (e.g. use

  • What is Time Machine Trying to Backup

    I have a 120 gb drive on my MBP, and I have set TM to backup the entire drive onto my Time Capsule. It shows an estimate of 109 gb for the entire backup, but when I start the backup it shows it is trying to backup 457 gb of data. Where is it pulling

  • Add more "Account Types" in chart of account

    Hi, would it possible to add more account types to the "Account Type" drop down, and anyone who has an idea on how to do it? It would of course be possible to catch the FORM_LOAD event for the form and add additional ValidValues, and in a similar way