Detect the fields which are primary/foreign keys for each schema's tables

Hello everybody,
I'd like to know if it's possible to select a field in one of the dictionary tables to identify the fields of a table which are PK or FK in this one. I'd like to do this to generate the fields that I need to put in a technical design.
Actually I have this (if it can help you to understand what I'd like to do) :
select table_name "Table name",
column_name "Physical field name",
case when data_type = 'NUMBER' then data_type || '(' || NVL(data_precision,0) || ',' || NVL(data_scale,0) || ')'
when data_type = 'VARCHAR2' then data_type || '(' || data_length || ')'
else data_type
end "Datatype",
case when nullable = 'Y' then 'FALSE'
when nullable = 'N' then 'TRUE'
end "Not null",
/* Here I'd like to retrieve TRUE or FALSE if the field to display is a primary key or not and the same for foreign keys*/
from all_tab_columns
where table_name in (select table_name
from all_tables
where table_name like '%project_name%'
and table_name not like '%TMP%');
Thanks a lot for your help,
Florent

Please investigate all_constraints and all_cons_colums.
http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14237/toc.htm

Similar Messages

  • Creating Custom fields which are sales org dependent in Accounts Master

    Hello Experts,
    I want to create new custom fields in Accounts Master for sales and shipping.The component being used is BP_SALES.However when I try to create custom fields through AET, the new fields are added in the BUILHEADER context node.The problem with this is, its making the fields Sales Org independent.
    I want to add the fields which are sales org dependent( i.e. want to add the fields for the context nodes BUILSHIPPINGTERMS and BUILSALESARRANGEMENT).
    Please help me in this regards,
    Thanks and Regards,
    Rahim
    Edited by: Abdul Rahim on Dec 27, 2010 9:55 AM

    Hi Rahim,
    in general extension fields for Business Partner are only supported for the header fields (Table BUT000). Therefore the AET does not offer this.
    Table extension for BP sales data is supported by the AET beginning from CRM 7.0 eHP1. If you have this you can just create a 1:1 table enhancements and should be happy. If not I'm afraid that you would have to implement this manually.
    Using the Easy Enhancement Workbench (EEW) it would only be possible to create table extensions for the header and for relation ship but not for sales data.
    Regards Matthias

  • Missing primary foreign key in grandchild table

    I have a model with a two inheritance generations.
    https://www.dropbox.com/s/4rghqcmxx24bgvt/pf_logical.png
    When I engineer all entities everything is fine. The child tables get their primary foreign keys:
    https://www.dropbox.com/s/t4v5bexxwdrn5y1/pf_engineered.png
    But when I do not engineer the child generation the grandchildren have no primary foreign keys anymore.
    https://www.dropbox.com/s/ofl436sm8dua3w8/pf_missing.png
    I have expected, that the grandchildren get a primary foreign key to the grandfather. But that is not the case. How can I tell the modeler to engineer such a foreign key?

    Hi,
    thanks for reporting the problem. I logged a bug for that.
    Philip

  • How to export fields which are rendered false from a page?

    Hi ,
    I have a requirement to export the data to excel, i am able to do it using export button.
    but the problem is i need to export the all the fields which are there in the VO query but some of them are not renderd on the page.
    Please suggest some solution for this.
    Thanks

    Hi,
    Can you add them in the page to formValueBeans and check the issue.
    Thanks.
    With Regards,
    Kali.
    OSSi.

  • APEX don't allow modify rows in columns which are Primary Key ?

    I have tables:
    http://img508.imageshack.us/my.php?image=21269582oe8.jpg
    book(id_book - "Primary Key", title, year); book_author(id_book - "Primary Key", id_author - "Primary Key"); author(id_author - "Primary Key", name)
    I have created a new page -> Form -> Tabular Form for table 'author' because I would like to add new authors, modify and delete. During creating this page I have choosen column 'id_author' as 'primary key column 1' and everything is OK (I can't modify column 'id_author' - this column is autoincrement and I can modify column 'name').
    BUT I have also created a new page -> Form -> Tabular for table 'book_author' because I would like to write numbers as id_book and id_author, modify and delete them (so add relations between tables: book, book_author and author). During creating this page I have choosen column 'id_book' as 'primary key column 1' and 'id_author' as 'primary key column 2'. And on website I can't modify (edit) these fields. And I can't also add new row because I see in each column in new row: (null).
    http://img444.imageshack.us/my.php?image=11324615yk9.jpg
    APEX don't allow modify rows in columns which are Primary Key ? This is stupid....... What can I do ?
    Edited by: user10731158 on 2008-12-20 11:40

    Single-column and non-meaningful so you never want to update them. In the case of your example, you would need to add an ID column to the book_author intersection table. Honestly, I was so blown away (and pleasantly surprised) by the lack of rebuttal and the "thx" that I went ahead and put together an example of how I would define the book_author table:
    create table  book_author
       (id varchar2(32),
        book_id varchar2(32),
         author_id varchar2(32),
         modified_on     date,
         modified_by varchar2(255),
         constraint book_author_pk primary key (id),
         constraint book_auth_book_fk foreign key (book_id) references books(id),
         constraint book_auth_author_fk foreign key (author_id) references authors(id)
    create unique index book_author_uq on book_author (book_id,author_id)
    create or replace trigger  biu_book_author before insert or update on book_author
    for each row
    begin     
         if inserting then
              :new.id := sys_guid();
         end if;
         modified_on := sysdate;
         modified_by := nvl(v('APP_USER'),user);
    end;
    /Good luck,
    Tyler

  • Parameter field should pick the values which are there in the value table

    Hi Experts,
    I have a requ. where in a parameter field should pick only the values which are there in the value table for that particular field and should not allow the User to put in any other value.
    The value table is created in the program manually.
    EX:If the value table contains two sales organization VE03 and VE65 then the field shouldn´t allow anyother value other then those two.
    Thanks and Regards,
    Arun

    Try using a listbox.
    report  zrich_0001.
    type-pools: vrm.
    data: ivrm_values type vrm_values.
    data: xvrm_values like line of ivrm_values.
    data: name type vrm_id.
    parameters: p_vkorg(4) type c as listbox visible length 20.
    at selection-screen output.
      name = 'P_VKORG'.
      xvrm_values-key = 'VE03'.
      xvrm_values-text = 'VE03'..
      append xvrm_values to ivrm_values.
      xvrm_values-key = 'VE65'.
      xvrm_values-text = 'VE65'..
      append xvrm_values to ivrm_values.
      call function 'VRM_SET_VALUES'
           exporting
                id     = name
                values = ivrm_values.
    at selection-screen.
      if p_vkorg is initial.
        message e001(00) with 'Please enter a sales org'.
      endif.
    Regards,
    RIch Heilman

  • How to get the screen groups for the screen field which are on selectionscn

    hiiii Experts,
                   How to know the screen groups for the screen field which are on selection screen.
    Thanks and regards,
    kasyap

         NAME                                             PNPABKRS-LOW
            GROUP1                                             SEL
            GROUP2                                             DBS
            GROUP3                                             LOW
            GROUP4                                             180
    to get this use this:
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        if screen-name CS 'ABKRS'.
          BREAK-POINT.
        endif.
      ENDLOOP.

  • How to clear the form fields which are not rendered

    I have a creation form. There is a document_type list set up as a partial triger. When user change the document type, only the filed related to that document type will be rendered. This caused a problem when we need to clear the form . The input in the field which is not render won't be cleared when reset button is pressed. Can anybody give a sugestion on how to handle this?
    I tried to use the following function to clear the fields. It does not work since it get the list value before the list value change and clear the fields after the new field rendered.
    public void clear_action(ValueChangeEvent valueChangeEvent) {
    // Add event code here...
    System.out.println("test1");
    String coutcase = null;
    if(EL.get("#{bindings.Proxy.inputValue}") != null){
    coutcase = EL.get("#{bindings.Proxy.inputValue}").toString();
    System.out.println(coutcase);
    AttributeBinding a11= (AttributeBinding)getBindings().getControlBinding("INT_FNAM");
    AttributeBinding a12 = (AttributeBinding)getBindings().getControlBinding("INT_LNAM");
    AttributeBinding a13 = (AttributeBinding)getBindings().getControlBinding("TIT_PROG");
    AttributeBinding a14 = (AttributeBinding)getBindings().getControlBinding("T_OF_INT");
    AttributeBinding a15 = (AttributeBinding)getBindings().getControlBinding("NETWORK");
    AttributeBinding a16 = (AttributeBinding)getBindings().getControlBinding("IN_DATE");
    AttributeBinding a17 = (AttributeBinding)getBindings().getControlBinding("PE_FNAM");
    AttributeBinding a18 = (AttributeBinding)getBindings().getControlBinding("PE_IN_LNAM");
    AttributeBinding a19 = (AttributeBinding)getBindings().getControlBinding("WEBSITE");
    AttributeBinding a20 = (AttributeBinding)getBindings().getControlBinding("URL");
    AttributeBinding a21 = (AttributeBinding)getBindings().getControlBinding("INT_DATA");
    AttributeBinding a22 = (AttributeBinding)getBindings().getControlBinding("D_ACCESS");
    AttributeBinding a23 = (AttributeBinding)getBindings().getControlBinding("CASE_NUM");
    AttributeBinding a24 = (AttributeBinding)getBindings().getControlBinding("COURT");
    AttributeBinding a25 = (AttributeBinding)getBindings().getControlBinding("PLAIN");
    AttributeBinding a26 = (AttributeBinding)getBindings().getControlBinding("DEFEN");
    if(coutcase.equals("Interview")) {
    a11.setInputValue(null);
    a12.setInputValue(null);
    a13.setInputValue(null);
    a14.setInputValue(null);
    a15.setInputValue(null);
    a16.setInputValue(null);
    a17.setInputValue(null);
    a18.setInputValue(null);
    /*a19.setInputValue(null);
    a20.setInputValue(null);
    a21.setInputValue(null);
    a22.setInputValue(null);
    a23.setInputValue(null);
    a24.setInputValue(null);
    a25.setInputValue(null);
    a26.setInputValue(null);*/
    } else if(coutcase.equals("Internet")){
    /*a11.setInputValue(null);
    a12.setInputValue(null);
    a13.setInputValue(null);
    a14.setInputValue(null);
    a15.setInputValue(null);
    a16.setInputValue(null);
    a17.setInputValue(null);
    a18.setInputValue(null);*/
    a19.setInputValue(null);
    a20.setInputValue(null);
    a21.setInputValue(null);
    a22.setInputValue(null);
    /*a23.setInputValue(null);
    a24.setInputValue(null);
    a25.setInputValue(null);
    a26.setInputValue(null);*/
    } else{
    /*a11.setInputValue(null);
    a12.setInputValue(null);
    a13.setInputValue(null);
    a14.setInputValue(null);
    a15.setInputValue(null);
    a16.setInputValue(null);
    a17.setInputValue(null);
    a18.setInputValue(null);
    a19.setInputValue(null);
    a20.setInputValue(null);
    a21.setInputValue(null);
    a22.setInputValue(null);*/
    a23.setInputValue(null);
    a24.setInputValue(null);
    a25.setInputValue(null);
    a26.setInputValue(null);
    }else{
    System.out.println("coutcase is null");
    }

    Hi,
    The easiest way to modify the screens in the Std transactions using ITS is to modify the ITS templates corresponding to that transaction.
    E.g In you case,there will be a ITS service corresponding to the ESS transaction.This ITS service will have  number of HTML templates which will actually correspond to the diffrent screens in the Trascn.What you need to do is find out the HTML template in the ITS service which corresponds to the screen(which you want to modify) in the STd transacn.To do this ,the easiest way is to right click on that Web page and say VIEW SOURCE.It will show you a HTML code with the ITS service name and the template which is being used for that particular screen.
    So after you find out the correct HTML template to be modified,you can simply hide the fields by putting the HTML code lines in between the symbols
      <!   and  -->
    BR,
    Disha.
    <b>Pls reward points for useful answers.</b>

  • Query Builder recognizing primary/foreign key

    Is there a way to have Query Builder recogninze the primary/foreign keys of the tables when they are selected? Right now it looks like you have to manually join the tables together by selected the column(s) to join.
    Thanks

    You can define a query key[1] 'planId' on InvestmentOption for the PLAN_OID column. That'll let you write an expression like the one below which does not produce a join. The nice part about the query key is that it does not require you to add attributes to your object in order to query o them.
    Expression plan = new ExpressionBuilder();
    Expression where = plan.get("planId").equal(somePlanId);--Shaun
    [1] http://www.oracle.com/technology/products/ias/toplink/doc/10131/main/_html/descfg010.htm#sthref3039

  • Enable foreign key for a custom field?

    Hi,
    In my mater table I have a custom field (lumpsum) which has been declared in pa0001 (as a include structure). The same structure has the description for this field.
    My requirement is to assign foreign key for this field to make use of joins in my table view. As this field was into a custom structure of PA0001, I couldnu2019t able to foreign key for this field.
    Please help it
    Regards,
    Vijay

    Hi Vijay,
    Sice it is designed for value check, a foreigh key refers to a TABLE.
    Regards,
    Laurent

  • PT60 the field Personnel Area( PERSA ) of the authorization object P_ORGIN

    Hi,
    When running transaction PT60 the field Personnel Area( PERSA ) of the authorization object P_ORGIN is not checked.
    I have run SU24 ,the objects are there with chech indicator of authorization object = "CHECK".
    What can I do about it ? Is there any note to fix this ?
    thanks!
    Olivia Yang

    Hi,
    In object P_ORGIN what you need to check for authorisation is it on Personnel area or PSA.Actually we have org.key for authorisation which is define in P_ORGIN.If you can define org. key as PA/PSA/EG/ESG you can check the authorisation for specific users.
    Regards,
    Snita

  • How to create a foreign key for the table from two different tables?

    Hi All,
    I have a three table like below. In the below table SAMPLE_CONS_CHECK and SAMPLE_CONS2_CHECK will be having the primary key for NAME column. The same SAMPLE_CONS3_CHECK table also having the primary key for NAME column and forieign key for SAMPLE_CONS_CHECK and SAMPLE_CONS2_CHECK tables. See the below code 2
    code 1:
    CREATE TABLE SAMPLE_CONS_CHECK
            (NAME VARCHAR2(10),
            SERIES  VARCHAR2(5)
    CREATE TABLE SAMPLE_CONS2_CHECK
            (NAME  VARCHAR2(5),
             MODEL  NUMBER
    CREATE TABLE SAMPLE_CONS3_CHECK
            (NAME  VARCHAR2(5),
             MODEL_NO  NUMBER
            )code 2
    alter table SAMPLE_CONS_CHECK
    add constraint SAMPLE_CONS_CHECK_pk primary key (NAME)
    alter table SAMPLE_CONS2_CHECK
    add constraint SAMPLE_CONS2_CHECK_pk primary key (NAME)
    alter table SAMPLE_CONS3_CHECK
    add constraint SAMPLE_CONS3_CHECK_pk primary key (NAME)
    ALTER TABLE SAMPLE_CONS3_CHECK ADD
    CONSTRAINT SAMPLE_CONS3_CHECK_FK1 FOREIGN KEY
         NAME
    ) REFERENCES SAMPLE_CONS_CHECK
        NAME
    ) ON DELETE CASCADE;
    ALTER TABLE SAMPLE_CONS3_CHECK ADD
    CONSTRAINT SAMPLE_CONS3_CHECK_FK2 FOREIGN KEY
         NAME
    ) REFERENCES SAMPLE_CONS2_CHECK
        NAME
    ) ON DELETE CASCADE;From the above schenario i am able to insert the data to SAMPLE_CONS3_CHECK table. But the parent data is already available in the parent table. The problem is here two different constarints from two different tables. While inserting, it is checking from both the tables whether the parent is exist or not.
    How can i solve this problem? Can anyone halp me about this?
    Thanks
    Edited by: orasuriya on Aug 8, 2009 2:02 AM

    Actually the design is completely incorrect.
    What you say is
    I have
    'foo', 'foo series'
    'foo','foo model'
    'foo',666
    By virtue of table3 referring to both table1 and table2.
    This means you actually need to have 1 (one) table:
    'foo','foo series','foo model', 666
    And the 'problem' disappears.
    Sybrand Bakker
    Senior Oracle DBA

  • Not to display the document which are not due at the time of making the pay

    Hi,
    My user dont want to display the document which are not in due at the time of making the payment through F-53.
    For example:
    Vendor Code: 1001 has the open item as below:
    Due Date - 29.09.2009 Amount 50000
    Due Date - 30.09.2009 Amount 10000
    Due Date - 15.10.2009 Amount 40000 (due date is in future)
    Now my user want to make the payment for the above vendor through T-Code: F-53 / F-58, while clicking the process Open item the syste, shows all the document (which inclues the future due date document).
    My user dont want to display the document which is in future due date because by wrongly he should not make the payment for the future due dated document.
    Kindly provide me the solution how to disable the document which are not in due.
    Regards
    JS

    Hi,
    You can try the following -
    Execute transaction code O7F4, and maintain the field FAEDT. Then execute F-53 and check if the option to enter net due date appears in the additional selection or not.
    Please revert.
    Thanks and Regards,
    Anit

  • ABAP question: define a custom foreign key for a standard field??

    Hi,
    I want to use the field ADDR1_DATA-STR_SUPPL3 for customer use. I must to define a foreign key against a Ztable (as verification table) for this standard field. Also I must to define a custom search help.
    To defining a foreign key for this field, I must be in change mode, so the system ask to me for registering the object. That means this action is a modification. My question is the following: is there any way to do so without SAP standar modification??
    For instance, using BDT events...but how?
    Thanks in advance.
    Regards,
    Rosa

    Hi Rosa,
    Changing SAP Standard dictionary elements is not possible with out changing the same. To change these elements, we dont have any other method apart from SAP standard modification.
    Cheers
    Pavan

  • I have reinstalled my OS without time machine (using the disc). I want to restore some pictures in the iPhotos which are already in the time machine i was using previously. How can I restore iPhoto from previous time machine?

    My mac book was incredibly slow. When I went to Mac store, they asked me to reinstall the OS with CD and not with the time machine. I reinstalled the operating system. But when I opened the applications, all those started as fresh applications as usual. I have the backup of all other data in another hard disc. But unfortunately, I forgot to copy the photos before reinstallation. I have those photos in my time machine back up. But when I opened time machine, it started like a fresh (very new) time machine and it started backing up my present OS (the reinstalled one). I cannot open the previous time machine, which is in the same hard drive. I wish to open the previous time machine to get the photos which are backed up previuosly. When opened the time machine disc (manually by clicking the icon), i can see all the thigs which I had previously in my macbook. But unfortunately, i cannot access those through time machine! Can anybody help me please?

    How to redownload purchased apps from the App Store

Maybe you are looking for

  • Item text in Purchase Order getting updated with info. record Purchase Order Text

    Hello All, I am working in a roll out project and facing issue in text repeating twice for the line item in the Purchase Order for the new company code for which rollout is happening Issue: Item text in Purchase Order getting updated with info. recor

  • Send Button is gone from new message toolbar

    I was forwarding a mail message and when I went to "send" it, there was no send button to select. I think thhe default mailbox might have been my defunct .mac address. I toggled the correct email account and still no send button. I rebooted, nothing.

  • Account determination and acc.payable and receivable

    Hi All, Can anyone give me step by step configuration of Account determination and Accounts payable and account receivable? Thanks, Murali.

  • Error data file missing

    I received an error that a data file was missing when closing Adobe Captivate 4. Now I have lost some of my cpt files. How can I recover the se files Can I recover these files from the .swf files. Desperate help needed please.

  • Can't create shared quicktimes from my iMovie file...Any ideas?

    This just started. I've just finished a project and wanted to create a compressed QT for emailing. I went through the 'share' process + got a message that the "disk was locked or full". It wouldn't compress to any format. Up until now it had been wor