Identify partition name from input data

Hi gurus,
Pleae help for the below
based on the input data i have to delete the partition from the table.
suppose if a table PART  is partitioned based on the column id  number.  if my input data is 10 if it is present in the partition then i want to identifiy the partition_name.. 
Please help  how to identify the partition name based on input data?
Reply
S

You can query USER_TAB_PARTITIONS for PARTITION_NAME and PARTITION_POSITION against HIGH_VALUE.  Unfortunately, HIGH_VALUE is a LONG.
Hemant K Chitale

Similar Messages

  • What is the b2b setup for identifying TP names from file name in Inbound tx

    Hi,
    I am using B2B 11g version and documents of type ANSI-X12. I am working for Inbound Transaction and using Generic File protocol in Listening channel.
    File format is : %FROM_PARTY%_%TO_PARTY%_%DOCTYPE_NAME%_%DOCTYPE_REVISION%.dat
    How can i make B2B to identify Trading partner names from the file name once the remote trading partner put the file in the specified path with the specified format "%FROM_PARTY%_%TO_PARTY%_%DOCTYPE_NAME%_%DOCTYPE_REVISION%.dat" mentioned in the delivery channel.
    Now B2B is identifying Trading partner names from the Interchange Sender ID(ISA06) and Interchange Reciever ID(ISA08) of the ISA Segment. Please help me , how to make B2B to identify the trading partner names from the file name instead of from identifiers coming in ISA Segment.
    Thanks,
    Sridhar Rachumallu

    Hi Anuj,
    1)Now i am giving the file name for inbound documents in the format of "%FROM_PARTY%_<UniqueNumber/Timestamp>.dat" . But still B2B Identifying the TPNames at runtime from the ISA Segment elements ISA06 & ISA08 element values. I want to make B2B to identify the TPNames at run time from the file name instead of from ISA Segments.
    Please tell me how can i do these?
    2) I am giving exact Remote Trading partner Default Identifier Type 'NAME' value for "%FROM_PARTY% in the file format and i want B2B to identify the TP name at runtime based on the value of "%FROM_PARTY%" . If the value of "%FROM_PARTY%"is matching with any one of the Trading partner Default Identifier Type 'NAME' value than it should go for furthur else B2B should through error as " the TP name unable to found".
    3) Please tell me how B2B Identify trading partners at runtime in the business case given below
    - Inbound Transaction from remote TP to Host TP
    - Document protocol is 'ANSI-X12'
    - Listening channel protocol is 'Generic File'
    This is very urgent.. Please give the reply As soon as possible.
    Thanks,
    Sridhar.rachumallu
    Edited by: [email protected] on Jun 9, 2010 12:45 AM
    Edited by: [email protected] on Jun 9, 2010 1:01 AM

  • Stored procedure to identify column names from a lookup table

    I have a working PL/SQL stored proc as below:
    CREATE OR REPLACE PROCEDURE PROC_TEST IS
    CURSOR GET_TEST_VALUES IS
    SELECT
    MF_master.comp_service_b,MF_master.normal_form_amount_b, MF_master.plan_id_b, MF_master.plan_percentage_b, MF_master.plan_service_b,MF_master.autoid,     ORA_master.comp_service_v, ORA_master.normal_form_amount_v,
    ORA_master.plan_id_v, ORA_master.plan_percentage_v,
    ORA_master.plan_service_v, ORA_master.autoid,     ORA_master.test_var     FROM MF_master, ORA_master
    WHERE ((MF_master.autoid = ORA_master.autoid));
    BEGIN
    FOR REC IN GET_TEST_VALUES LOOP
    begin
    if rec.test_var='SVC' then
    if (to_number(rec.plan_service_b) = to_number(rec.plan_service_v) ) and
    (to_number(rec.comp_service_b) = to_number(rec.comp_service_v) ) then
    update ORA_master set status_v = 'COMPLETE',last_updt_user_v = 'PROCEDURE',last_updt_date_v = SYSTIMESTAMP where autoid = rec.autoid;
    else
    update ORA_master set status_v = 'INCOMPLETE',last_updt_user_v = 'PROCEDURE',last_updt_date_v = SYSTIMESTAMP where autoid = rec.autoid;
    end if;
    end if;
    if rec.test_var = 'TERM' then
    if (to_number(rec.plan_percentage_b) = to_number(rec.plan_percentage_v) ) and
    (to_number(rec.normal_form_amount_b) = to_number(rec.normal_form_amount_v) )
    then
    update ORA_master set status_v = 'COMPLETE',last_updt_user_v = 'PROCEDURE',last_updt_date_v = SYSTIMESTAMP where autoid = rec.autoid;
    else
    update ORA_master set status_v = 'INCOMPLETE',last_updt_user_v = 'PROCEDURE',last_updt_date_v = SYSTIMESTAMP where autoid = rec.autoid;
    end if;
    end if;
         end;
         END LOOP;
         COMMIT;
    END;
    What I am doing here is, if test_var = 'SVC', I am comparing 2 columns, plan_service_b and comp_service_b(with plan_service_v and
    comp_service_v)
    Similarly, for test_var = 'TERM', it is plan_percentage_b and normal_form_amount_b(with plan_percentage_v and normal_form_amount_v)
    The above works fine as of now, but I am looking for a way to make this design more dynamic. In other words, these comparison columns may change from time
    to time and each time something changes, I will have to change this code. Rather, I am looking for a way to have the comparison columns in a
    lookup table that I can query to get what needs to be compared.
    My thought is :
    CREATE TABLE COMPARISON_COL_LOOKUP
    (test_var VARCHAR2(10),
    MF_column VARCHAR2(30),
    ORA_column VARCHAR2(30) );
    And then, insert
    INSERT INTO COMPARISON_COL_LOOKUP ('SVC','PLAN_SERVICE_B','PLAN_SERVICE_V');
    INSERT INTO COMPARISON_COL_LOOKUP ('SVC','COMP_SERVICE_B','COMP_SERVICE_V');
    INSERT INTO COMPARISON_COL_LOOKUP ('TERM','PLAN_PERCENTAGE_B','PLAN_PERCENTAGE_V');
    INSERT INTO COMPARISON_COL_LOOKUP ('TERM','NORMAL_FORM_AMOUNT_B','NORMAL_FORM_AMOUNT_V');
    commit;
    In this way, when tomorrow, when something changes - like new columns need to be compared for SVC or TERM, OR, if any comparisons need to
    be removed, all I need to do is to change the data in this lookup table !
    Now here's my question --- If I have this lookup table, how best can I update my above stored procedure to use this lookup table so that I don't need to
    hard-code the column names for comparison ?
    Any thoughts/suggestions are appreciated.

    While it is certainly technically possible to use dynamic SQL here, I would suggest that you make absolutely certain that you're not making things unnecessarily complicated...
    Dynamic SQL is generally substantially harder to write, debug, and maintain than equivalent static SQL. In addition, it takes a lot more work to ensure that dynamic SQL performs as well as static SQL (i.e. you now have to explicitly use bind variables) and that you're not introducing security holes via SQL injection.
    If your comparisons are likely to change infrequently, and particularly as those changes would imply changes to the underlying requirements, I would tend to be biased toward keeping the working procedure and just planning on making code changes periodically.
    Of course, not knowing your particular requirements, I certainly can't be certain that dynamic SQL would be inappropriate here, but I have seen lots of folks unnecessarily complicate their systems by building overly flexible systems that were painful to support and extend.
    Justin

  • Getting "Name0" should be "Name" from Write Data Channel vi

    Can someone please explain this behavior? For some reason I'm getting "0's" apended to the Name string of my Write Data Channel vi.
    Small write vi sample is attached.
    thanks for any help
    Attachments:
    write[1].vi ‏316 KB

    Mudda,
    Thanks for the feed back. It looks like this behavior is tied to using the "Simulated Signal" express vi's. When the Simulated Signal vi is wired the Name field becomes the "Name/Channel Number" field. When you merge multiple Simulated Signal vi's and feed this into the Write Data Channel input you get "Name(n), Name(n+1)" etc. That is fine for merged inputs but for what it's worth I think we should be able to disable this "feature" when just using 1 Simulated Signal input. Sample of this is attached.
    Attachments:
    write_001.vi ‏382 KB

  • Dynamic file name from input payload (RFC 2 flat file)

    Hi,
    I have an RFC to flat file scenario. The output flat file has not an XML structure, it's just a plain text file generated with abap mapping.
    In my source interface (RFC), I have a field called <FILENAME>, I want to use the value of that field to create the target file using dynamic file name. But if  in variable substitution I use payload:ZRFC_NAME,1,FILENAME,1 It doesn't work because the dynamic variable substitution try to access to output payload, not the source one...
    What can I do?

    Hi Marshal,
           You can add a extra node to your target strucutre like
    FileName- Node
    --FileName - Element.
    do the mapping from the field filename of RFC to FileName field in u r target strucure. And use this  field path at Refrence in variable subtituion.
    In the Content converison add the Name & Values as below
    FileName.fileldNames -- FileName
    FileName.fieldFixedLengths -- 0
    FileName.fixedLengthTooShortHandling -- Cut
    So the extra field in u r target structure would not populate in u r target text file.
    Cheers
    Veera

  • How to clear old values from input date

    Hi Guys
    i am using <t:inputdate like this
    <t:inputDate id="dob" type="date" value="#{patientBean.dob}" />
    and scope of my backing bean is request
    it works fine , but problme is , when add a patient in database for first time it works fine , but when i try to add another patient , it remains old value selected at the time of first patient , other filds are blank for new record!!
    Please Help me out !!!
    thanx in advance

    Songs don't go into the source pane, only playlists.
    Salect them and delete them.

  • Call Data in Variable in Stored Procedure for Partition Name

    Hi,
    Here is an excerpt from a Srored Proc I have written.
    The aim here is to copy data from a partition of a table.
    I first query the partition-name from the ALL_TAB_PARTITIONS table and store the same in a VARCHAR2 variable named partition_name_low.
    I then try to select the data in this partition of the table by using the variable name.
    PROCEDURE purging AS
    partition_name_low VARCHAR2(25);
    BEGIN
    --+
    -- Query for the Highest Value of the timestamp in the 1st partition in current table.
    --+
    SELECT PARTITION_NAME
    INTO partition_name_low
    FROM ALL_TAB_PARTITIONS
    WHERE TABLE_NAME = 'TABLE1' AND PARTITION_POSITION IN
    +(+
    SELECT MIN(PARTITION_POSITION)
    FROM ALL_TAB_PARTITIONS
    WHERE TABLE_NAME = 'TABLE1'
    +);+
    COMMIT;
    COMMIT;
    DBMS_OUTPUT.PUT_LINE(partition_name_low ||' **********  ' || TO_char(sysdate, 'MM/DD/YYYY HH24:MI:SS')||' Starting Purging Data  *********');
    --+
    -- Copy data from 1st partition to Archive Table
    --+
    INSERT /* APPEND */ INTO TABLE1_ARCHIVE+
    SELECT * FROM TABLE1 PARTITION(partition_name_low);
    However, I am facing an issue here since I keep on gettin an error that "ORA-02149: Specified Partition does not exist".
    What I understand is that the Oracle query is picking up the literal string "partition_name_low", instead of the data inside it.
    I tried with
    &partition_name_low
    AND
    :partition_name_low
    with no luck.
    For the 2nd case I get the obvious exception "bad bind variable".
    Can someone please suggest in which way I can handle this situation where I can use a variable refer the partition name in a select query?
    Thanks in advance!!
    Abhishek.

    Hi,
    You have to use "execute immediate" to launch dynamic SQL command.
    So you should write
    execute immediate 'INSERT /* APPEND */ INTO TABLE1_ARCHIVE+
    SELECT * FROM TABLE1 PARTITION('||partition_name_low||')' ;
    Mike

  • FM for getting MONTH name from DATE.

    Hi all ,
    We have a requirement to get Month name from the DATE,e.g IF date is 01/01/2008 we need a FM which can generate month name as 'JANUARY'.
    \[removed by moderator\]
    Thanks and Regards
    Kiran
    Edited by: Jan Stallkamp on Jul 30, 2008 4:26 PM

    Hi,
    Here is the code u required...
    REPORT  ZASHU_MONTH_NAMES_GET.
    data:r_code type sy-subrc.
    data:mnames type standard table of T247 with header line.
    CALL FUNCTION 'MONTH_NAMES_GET'
    EXPORTING
       LANGUAGE                    = SY-LANGU
    IMPORTING
         RETURN_CODE                 = r_code
    TABLES
        month_names                 = mnames.
    EXCEPTIONS
      MONTH_NAMES_NOT_FOUND       = 1
      OTHERS                      = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    write:/ mnames.
    Thanks & Regards
    Ashu Singh

  • Problem while displaying all the table names from a MS Access Data Source.

    I started preparing a small Database application. I want to display all the Table Names which are in the 'MS Access' Data Source.
    I started to executing by "Select * from Tab" as if in SQL.
    But i got an error saying that "Not able to resolve Symbol 'Tab' in the query".
    Please let me know how can i display all the table Names in the MS Access Dats Source.

    Here i am developing the application in Swing using JDBC for accessing the database.
    I want to display all the Table names from the data source in a ListBox for easy selection of tables to view their details.

  • Displaying images from MySQL data base

    I'm currently developing a Master/Detail
    page set. The MySQL table containing the Detail information includes a 'blob'  (MIME: image/jpeg  - Attributes - BINARY) for storing a small image. Under phpmyadmin the images show where applicable.
    In my Detail page I display the results in a table. All the values display except the image.
    I selected Insert > Image
    When the 'Select Image Source' dialogue appeared set 'select file name from' to Data source
    Selected the data base field from the established records set
    I left the 'Format' as 'None'
    Clicked OK
    Have I omitted to set something? How does Dreamweaver or the PHP code know hto to render this field?
    Hope someone can make some suggestions to resolve this.
    Thanks
    Cliff
    Other possible useful info:
    Developing on Windows XP
    Dreamweaver CS5
    all versions of MySQL, PHP, Apache, IE8, Dreamweaver up to date.

    In my desparation this morning
    I even tried to set up a mirror of your example witha separate table (just the 3 fields) and even that didn't work. The Proxy member was the same as yours except that the script was changed to LocalPHP.php . Therefore I presume that the error must have been in the webpage. Unfortunately I've since deleted the code so I can't send a copy of what I used.
    The only suggestions I could suggest that may help others that are novices are (1) suggested code for the webpage (2) a diagram illustrating how the elements link or relate to each other. Hope that is thought helpful.
    Thanks again
    Cliff

  • Error - in Input data

    Hi All,
    This is my error message. what can be the problem, help me identify it.
    ‘The input data …
    s2.. can not be be processed. The data can not be be allocated to an organisation.’
    ‘Error with the download, output file cannot be opened’
    regards
    Ab

    For the data to be allocated to an organisation you need some identifiers, so that the system knows to which organisation data can be allocated.
    For example, two plants one material which belongs to plant ONE.
    Now when you try to do something with this material, you need to know to which plant it belongs in order to use it.
    I imagine, that similar thing is happening here as well.

  • Getting the Month value and Name from the Ranges of the Date given input.

    Hi Techies,
    I am developing Monthly wise report in FICO. My Inputs are Company Code, Fiscal Year and Date Range. From the Date Range I have to get the month and Generate the Report.
    For Ex:
    BUKRS : 1000
    GJAHR : 2009
    FKDAT : 01.04.2008 to 01.04.2009
    From the Above Date range how can I get the individual month names or periods. As per my Knowledge I can get the month value when the date is parameter but here the date is ranges.  Is any code available for this ?
    Thanks in Advance
    Regards,
    Muralikrishna Peravali.
    Edited by: muralipsharma on Aug 31, 2010 10:30 AM
    Edited by: muralipsharma on Aug 31, 2010 12:57 PM

    DATA: lv_dat          TYPE dats,
          lv_day          TYPE c LENGTH 2,
          lv_month        TYPE c LENGTH 2,
          lv_year         TYPE c LENGTH 4.
    DATA: lv_poper        TYPE t009b-poper.
    DATA: lt_poper        TYPE TABLE OF t009b-poper.
    SELECT-OPTIONS: so_dat        FOR sy-datum.
    break fis-kemmer.
    lv_dat = so_dat-low.
    DO.
      CLEAR: lv_poper.
      CALL FUNCTION 'FI_PERIOD_DETERMINE'
        EXPORTING
          i_budat        = lv_dat
        IMPORTING
          e_poper        = lv_poper
        EXCEPTIONS
          fiscal_year    = 1
          period         = 2
          period_version = 3
          posting_period = 4
          special_period = 5
          version        = 6
          posting_date   = 7
          OTHERS         = 8.
      APPEND lv_poper TO lt_poper.
      lv_day    = lv_dat+6(2).
      lv_month  = lv_dat+4(2).
      lv_year   = lv_dat(4).
      lv_month = lv_month + 1.
      IF lv_month LE 9.
        CONCATENATE '0' lv_month INTO lv_month.
      ENDIF.
      CONCATENATE lv_year lv_month lv_day INTO lv_dat.
      IF lv_dat GT so_dat-high.
        EXIT.
      ENDIF.
    ENDDO.
    after that you have a list of all the FI periods in internal table LT_POPER.
    get the idea?

  • Is there an easy way to run an Ajax function from input type=file to test the file name in DB?

    I've had the <input type="file">  ... <cffile ...> thing going for a few years now. 
    There is a database where the uploaded file names are stored once the files are uploaded to the server.  It sees things in terms of problems and stores uploaded file name accordingly with the ProbID prepended onto the file name; e.g., MyPicture.jpg would end up in the designated directory and databawe as P416_MyPicture.jpg.  This allows user to store pictures with the same name in different problems without a conflict.  There has been an issue with certain characters (e.g., spaces, +, #, etc.) causing problems when they are in file names so we have come up with a way using the <cffile ... rename> to replace these chars with _.  This means that MyPic+.jpg would end up being P416_MyPic_.jpg. 
         This is where the problem appears.  If someone were to upload MyPic+.jpg after someone else uploaded MyPic_.jpg in the same problem, then the + file would overwrite the _ file before the system knew they had a problem.  And there is now way to restore the original file without going to the system backup and doing so – which is a whole other story … especially, if the person doesn’t tell anyone.
         The logical solution would be to be able to test the new final file name (the name after making the substitutions mentioned above) against the existing files in the database before you went from the page where the <input type=file> control to the associated _action.cfm page where the <cffile> object is located.  Given that this seems to be the province of Ajax, this would seem like a natural use of the really interesting technology.  I have can determine the file name from the onChange action on the <input type=File> so that this would be the place for Ajax to come to the rescue by looking up the final file name and then letting the user know whether the resultant name is a unique within the database or not.  If so, I'll just enable the Add button which sets right next to the <input > control and let them upload it.  If not, I'll put up an error message telling them that this file already exists in the system.
         This would be the perfect solution.  It would let me do some Ajax stuff like I've wanted to do for the past year, but never have had the time to do because this is the project that won't go away.  This is, in fact, the last thing of any consequence that remains to do on this 2-1/2 year nightmare – be careful what you wish for.  If I can get this done this week, then maybe I can finally take a weekend off … maybe it will finally come to an end.
         Which finally leads to my question:  I'm looking for some tips on how to get this thing going since I can barely spell Ajax.  I've got a book and looked at some stuff online about CF and Ajax, but a good example or two or three would be worth a day's worth of poking around on the web and in my books.
         Thanks in advance for any suggestions, ideas, help, whatever.
    Len

    Adam,
         Thank you for your suggestion, but, after spending the night working with Ben Forta's CF8, vol 2, Chap 34, working with <cfajaxproxy>, I was able to do exactly what I wanted and it appears, after some testing, to work exactly as I had envisoned it should. 
         I am now calling a JavaScript function (testFileName) from the onChage event on the <input type="file"> or Browse button, which calls my proxy.cfc that contains the server side of the equation.  This funciton testFileName (I've run out of cleaver function/file names).  The query contained therein hits the database to see if the passed in parameters can pull up an existing file.  If they do, the particulars (file name, data attahced, etc.) are returned to the JavaScipt procedure that puts up the error notice.  The user can then chose to either overwrite the file or quit.  Quiting leaves the your on the Attachment PopUp where he/she started with nothing being uploaded. 
         Thanks again for your suggestion.  I appreciate your taking the time to do so.
    Len

  • Save input data from popup modal MVC

    Hi I am trying to save data from popup. When I execute my controller side data is not saved. Please see code below:
    View:
    @model IEnumerable<Model>
        <h2>Manage Dimension</h2>
           <link href="@Url.Content("~/Content/Gridmvc.css")" rel="stylesheet" type="text/css" />
           <script src="@Url.Content("~/Scripts/gridmvc.min.js")" type="text/javascript"> </script>
          <script src="@Url.Content("~/Scripts/js/bootstrap.min.js")" type="text/javascript"> </script>
          <link href="@Url.Content("~/Content/bootstrap/css/bootstrap.min.css")" rel="stylesheet" type="text/css" />
          <link href="@Url.Content("~/Content/bootstrap/css/bootstrap-responsive.min.css")" rel="stylesheet" type="text/css" />
    @using (Html.BeginForm())
        @Html.AntiForgeryToken()
        @*<html>*@
        <body>
            <hr />
            <div class="table-responsive">
                <table class="table table-striped  table-hover">
                    <thead>
                        <tr>
                            <th>
                                ID
                            </th>
                            <th>
                                Name
                            </th>
                            <th>
                                Value
                            </th>
                            <th>
                                Action
                            </th>
                        </tr>
                        @foreach (var item in Model)
                            foreach (var i in item.Values)
                                <tr>
                                    <td>
                                        <span data-bind="text: ID">@item.ID</span>
                                    </td>
                                    <td>
                                        <span data-bind="text: Name">@item.Name</span>
                                    </td>
                                    <td>
                                        <span data-bind="text: Value">@i.Value</span>
                                    </td>
                                    <td>
                                        <button type="button" class="edit-mode" data-toggle="modal" data-target="#myModal" id="c.ResellerId">edit</button>
                                    </td>
                                </tr>
                </table>
                <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                <h4 class="modal-title" id="myModalLabel">Edit/Add Dimension</h4>
                            </div>
                            <div class="modal-body">
                                <div id="dialog-form" title="Create new user">            
                                    <form>
                                        <fieldset>
                                            <label for="name">Name</label>
                                            <input type="text" name="name" id="name" value="" class="text ui-widget-content
    ui-corner-all"><br /><br />
                                            <label for="email">Value</label>
                                            <input type="text" name="value" id="value" value="" class="text ui-widget-content
    ui-corner-all">
                                        </fieldset>
                                    </form>
                                </div>
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                                <button type="button" class="btn btn-default"  id="inviteRequest">Save changes</button>
                            </div>
                        </div>
                    </div>
                </div>  
                <br />
                <br />
                <div class="modal-footer">
                    <button type="button" class="btn btn-primary" data-dismiss="modal" data-toggle="modal" data-target="#myModal" data-bind="click: Save">Add</button>
                </div>
                <script src="~/Scripts/App/Modal.js"></script>
                @*<script type="text/javascript" src="https://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2.min.js"></script>*@
                @*<script src="@Url.Content("~/Scripts/js/bootstrap.min.js")" type="text/javascript"> </script>*@
                <script type="text/javascript">
                    $(document).ready(function () {
                        $('#inviteRequest').click(function () {
                            console.log(1);
                            $('#myModal').modal('hide');
                            $.post('/ManageDimension/Create', { "Name": name, "Value": value })
                            alert("You clicked me!");
                            window.location.reload(true);
                </script>
            </div>       
        </body>
    </html>
     Controller:
      [HttpPost]
            public ActionResult Create( DataModel dimension)
                if (ModelState.IsValid)
                    db.Save(dimension);
                    return RedirectToAction("Index");
                else
                    return View(dimension); 

    Hi,
    This is a forum for Visio.
    To get more professional support, I recommend you post this question in MVC forum.
    http://forums.asp.net/1146.aspx/1?MVC
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who
    read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    Regards,
    Greta Ge CHN
    TechNet Community Support

  • How to Select data using same column name from 3 remote database

    Hi,
    Can anyone help me on how to get data with same column names from 3 remote database and a single alias.
    Ex.
    SELECT *
    a.name, b.status, SUM(b.qty) qantity, MAX(b.date) date_as_of
    FROM
    *((table1@remotedatabase1, table1@remotedatabase2, table1@remotedatabase3)a,*
    *(table1@remotedatabase1, table1@remotedatabase2, table1@remotedatabase3)b)*
    WHERE b.dept = 'finance'
    AND a.position = 'admin'
    AND a.latest = 'Y' AND (b.status <> 'TRM') AND b.qty > 0;
    GROUP BY a.name, b.status ;
    NOTE: the bold statements is just an example of what I want to do but I always gets an error beacause of ambiguous columns.
    Thanks in advnce. :)
    Edited by: user12994685 on Jan 4, 2011 9:42 PM

    user12994685 wrote:
    Can anyone help me on how to get data with same column names from 3 remote database and a single alias.Invalid. This does not make sense and breaks all scope resolution rules. And whether this is in a single database, or uses tables across databases, is irrelevant.
    Each object must be uniquely identified. So you cannot do this:
    select * from (table1@remotedatabase1, table1@remotedatabase2, table1@remotedatabase3) a3 objects cannot share the same alias. Example:
    SQL> select * from (dual, dual) d;
    select * from (dual, dual) d
    ERROR at line 1:
    ORA-00907: missing right parenthesisYou need to combine the objects - using a join or union or similar. So it will need to be done as follows:
    SQL> select * from (select * from dual d1, dual d2) d;
    select * from (select * from dual d1, dual d2) d
    ERROR at line 1:
    ORA-00918: column ambiguously definedHowever, we need to have unique column names in a SQL projection - so the join of the tables need to project a unique set of columns. Thus:
    SQL> select * from (select d1.dummy as dummy1, d2.dummy as dummy2 from dual d1, dual d2) d;
    DUM DUM
    X   X
    SQL> I suggest that you look closely at what scope is and how it applies in the SQL language - and ignore whether the objects referenced are local or remote as it has no impact to fundamentals of scope resolution.

Maybe you are looking for

  • Installation: HPLIP, and remote printing from ANDROID, & iOS to a static networked HP printer

    I recently installed an HP LaserJet Professional m1212nf MFP Printer on my network and gave it a static IP address.  On my main computer (also statically networked - Ubuntu 12.04) I installed the hplip services and can successfully print to it.  On t

  • Trouble getting started

    I just got myself a 30gig ipod, and I began following the instructions to get it up and ready. I connected the iPod like the instructions said, and I was prompted to downlaod iTunes 7. I downladed and installed it, but I can't go any further because

  • Wirless Print Servers with Mac and Windows

    I am very new to mac..macbook purchased just this week..facing some challenges but learning at the same time..I have my macbook running thru my wireless network on a Motorola SB4100 Cable modem, D-Link DI 614+ Wirless Broadband router and a d-link DP

  • Vendor invoice through Idoc INVOIC

    Hi, I need to post the vendor invoice(MIRO) thrugh Idoc..Need to capture special charges to some G/L accounts. I know that we need to use T076I table. Which message type and process code we can use to post this invoice with special charges? tell me h

  • Oracle and Java

    Hi! How can I write a query in Java to retrieve data from Oracle database, if I want to put some parameters from my Java application in that query? For example: String username = userName.getText().toString(); String pass = password.getText().toStrin