Change profile value from pl/sql

nm
Edited by: Jason ORCL on Jun 2, 2009 9:11 AM

Hi,
Just my 0.02 but:
You might find the right answer on the [HRMS | http://forums.oracle.com/forums/forum.jspa?forumID=113] forum:
http://forums.oracle.com/forums/search.jspa?objID=f113&q=profile+value

Similar Messages

  • Script fails when passing values from pl/sql to unix variable

    Script fails when passing values from pl/sql to unix variable
    Dear All,
    I am Automating STATSPACK reporting by modifying the sprepins.sql script.
    Using DBMS_JOB I take the snap of the database and at the end of the day the cron job creates the statspack report and emails it to me.
    I am storing the snapshot ids in the database and when running the report picking up the recent ids(begin snap and end snap).
    From the sprepins.sql script
    variable bid number;
    variable eid number;
    begin
    select begin_snap into :bid from db_snap;
    select end_snap into :eid from db_snap;
    end;
    This fails with the following error:
    DB Name DB Id Instance Inst Num Release Cluster Host
    RDMDEVL 3576140228 RDMDEVL 1 9.2.0.4.0 NO ibm-rdm
    :ela := ;
    ERROR at line 4:
    ORA-06550: line 4, column 17:
    PLS-00103: Encountered the symbol ";" when expecting one of the following:
    ( - + case mod new not null <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current exists max min prior sql stddev sum variance
    execute forall merge time timestamp interval date
    <a string literal with character set specification>
    <a number> <a single-quoted SQL string> pipe
    The symbol "null" was substituted for ";" to continue.
    ORA-06550: line 6, column 16:
    PLS-00103: Encountered the symbol ";" when expecting one of the following:
    ( - + case mod new not null <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current exists max min prior sql stddev su
    But when I change the select statements below the report runs successfully.
    variable bid number;
    variable eid number;
    begin
    select '46' into :bid from db_snap;
    select '47' into :eid from db_snap;
    end;
    Even changing the select statements to:
    select TO_CHAR(begin_snap) into :bid from db_snap;
    select TO_CHAR(end_snap) into :eid from db_snap;
    Does not help.
    Please Help.
    TIA,
    Nischal

    Hi,
    could it be the begin_ and end_ Colums of your query?
    Seems SQL*PLUS hs parsing problems?
    try to fetch another column from that table
    and see if the error raises again.
    Karl

  • How to retrieve the values from PL/SQL table types.

    Hi Every one,
    I have the following procedure:
    DECLARE
    TYPE t1 IS TABLE OF emp%ROWTYPE
    INDEX BY BINARY_INTEGER;
    t t1;
    BEGIN
    SELECT *
    BULK COLLECT INTO t
    FROM emp;
    END;
    This procedure works perfectly fine to store the rows of employee in a table type. I am not able to retrieve the values from Pl/SQL table and display it using dbms_output.put_line command.
    Can anybody help me please!!!!!
    Thanks
    Ahmed.

    You mean, you can't add this
    for i in t.first..t.last loop
    dbms_output.put_line(t(i).empno||' '||t(i).ename||' '||t(i).job);
    end loop;or you can't add this
    set serveroutput onor maybe, you are working in third party application where dbms_output is not applicable at all?
    You see, not able like very similar it is not working - both are too vague...
    Best regards
    Maxim

  • Retreiving a value from and SQL query

    If anyone can give me sample code or pointers to retreive a value from an sql query, I'd be greatful.
    Source code I've muddled together so far:
    Class seqNumType = Class.forName(nameOfClass);
    Constructor theConstructor = seqNumType.getConstructor(null);
    Object seqNumInstance = theConstructor.newInstance(null);
    String theStatement = "SELECT value INTO v_seqnum FROM DUAL;";
    OracleCallableStatement ocs = (OracleCallableStatement)conn.prepareCall(theStatement);
    ocs.registerOutParameter( 1, OracleTypes.NUMBER, 0);
    Method method = seqNumInstance.getClass().getMethod("getORADataFactory", null);
    seqNumInstance = ocs.getORAData(1, (ORADataFactory)method.invoke(null,null));
    ocs.execute();
    Problem with this seems to be the ORADataFactory isn't a method of the class, but as I'm thumbling around in the dark here a little, I've no idea where to go from here. Is this just generally overkill anyway?
    Suggestions?
    Cheers for any help.

    Like this:
                ResultSet resultSet=statement.executeQuery("SELECT * FROM TEST");
                while(resultSet.next())
                    for(int i=0;i<resultSet.getMetaData().getColumnCount();i++)
                        System.out.print(resultSet.getObject(i+1).toString()+" ");
                    System.out.println();

  • How to change the value from one input control to another input control?

    Hi Experts,
    I want to change the value from  one input control to another input control. For Example if i change month in first tab. it should reflect in second tab also. How should we acheive through input control or some other option.
    Here I attached screen shot.Please help me for this

    Hi,
    It is not possible to have Input controll in all tabs that will be set from another .
    But There is one workaround .
    Follow the link below .
    http://davidlai101.com/blog/2013/08/13/web-intelligence-input-control-that-affects-all-tabs/

  • Change Build Status From PL/SQL

    Apex 3.2
    Please see my previous thread
    Change Build Status From PL/SQL
    We tried this code
    CREATE OR REPLACE procedure APEX_030200.pr_sup_unfreeze_apex
    as
    begin
      for l_app in (select id
                          ,security_group_id
                    from APEX_030200.wwv_flows
      loop
        wwv_flow_api.set_security_group_id(l_app.security_group_id);
        wwv_flow_api.set_flow_status (p_flow_id     => l_app.id
                                     ,p_flow_status => 'AVAILABLE'
      end loop;
      commit;
    exception when others then
      dbms_output.put_line (sqlcode);
      dbms_output.put_line (substr(sqlerrm,1,250));
      dbms_output.put_line (substr(sqlerrm,250,250));
      rollback;
      raise;
    end;but recieved error
    BEGIN APEX_030200.pr_sup_freeze_apex; END;
    Error at line 1
    ORA-20001: Package variable g_security_group_id must be set.
    ORA-06512: at "APEX_030200.PR_SUP_FREEZE_APEX", line 51
    ORA-06512: at line 1
    Any ideas ?
    If I just run
    select id,security_group_id
    from APEX_030200.wwv_flows
    ID SECURITY_GROUP_ID
    4000 10
    4050 10
    4155 10
    4300 10
    4350 10
    4400 10
    4411 10
    4500 10
    4550 10
    4700 10
    125 1.07701203277056E15
    1000 1.08971536719791E15
    1010 1.08971536719791E15
    114 1.41432144152464E15
    123 1.43440509319107E15
    160 2.25192481868561E15
    190 2.41432896355852E15
    100 3.93632559648557E15
    103 3.93632559648557E15
    130 5.9543257997941E15
    140 5.95501879180405E15
    Edited by: Gus C on Nov 8, 2012 5:43 AM
    Edited by: Gus C on Nov 8, 2012 5:50 AM

    Hi Gus,
    as Rod already mentioned, wwv_flow_api.set_flow_status would be the way to go. It's no officially documented or supported API but it will do what you want. Just be prepared that it might be removed in the future. The API is defined as following:
    procedure set_flow_status (
        p_flow_id                   in number,
        p_flow_status               in varchar2,
        p_flow_status_message       in varchar2 default null,
        p_restrict_to_user_list     in varchar2 default null )Example code to make all applications unavailable (has to be executed as APEX_040200).
    begin
        for l_app in ( select id,
                              security_group_id
                         from wwv_flows )
        loop
            wwv_flow_api.set_security_group_id(l_app.security_group_id);
            wwv_flow_api.set_flow_status (
                p_flow_id     => l_app.id,
                p_flow_status => 'UNAVAILABLE' );
        end loop;
        commit;
    end;Regards
    Patrick
    My Blog: http://www.inside-oracle-apex.com
    APEX Plug-Ins: http://apex.oracle.com/plugins
    Twitter: http://www.twitter.com/patrickwolf

  • PL/SQL 10g - Cannot Insert Values from PL/SQL

    Hi People,
    BACKGROUND (if required):
    I'm trying to write a message threading algorithm for uni, I believe it works so far, it's just matching the subjects at the moment I want to expand it to include email addresses but that will be at a later date.
    A brief run down, at the moment, a user can generate a list of email addresses to filter the corpus with, these are then inserted (via Java) into the table Sender. These addresses are then used in an IF statement, however they are only used if the table sender is populated. The messges that are identified as threads have their Message ID inserted into another table but they also have their values printed to the DBMS output.
    QUESTION:
    What I need help with is although the values print out to the DBMS Output after a great deal of time, normally after the DBMS buffer has maxed out (thus the statement ends in error). The values printed are not inserted into the table.
    Any help on solving this or optimising if would be greatly appreciated, I'm new to PL/SQL i'm afraid so it's probably a really messy statement.
    If this is a badly worded question and I need to supply more information then I gladly will, however i'm not 100% on what information is relevant at the moment.
    Below is the statement in question.
    Thanks and Regards,
    K
    LOOP
    IF sender_cur1%FOUND THEN
    IF sub_One = Sub_two and sub_One_MID != sub_Two_MID and Sub_One_Sender = send_user_cur THEN
    INSERT INTO MATCHING_SUB (MID) VALUES (sub_Two_MID);
    dbms_output.put_line('MID is: ' || sub_Two_MID);
    END IF;
    ELSE
    IF sub_One = Sub_two and sub_One_MID != sub_Two_MID THEN
    INSERT INTO MATCHING_SUB (MID) VALUES (sub_Two_MID);
    dbms_output.put_line('MID is: ' || sub_Two_MID);
    END IF;
    END IF;
    Edited by: user8967525 on 01-Mar-2010 07:27
    Edited by: user8967525 on 01-Mar-2010 08:08

    cd,
    I will most certainly try.
    I have a table of emails that I am attempting to thread by means of comparing the subjects together (for now). However ultimately I want to be able to bring in the recipients as well. However this can be ignored for now.
    The main variables from the Messages table are:
    MID(number) - 0 - 245000
    SENDER(VARCHAR) - Email Address
    SUBJECT_CLN6 - VARCAHR - Cleaned email subject.
    I am creating two instancs of a cursor that contains the subjects and MID's from Messages. I am then looping through cur1 comparing the value against all values in cur2, this continues until all values in cur1 have been compared against cur2. I use the MID to ensure that I am not comparing the same Message. Furthermore I am also filtering the Emails by Sender (if the table has been populated by the user, via a java applet, otherwise if just uses the subject). The variable Send_User_Cur takes takes its values from the Table called Sender, whilst sub_one_sender takes its values from the column Sender in Messages.
    The proposed output of this at the moment is to just have the MID's (and later all the relevant columns, however just for now MID) of all the threaded emails, inserted into the table MATCH_THREAD, such that they can be called upon later for further processing and most likely called from a java applet at some point as well.
    I've pasted the entire code below. I understand that it looks a bit messy on the preview and for that I apologise.
    Thanks all!
    Kev
    DECLARE
    CURSOR sub_cur1 IS
    SELECT MID, Sender, trim(subject_cln6) from MESSAGES;
    sub_One MESSAGES.subject_cln6%TYPE;
    sub_One_MID MESSAGES.MID%type;
    sub_One_Sender MESSAGES.SENDER%type;
    CURSOR sub_cur2 IS
    SELECT MID, trim(subject_cln6) from Messages;
    sub_Two MESSAGES.subject_cln6%TYPE;
    sub_Two_MID MESSAGES.MID%type;
    CURSOR sender_cur1 IS
    SELECT SENDER_ID FROM SENDER;
    Send_User_Cur SENDER.SENDER_ID%type;
    counter number := 0;
    MID_t MESSAGES.MID%TYPE;
    i number := 0;
    j number := 0;
    BEGIN
    SELECT count(subject) INTO counter
    FROM MESSAGES;
    OPEN sub_cur1;
    OPEN sub_cur2;
    OPEN sender_cur1;
    FETCH sub_cur1 INTO sub_One_MID, Sub_One_Sender, Sub_One;
    FETCH sender_cur1 INTO Send_User_Cur;
    WHILE sub_cur1%FOUND
    LOOP
    IF sub_cur2%ISOPEN THEN
    FETCH sub_cur2 INTO sub_Two_MID, SUB_Two;
    dbms_output.put_line('OPEN');
    ELSE
    OPEN sub_cur2;
    FETCH sub_cur2 INTO sub_Two_MID, SUB_Two;
    --dbms_output.put_line('OPENED and FETCHED');
    END IF;
    LOOP
    IF sender_cur1%FOUND THEN
    IF sub_One = Sub_two and sub_One_MID != sub_Two_MID and Sub_One_Sender = send_user_cur THEN
    INSERT INTO MATCH_THREAD (MID) VALUES (sub_Two_MID);
    commit;
    END IF;
    ELSE
    IF sub_One = Sub_two and sub_One_MID != sub_Two_MID THEN
    INSERT INTO MATCH_THREAD (MID) VALUES (sub_Two_MID);
    commit;
    END IF;
    END IF;
    FETCH sub_cur2 INTO sub_Two_MID, SUB_Two;
    i := i + 1;
    EXIT WHEN i = counter;
    END LOOP;
    CLOSE sub_cur2;
    FETCH sub_cur1 INTO sub_One_MID, Sub_One_Sender, SUB_One;
    i := 0;
    dbms_output.put_line('sub_One_MID: ' || sub_one_mid);
    END LOOP;
    CLOSE sub_cur1;
    CLOSE sub_cur2;
    END;

  • Accessing html field value from pl/sql code, in the same package

    hi friends,
    my pl/sql web application is working fine. but now i need a small requirment.
    ie, basicaly i need to access the user entered value of an element in html based form from pl/sql code, which is developed using pl/sql toolkit.
    Here is the scenario:-
    User entered a value in field1, then navigate to field2, and click a button for list of values,
    when he clicks the button, internaly it is opening a cursor, where i want to pass field1's value to my cursor as a parameter. So in my pls/sql code , i want to access the value of field1. If you know, please help.
    see the snippet of code.
    htp.p('
    function f1()
    if (parseInt(learnIdx) ==1 )
    for i in dev_Need('1')/*here i want to pass html form element value as a parameter */
    loop
    htp.p('content += "<option value='''||a.version_name||'''>'||a.version_name
    ||'</option>''"; ');
    end loop;
    thanks in advance.
    Zameer.N.A

    Hi,
    Here's my suggestion
    If you wanna access the dll check out "external procedures", you can search it everywhere in OTN.
    However it's easier to use Heterogenous Services to connect database with other sources.
    Check out http://asktom.oracle.com/pls/ask/f?p=4950:8:13454621522426176943::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:4406709207206,
    Tak Tang answer on May, 25, 2004 rules!

  • Facebook change profile pic from app

    Please answer me..
    How do i change my profile pic from fb app?

    I think only iphone doesnt have that "change profile picture" option on the app..
    This isnt fb problem.. Its iphone! Let me ask you can u even change your prof pic on the app? Ill give you 100$ right now if u can bro

  • Logic for inserting values from Pl/sql table

    Hi I'm using Forms 6i and db 10.2.0.1.0
    I am reading an xml file using text_io, and extracting the contents to Pl/sql table.
    Suppose, the xml
    <?xml version="1.0" encoding="UTF-8" ?>
      <XML>
      <File name="S2_240463.201002170044.Z">
      <BookingEnvelope>
      <SenderID>KNPROD</SenderID>
      <ReceiverID>NVOCC</ReceiverID>
      <Password>TradingPartners</Password>
      </BookingEnvelope>
    </File>
    </XML>From this xml, i'm extracting contents to a table of records, say bk_arr, which look like
    Tag                             Val
    File name                     S2_240463.201002170044.Z
    SenderID                     KNPROD
    ReceiverID                   NVOCC
    Password                     TradingPartnersAnd now from this i've to insert into table, say bk_det .
    The tag may come in different order, sometimes some additional tags may also come in between,
    So i cannot access it sequentially and insert like
    Insert into bk_det(file,sndr,rcvr,pswd) values(bk_arr(1).val,bk_arr(2).val....)
    The tag name is constant ir for sender id, it will always be SenderID , not something like sndrid or sndid etc..
    So if i've to insert to senderid column, then i've to match the tag = SenderID, and take the value at that index in the array.
    How best i can do this?
    Thanks

    I am referring to how you are parsing the XML - as you can extract values from the XML by element name. And as the name is known, it's associated value can be inserted easily.
    Basic example:
    SQL> with XML_DATA as(
      2          select
      3                  xmltype(
      4  '<?xml version="1.0" encoding="UTF-8" ?>
      5  <XML>
      6          <File name="S2_240463.201002170044.Z">
      7                  <BookingEnvelope>
      8                          <SenderID>KNPROD</SenderID>
      9                          <ReceiverID>NVOCC</ReceiverID>
    10                          <Password>TradingPartners</Password>
    11                  </BookingEnvelope>
    12          </File>
    13  </XML>'         )       as XML_DOM
    14          from    dual
    15  )
    16  select
    17          extractValue( xml_dom, '/XML/File/@name' )                      as FILENAME,
    18          extractValue( xml_dom, '/XML/File/BookingEnvelope/SenderID' )   as SENDER_ID,
    19          extractValue( xml_dom, '/XML/File/BookingEnvelope/ReceiverID' ) as RECEIVER_ID,
    20          extractValue( xml_dom, '/XML/File/BookingEnvelope/Password' )   as PASSWORD
    21  from       xml_data
    22  /
    FILENAME                  SENDER_ID  RECEIVER_I PASSWORD
    S2_240463.201002170044.Z  KNPROD     NVOCC      TradingPartners
    SQL> Now this approach can be used as follows:
      create or replace procedure AddFile( xml varchar2 ) is
    begin
            insert into foo_files(
                    filename,
                    sender_id,
                    receiver_id,
                    password
            with XML_DATA as(
                    select
                            xmltype( xml ) as XML_DOM
                    from    dual
            select
                    extractValue( xml_dom, '/XML/File/@name' ),
                    extractValue( xml_dom, '/XML/File/BookingEnvelope/SenderID' ),
                    extractValue( xml_dom, '/XML/File/BookingEnvelope/ReceiverID' ),
                    extractValue( xml_dom, '/XML/File/BookingEnvelope/Password' )
            from    xml_data;
    end;
    /No need for a fantasy called PL/SQL "+tables+".

  • Changing Filter Values from Macro in BW 7.0

    Hello,
    in my Workbook I need to change Filter Values of some queries in runtime.
    The first thing I found was BEx API reference for BW 3.5, but I wasn't able to make these functions work. After all I found this code:
        Dim BEx As Object
        Set BEx = Application.Run("BExAnalyzer.xla!GetBEx")
        Dim dp As Object
        Set dp = BEx.DataProviders.Item(sDP)
        Dim dimension As Object
        Set dimension = dp.Request.Dimensions.Item("0CALDAY")
        Dim filters As Object
        Set filters = dimension.filters
        If Not BEx.ServerStateExists Then
        MsgBox " Please refresh before using this Makro"
        Exit Function
        End If
        Call filters.SetFilterValue(sFilter) 'this sets the filter value
    But using this code I wasn't able to set more than 1 filter value, because the function SetFilterValue removes all previous filters, but now I need to set more than 1 filters.
    I also tried to separate different filter values with comma, but this did not help.
    Also I will be glad if someone could give me a link on documentation about BEx objects in Excel.
    Thanks in advance,
    Pavel Baronov

    Hi.........
    Check this........
    http://www.netsaptech.com/SDN/demo/BIM301.pdf
    Regards,
    Debjani.......

  • Displaying a field value from PL/SQL

    I'm working on a master detail form. In the detail section, I have added a button beside one of the fields. On the click of this button, I want to use a foreign key value from the current record, and get the description field from another table. I'm able to get the value from the form by use of p_sesion.get_value_as_NUMBER. I then perform the select statement to retrieve the description from another table. I would like to display this value to the user. Any ideas as to how I can do this?

    Bala,
    Just an update to let you know what we've tried up to this point:
    We have created 3 functions:
    1) Set_Occup_Desc - this sets the Occupation Description.
    2) Get_Occup_Desc - this retrieves the Occupation Description.
    3) Clr_Occup_Desc - this clears the Occupation Description.
    On the click of the button, I have the following code:
    declare
    my_occup_desc varchar2(525);
    my_occup_key number;
    my_return_val boolean;
    begin
    my_occup_key := p_session.get_value_as_NUMBER(p_block_name => 'DETAIL_BLOCK', p_attribute_name => 'A_OCCUP_KEY', p_index => 1);
    select occup_desc into my_occup_desc from wsoccup where occup_key = my_occup_key;
    my_return_val := wsurv_util.set_occup_desc(my_occup_desc);
    end;
    In the After Displaying Form section, I have the following code:
    htp.p(wsurv_util.get_occup_desc());
    This doesn't display anything on the page, and I think that it's because multiple oracle sessions are being used within the one portal session, and the value of the variable is being lost.
    Any ideas on a work around for this one?

  • Changing Column Value Style using SQL Query

    Hi,
    I'm trying to build a fantasy basketball game with APEX. I have a table that has a list of games. I need to change the color of the column value i.e. the name of the team that wins according to a SQL query Here's an example:
    TABLE NAME: LATESTGAMES
    Home Away Homepoints Awaypoints
    Boston Cleveland 105 101
    Toronto Washington 122 83
    What I want to do is display the winning team i.e. Boston and Toronto in Green since that's the team that won.
    The SQL query is:
    SELECT HOME,
    AWAY,
    HOMEPOINTS,
    AWAYPOINTS
    from LATESTGAMES;
    What do I need to do in order to display the Winning Team as Green on every column? Please Help

    Hello Devilfish,
    I did something like that in my DG Tournament application (http://www.dgtournament.com)
    Your SQL query can look like this:
    SELECT CASE
              WHEN (homepoints > awaypoints)
                 THEN '<span style="color:green;">' || home || '</span>'
              ELSE home
           END AS home,
    SELECT CASE
              WHEN (awaypoints > homepoints)
                 THEN '<span style="color:green;">' || away|| '</span>'
              ELSE away
           END AS away,
    HOMEPOINTS,
    AWAYPOINTS
    from LATESTGAMES;Hope that gives you an idea,
    Dimitri
    -- http://dgielis.blogspot.com
    -- http://apex-evangelists.com

  • APEX - accepting OUT variable values from PL/SQL Stored Procedure

    I have created a page (Form) which is accepting values text fields.
    In the Page Processing section under Processing, I am passing the values to a PL/SQL Stored Procedure, which acts like an API. The procedure contains code to validate the entered data and finally insert the data into the base tables. The procedure also contains OUT variables in the parameter that would return status of processing and any error messages.
    Now, my question is, how can I make the page accept these OUT variables from the procedure. What I wish to do is, to capture these messages/processing status from the procedure in the page. For example, if there is a error in the data and the procedure is sending this message in the OUT variable, I need this to be displayed on the page as an error message.
    Is this possible in APEX?
    Regards,
    Santhosh Jose

    Hi VC,
    I just tried putting the string directly instead of the variable. Its still not giving me the expected results.
    HOWEVER, I think the reason was because of the EXCEPTION block in my code. I have an EXCEPTION block to handle exceptions. I commented the WHEN OTHERS section and now the error message is coming on the page.
    So what I have done now is as follows: At the point at which the error is expected, I am raising a handled exception. And within the exception handling, I am giving RAISE_APPLICATION_ERROR.
    WHEN ex_main_error*
    THEN*
    p_status := 2;*
    p_msg := 'ERROR Stage: '||lc_err_stage||' ERROR Message: '||lc_err_msg;*
    RAISE_APPLICATION_ERROR (-20001, p_msg);*
    This is working now! Which is very good news. Thanks once again for your help!
    Regards,
    Santhosh Jose

  • Picking the right values from tables - SQL (select statement)

    Hi everyone,
    I'm facing the litlle(?) problem in Oracle environment.
    Let me explain:
    I have two tables.
    TABLE 1
    Id1 | Val1 | Id2 | Val2
    A | 44 | B | 36
    B | 36 | A | 44
    TABLE 2
    Id | Name
    A | New York
    B | Seattle
    I need to get from those tables, using SQL statement, result like this:
    Id1 | Val1 | Name1 | Id2 | Val2 | Name2
    A | 44 | New York | B | 36 | Seattle
    NOTE !! Very important!! If in table 1 we have crossed the same values in fields IdX and ValX in two rows (like in example)- just one of them should be presented as a result.
    I'm afraid it's a bit too complex. You, guys are my last hope.
    Looking forward for any solutions.
    Thanks in advance!

    jeneesh wrote:
    This can give you a startJaneesh, the OP specified that the duplication was across the ID and the VAL columns, but your solution only checks the ID's..
    SQL> ed
    Wrote file afiedt.buf
      1  with t1 as (select 'A' as id1, 44 as val1, 'A' as id2, 36 as val2 from dual union all
      2              select 'A', 36, 'A', 36 from dual)
      3      ,t2 as (select 'A' as id, 'New York' as name from dual union all
      4              select 'B', 'Seattle' from dual)
      5  -- END OF TEST DATA
      6  select distinct greatest(id1,id2) id1,
      7         case when id1 > id2 then val1 else val2 end val1,a.name name1,
      8         least(id1,id2) id2,
      9         case when id1 < id2 then val1 else val2 end val2,b.name name2
    10  from t1 t,t2 a,t2 b
    11  where greatest(id1,id2) = a.id
    12* and least(id1,id2) = b.id
    SQL> /
    I       VAL1 NAME1    I       VAL2 NAME2
    A         36 New York A         36 New York
    SQL>With this data I would have expected both rows to be returned as there is a difference in the val columns..
    SQL> ed
    Wrote file afiedt.buf
      1  with t1 as (select 'A' as id1, 44 as val1, 'A' as id2, 36 as val2 from dual union all
      2              select 'A', 36, 'A', 36 from dual)
      3      ,t2 as (select 'A' as id, 'New York' as name from dual union all
      4              select 'B', 'Seattle' from dual)
      5  -- END OF TEST DATA
      6      ,t3 as (select distinct id1, val1, id2, val2
      7              from
      8                (
      9                 select decode(switch,1,id2,id1) as id1
    10                       ,decode(switch,1,val2,val1) as val1
    11                       ,decode(switch,1,id1,id2) as id2
    12                       ,decode(switch,1,val1,val2) as val2
    13                 from (select id1, val1, id2, val2
    14                             ,case when id1||val1 > id2||val2 then 1 else 0 end as switch
    15                       from t1)
    16                )
    17             )
    18  --
    19  select t3.id1, t3.val1, t2_1.name
    20        ,t3.id2, t3.val2, t2_2.name
    21  from   t3 join t2 t2_1 on (t2_1.id = t3.id1)
    22*           join t2 t2_2 on (t2_2.id = t3.id2)
    SQL> /
    I       VAL1 NAME     I       VAL2 NAME
    A         36 New York A         36 New York
    A         36 New York A         44 New York

Maybe you are looking for

  • Itunes radio not showing on music app

    i have the iphone 5 and updated to ios 7 but the Iradio icon is no longer available? Re- startedthe phone but didnt work...

  • Safari crashes on start up

    Trying to open the application causes the icon to bounce endlessly with the only option being Force Quit. i have recently disinstalled flash. Thanks for any help! Date/Time:       2011-10-27 00:12:39 +1100 OS Version:      10.7.2 (Build 11C74) Archit

  • Photos missing but when searching all photos in finder they are there

    Not long ago i noticed that all my photos after july 20th were missing. The next thing that was there was an update i did just 2 days ago which was the end of august at the time. So almost 1 month was missing out of my iphotos photos. I didnt know wh

  • Urgent Patchset 10.1.0.4

    Hi All, i've installed oracle 10g 10.1.0.2 then i applied the patchset then my db become 10.1.0.4 everything works fine, as a requirement i've created new database on same machine with DBCA utility on Data warehouse template database has succesfully

  • Assigning sequential number from number range

    Hi All, My Zreport is updating Ztable with sequential number field assigned for each document numbers for each period. Below are the numbers assigned for period 5 in Ztable. 00001000000000000000 00001000000000000001 00001000000000000002 0000110000000