Table 1 column?

Does make sense to always have a table 1 column? Here's my problem:

I have a table of reference: code_desc (id, description, language_cd).

The id column is used in many places in the application and I would like to place a foreign key. But the problem with table of code_desc, is that it has a composite primary key (id, language_cd) for internationalization, id is not unique.

I was contemplating using a surrogate but key using a surrogate key instead of the cd too many tables. Is there another solution to this?

Rinne says:
I think that I tried to simplify too much and ends up being more confused. I only need one type of description. For example, a product table has many products and related description.

The product code, product description
AB3S, 'bed '.

No doubt the entity 'PRODUCT' has other correct attributes (product type, category, etc.)? I think also he 'modified' and 'created' columns of audit as well. I think that the example I provided can work in your situation very well.

Tags: Database

Similar Questions

  • How can I get a name of table 1, column A, if column B is a negative number and insert the names of table 2?

    How can I get a name of table 1, column A, if column B is a negative number and insert the names of table 2?

    What is the formula?

    You can do this with a column of "index" in table 1, as this assistance:

    The formula in C2, filled to the bottom:

    IF (B =<>

    That increments a counter each time that it finds a negative number in column B.

    In the second table, you can retrieve a list of negative values in this way:

    The formula in A2, filled to the bottom:

    = INDEX (array 1::A, CORRESPONDENCE (LINE (−1, Table 1::C), 0))

    It takes the line number, the formula is activated, subtracts 1 to the header line and look up the result in the column of table 1 C.  If it finds a match, it feeds the line number to the INDEX page with retrieves the value of the column of table 1A.

    To hide the red triangles of signage wrap the IFERROR formula, like this:

    = SIERREUR (INDEX (table 1::A, CORRESPONDENCE (LINE (−1, Table 1::C), 0)),"")

    Of course, you can also simply filter on column B without the need to set up a column from another table or index.

    SG

  • Invalid procedure after alter table add &lt; column &gt;

    Hello Experts,

    I was faced with a situation where I add a column in a table that is used in a procedure, immediately after the addition of the new procedure associated with this table column becomes invalid.

    Can someone explain please know why this happens.

    Database version:-11.2.0.4.

    I was faced with a situation where I add a column in a table that is used in a procedure, immediately after the addition of the new procedure associated with this table column becomes invalid.

    Can someone explain please know why this happens.

    Yes - the Oracle documentation explains this. I found this doc with a simple search of "column, add the oracle 11g invalid procedure.

    http://docs.Oracle.com/CD/B28359_01/server.111/b28318/dependencies.htm#CHDJIIFC

    Table 6-2 , shows how objects are affected by changes to other objects upon which they depend.

    Table 6-2 operations affects this object status

    Operation Where the status of dependent objects

    ALTERTABLEtableADDcolumn

    INVALIDWhen:

    • Uses of the object (except a view)-dependent SELECT * on table .
    • Dependent object uses table %rowtype .
    • Dependent object performs INSERT on table without specifying a list of columns.
    • Dependent object references table in the query that contains a join in SQL.
    • Dependent object references table in the query that refers to a PL/SQL variable.

    Otherwise, no change.

    Read the WHOLE ARTICLE and see if it does not have to explain your problem.

  • alter table drop column

    Hi all

    I create a simple table like this:

    create table x (a number, b varchar2 (20));

    ALTER table x modify a primary key constraint a_pk;

    insert into x values (1, 'first row');

    insert into x values (2, 'second row');

    commit;

    Then:

    SQL > select * from x;

    A AND B

    ---------- --------------------

    1 first row

    2 second row

    Then I run these commands:

    SQL > alter table drop column x.

    Modified table.

    SQL > select * from x;

    B

    --------------------

    first row

    second row

    Question: Why am I able to remove this column when a PRIMARY KEY for the table? I do not use the key words of CONSTRAINT CASCADE with the DROP COLUMN clause...

    I have Mr. Steve O'Hearn here saying this in his book 'Certified Expert Guide exam 1Z0-047:

    CREATE TABLE ORDER_RETURNS

    (NUMBER OF ORDER_RETURN_ID,

    NUMBER OF CRUISE_ORDER_ID

    DATE OF CRUISE_ORDER_DATE,

    CONSTRAINT PK_OR PRIMARY KEY (ORDER_RETURN_ID));

    .. We can not remove the column the table ORDER_RETURNS that

    is subject to the constraint PRIMARY KEY (ORDER_RETURN_ID)... The reasons are:

    ORDER_RETURN_ID is the PRIMARY KEY of this table...

    Isn't this correct?

    No - it's NOT correct - the book is bad.

    You could have just tested the FULL example in the book to verify that the statement is wrong.

    http://weirdoootamee.yolasite.com/resources/Oracle%20sql%20expert.PDF

    See page 432

    CREATE TABLE CRUISE_ORDERS
    (NUMBER OF CRUISE_ORDER_ID,
    ORDER_DATE DATE,
    PK_CO (CRUISE_ORDER_ID, ORDER_DATE) PRIMARY KEY CONSTRAINT);

    CREATE TABLE ORDER_RETURNS
    (NUMBER OF ORDER_RETURN_ID,
    NUMBER OF CRUISE_ORDER_ID
    DATE OF CRUISE_ORDER_DATE,
    CONSTRAINT PK_OR PRIMARY KEY (ORDER_RETURN_ID).
    FOREIGN KEY CONSTRAINT FK_OR_CO
    (CRUISE_ORDER_ID, CRUISE_ORDER_DATE)
    REFERENCES CRUISE_ORDERS (CRUISE_ORDER_ID, ORDER_DATE));

    create two tables - add data, if you want.

    Then try to delete the primary key column and see what happends

    ALTER table drop column order_return_id order_returns;

    The best way to learn is to actuall TRY of THINGS.

    Try it with your own table, but the FIRST thing that you should try was the real example of the book.

  • In what table Operating_unit column present in purchase orders modulle

    In what table Operating_unit column is in purchase modulle. Explain to me how to find?

    Thanks in advance.

    Kind regards
    Raja

    Hi Uvaraja,

    looking for the name of "operational unity"?

    In PO_HEADERS_ALL and PO_LINES_ALL he stored with the name column "ORG_ID. You can use the HR_OPERATING_UNIT table to take the name of "OPERATING_UNIT" using link below

    "PO_HEADERS_ALL.ORG_ID = HR_OPERATING_UNIT.ORGANIZATION_ID".

    Thank you

  • Comment of tables and columns are included in the Data Modeler

    Hi all
    I used Oracle SQL Developer Data Modeler (Version 3.0.0.665) and created a data model for my project. I sent an email a PDF version of the data model to our systems analyst. She asked if I could re - create the data model and include table and column comments. Is this possible and if so how this work is it?

    Thank you for your comments,

    Seyed

    Seyed salvation,

    I used the Data Modeler and create a report. The report included 36 .csv files

    What is the purpose of this 'report' task, because 36 files csv does not sound like report to me. Watch "files > reports" feature - you can generate reports for your model. -for any model, single table or tables belonging to specific subview. The report of the complete table contains additional details, so if you need these comments, then only you can create a template and select column comments appear only. So some general information table will be also included.

    Philippe

  • data in multiple tables and columns

    Hello

    How to find if multiple tables are containing the same data?
    Text of the 'Apple' is in three different tables and under three different column names.
    Expected result
     
    fruits_one
    fruits_two 
    fruits_three
    Select name, quantity from fruits_one;
    Apple   1
    Orange  1
    Pear    1
    
    
    select flavour, desc from fruits_two;
    Red,   Apple 
    Blue, Berry
    
    select order,date,details  from fruits_three;
    101  11/11/2011    Grapes
    102  12/01/2010    Apple
    Thank you
    Sandy
    SQL> create table fruits_one (name varchar2(100), quantity number);
    
    Table created.
    
    SQL> insert into fruits_one
      2  select 'Apple'  name, 1 quantity from dual union all
      3  select 'orange'  name, 1 quantity from dual; 
    
    2 rows created.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> create table fruits_two (flavour varchar2(100), des varchar2(100));
    
    Table created.
    
    SQL> insert into fruits_two
      2  select 'Red' flavour,   'Apple' des  from dual union all
      3  select 'blue' , 'berry'  from dual ;
    
    2 rows created.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> set serveroutput on
    SQL> declare
      2  l_search varchar2(10) := 'APPLE';
      3  l_cnt number := 0;
      4  begin
      5
      6  for x in (select column_name, data_type, table_name from user_tab_cols where data_type in ('VAR
    CHAR2'))
      7  loop
      8
      9    execute immediate  'select count(*) from "' || x.table_name ||'" where upper("' || x.column_n
    ame || '") like ''%' || l_search || '%''' into l_cnt;
     10
     11    if l_cnt > 0  then
     12    dbms_output.put_line('table = "' || x.table_name ||'", column = "' || x.column_name ||'"');
     13    end if;
     14
     15  end loop;
     16
     17  end;
     18  /
    table = "FRUITS_ONE", column = "NAME"
    table = "FRUITS_TWO", column = "DES"
    
    PL/SQL procedure successfully completed.
    
    SQL> 
    
  • Estimating redo size of alter table DROP COLUMNS CONTINUE checkpoint of 10000

    Hello
    in my 10.2.0.3, I've got table size 90 GB suffering:
    ORA-12986: columns in partially suspended state. Propose to ALTER TABLE DROP COLUMNS CONTINUE
    I need to know how to estimate the size of redo of the:
    change the control of MORE of COLUMNS DROP table 10000 point.
    Is 2 x good estimate of table size?
    Kind regards.
    Greg

    GregG says:
    Please clarify for me how are distinguished between nitrifiants delay block trial and lower real column continue the process.
    Looks like DBC process will increment statistics such as:

    drain plug - number of calls ktugct
    gullies only - consistent read gets

    It's a good indicator, even if I think the specific statistics could be:

        commit txn count during cleanout
    

    I think it's one that tells you that you have made a change of "validation of transaction" to a block.

    I don't know why the CBD process is such redo intensive, is not on the update of ITL bit in db blocks only?

    It updates the inputs ITL and lock bytes, and it takes only entry of redo block; the overload of the roll forward database is in the tens of bytes is small compared to the 240 bytes per row of the column to fall - but if you have a large number of blocks to go before continue it really starts to have an effect, you might be fooled.

    WARNING - I haven't checked to see if delay block drain plug behaves (or even happens) on Delete column in the way that it would perform a simple update in bulk.

    Concerning
    Jonathan Lewis

  • Find the key referenced foreign Table and column

    Can someone please refresh my memory?

    How can I determine which table and column refers to a foreign key?

    For example, with select * from ALL_constraints WHERE TABLE_NAME = 'my_table '; I can see forced CONSTRAINTA_FK and CONSTRAINTB_FK I guess reference another table and column because CONSTRAINT_TYPE = "R", but it isn't that I get. "

    I would get all the way to the referenced table and the column I just don't remember how.

    Thank you

    Lou

    Hello

    Example:

    Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
    Connected as hr
    
    SQL>
    SQL> SELECT UC.TABLE_NAME,
      2         UC.R_CONSTRAINT_NAME,
      3         UCC.TABLE_NAME,
      4         UCC.COLUMN_NAME
      5    FROM USER_CONSTRAINTS  UC,
      6         USER_CONS_COLUMNS UCC
      7   WHERE UC.R_CONSTRAINT_NAME = UCC.CONSTRAINT_NAME
      8     AND uc.constraint_type = 'R'
      9   ORDER BY UC.TABLE_NAME,
     10            UC.R_CONSTRAINT_NAME,
     11            UCC.TABLE_NAME,
     12            UCC.COLUMN_NAME;
    
    TABLE_NAME                     R_CONSTRAINT_NAME              TABLE_NAME                     COLUMN_NAME
    ------------------------------ ------------------------------ ------------------------------ --------------------------------------------------------------------------------
    COUNTRIES                      REG_ID_PK                      REGIONS                        REGION_ID
    DEPARTMENTS                    EMP_EMP_ID_PK                  EMPLOYEES                      EMPLOYEE_ID
    DEPARTMENTS                    LOC_ID_PK                      LOCATIONS                      LOCATION_ID
    EMPLOYEES                      DEPT_ID_PK                     DEPARTMENTS                    DEPARTMENT_ID
    EMPLOYEES                      EMP_EMP_ID_PK                  EMPLOYEES                      EMPLOYEE_ID
    EMPLOYEES                      JOB_ID_PK                      JOBS                           JOB_ID
    JOB_HISTORY                    DEPT_ID_PK                     DEPARTMENTS                    DEPARTMENT_ID
    JOB_HISTORY                    EMP_EMP_ID_PK                  EMPLOYEES                      EMPLOYEE_ID
    JOB_HISTORY                    JOB_ID_PK                      JOBS                           JOB_ID
    LOCATIONS                      COUNTRY_C_ID_PK                COUNTRIES                      COUNTRY_ID
    TEMP_LEAVE                     PK_CLIENT                      CLIENT                         CLIEND_ID
    VISITORS                       SYS_C004169                    GROUPS                         GROUPID
    VLANGS                         SYS_C004170                    VISITORS                       VISITORID
    
    13 rows selected
    
    SQL> 
    

    In the output:

    TABLE_NAME                     R_CONSTRAINT_NAME              TABLE_NAME                     COLUMN_NAME
    ------------------------------ ------------------------------ ------------------------------ --------------------------------------------------------------------------------
    COUNTRIES                      REG_ID_PK                      REGIONS                        REGION_ID
    

    means that a COUNTRY table has a foreing key called REG_ID_PK that points to an array of AREAS. REGION_ID
    Kind regards

    Published by: Walter Fernández on March 4, 2009 23:26 - adding explanation...

  • Customize the table (first column and the first row)

    Hello everyone, I have a question: How can I insert words and numbers in the same table?

    I have create a VI that measure the temperature with an external instrument and put the data into a table, which is saved.

    Each line is a Thermocouple and each column is a measure, but there are only numbers!
    I would have the first column with the name of the channel and line of fist with the name of the measure.

    I had create an excel for example to explain my wish (Cattura.PNG).

    Thanks to all who help me

    You can insert headers required as column and row to convert it to an array of strings, as in the image below.

  • Rename tables and columns in sql running that accessing these columns in the table.

    Hello

    Using oracle 11.2.0.3

    We want to rename columns, tables and work just a sql scripts for this.

    If sqls who have access to those running long tables/columns for example reports what is happening

    Existing sql running, will work perfectly in that picked up sql before table/colum rename or will they crash if tables/columns renamed during them.

    scripts wil take a few seconds to run maximum

    Thank you

    The only other activity that would go on select is against these tables/columns. No etl isnert/update/delete etc wil, which happened during the name change.

    Only possible activities are report instructions srunning select.

    Tried to run a long selection and rename that select while that was going on and got no error on the test system.

    This is because certain statements does not place locks on tables or lines, so even if a session is reading data, another session can make some ddl (or dml) manipulation.

    In this situation (with only selects, no other dml queries), renaming can be done, but the question remains, what the application code?

    If it refers to old column names after name change operation, is no good.

  • [OBIEE 11 g] Create customized to group columns in a table view column header

    Hello world

    I got a requirement to group certain columns in the table view with a custom column header name (for example to create a two-level header).

    The layout I have now:

    [Jan]     [February]     [Mar]     [Apr]     [May]     [June]     [Jul]     [August]     [Total sales]

    -----------------------------------------------------------------------------------------------------------------------

    1          2          3            4          5           6           7          8           36

    The layout I want to achieve:

    [                  Q1                    ] [                   Q2                   ]    

    [Jan]     [February]     [Mar]     [Apr]     [May]     [June]     [Jul]     [August]     [Total sales]

    -----------------------------------------------------------------------------------------------------------------------

    1          2          3            4          5           6           7          8           36

    I use Table View, is it possible to get the above provision? Any comments appreciated. Thank you.

    See you soon,.

    Kayip

    Hello

    It is a simple parameter, it is unpacking already...

    The property "of the topic folder" of your columns allows you to enter the required text.

    PS: Do you really have columns in your field with the name of the month? Is it not something better managed with a hierarchy of real time and using a pivot to display the month columns? In this case the grouping of quarters is already there...

  • To get the name of the table the column

    Hi I have an Html5 app, and I get the dataset from the database and bind the data based on the column name. but the answer of the oracle db column names as attr_1, attr_2 and so on. Here is the code and the result after execution.

    create or replace PACKAGE SAYAM
    IS
           CURSOR cur
           IS
                  SELECT CAST(0 AS NUMBER(5, 0)) "COMPID" ,
                         CAST(0 AS NUMBER(4, 0)) "FINYEARID" ,
                         EMPLOYEEID,
                         CAST(0 AS NUMBER(5, 0))"MENUID" ,
                         CAST('' AS NVARCHAR2(10))"CALLBYPANEL",
                         EmployeeName
                  FROM  EmployeeInfo;
                 
    Type cur_tbl
    IS
           TABLE OF cur%rowtype;
          
    END SAYAM;
    
    

    DECLARE
           v_GlobalParam Xmltype:=Xmltype(
           '<QueryParam> 
    <CompID>1</CompID> 
    <FinYearID>1</FinYearID> 
    <MenuID>0</MenuID> 
    <EmployeeID>-1</EmployeeID> 
    <CallByPanel>APPWEB</CallByPanel>
    <EmployeeName>Ranjit</EmployeeName>
    </QueryParam>'
           );
           tableglobal SAYAM.cur_tbl;
           rc sys_refcursor;
    BEGIN
           SELECT XT.CompID,
                  XT.FinYearID,
                  XT.MenuID,
                  XT.EmployeeID,
                  XT.CallByPanel,
                  XT.EmployeName bulk collect
           INTO   tableglobal
           FROM   XMLTABLE('/QueryParam' PASSING v_GlobalParam COLUMNS
                  CompID NUMBER(5) PATH 'CompID' ,
                  FinYearID NUMBER(4) PATH 'FinYearID' ,
                  MenuID NUMBER(5) PATH 'MenuID' ,
                  EmployeeID NUMBER(5) PATH 'EmployeeID' ,
                  CallByPanel VARCHAR2(10) PATH 'CallByPanel',
                  EmployeeName Varchar2(200) Path 'EmployeeName' ) XT;
           OPEN rc FOR SELECT * FROM TABLE(tableglobal);
           SYS.DBMS_SQL.RETURN_RESULT(rc);
    END;
    
    
    

    Now, I get the below result-

    Capture.PNG

    but the goal that is required is as below with the valid column name

    Capture.PNG

    Please let me know if there is any action to get the column names.

    Thanks in advance.

    Apologies - I have managed to reproduce the original problem in 12.1.0.2.

    The problem with ATTR column names is that you use a local collection declared in a package.

    You need a SQL type.

    But does not change my position when it comes to a sensible direction to go.

    SQL> l
      1  create or replace type sayam_obj as object
      2  (compid      number(5,0)
      3  ,finyearid    number(4,0)
      4  ,employeeid  number
      5  ,menuid      number(5,0)
      6  ,callbypanel  nvarchar2(10)
      7* ,employeename varchar2(100));
    SQL> /
    
    Type created.
    
    SQL> create or replace type sayam_tbl as table of sayam_obj;
      2  /
    
    Type created.
    
    SQL> get test3.sql
      1    DECLARE
      2        v_GlobalParam Xmltype:=Xmltype(
      3        '
      4    1
      5    1
      6    0
      7    -1
      8    APPWEB
      9    Ranjit
    10    '
    11        );
    12        tableglobal sayam_tbl := sayam_tbl();
    13        rc sys_refcursor;
    14    BEGIN
    15        SELECT sayam_obj(XT.CompID,
    16              XT.FinYearID,
    17              XT.MenuID,
    18              XT.EmployeeID,
    19              XT.CallByPanel,
    20              XT.EmployeeName) bulk collect
    21        INTO  tableglobal
    22        FROM  XMLTABLE('/QueryParam' PASSING v_GlobalParam COLUMNS
    23              CompID NUMBER(5) PATH 'CompID' ,
    24              FinYearID NUMBER(4) PATH 'FinYearID' ,
    25              MenuID NUMBER(5) PATH 'MenuID' ,
    26              EmployeeID NUMBER(5) PATH 'EmployeeID' ,
    27              CallByPanel VARCHAR2(10) PATH 'CallByPanel',
    28              EmployeeName Varchar2(200) Path 'EmployeeName' ) XT;
    29        OPEN rc FOR SELECT * FROM TABLE(tableglobal);
    30        SYS.DBMS_SQL.RETURN_RESULT(rc);
    31*    END;
    SQL> @test3.sql
    
    PL/SQL procedure successfully completed.
    
    ResultSet #1
    
        COMPID  FINYEARID EMPLOYEEID    MENUID CALLBYPANE
    ---------- ---------- ---------- ---------- ----------
    EMPLOYEENAME
    --------------------------------------------------------------------------------
        1        1          0    -1 APPWEB
    Ranjit
    
  • AF:table duplicated columns

    We have a scenario in our application that duplicates the af:table columns (and data) on the same af:table.

    We use the ADF 12.1.2 and 12.1.3. It occurs in both.

    Here, we start with our original table.

    2014-08-04_082747.png

    When we sail to the other taskflows taskflow duplicates of table, columns, and data.

    2014-08-04_083202.png

    I went through debugging and did not notice anything that stand out. Has anyone seen this problem before?

    Curiously, this is due to the:

    binding="#{ServiceRequest.srTable}"
    

    I removed the link and it worked fine. In order to get my selectionLisetener to work

    selectionListener="#{ServiceRequest.SrSelectionListener}"
    

    I modified the method to extract data from getRow() my iterator instead of the getSelectedRowData() of richeTableau.

    Thus, it seems to work very well without any problem now. Thanks to you two to offer suggestions.

  • Alias table and column aliases

    I'm new to the discoverer. I have some confusion.


    1. If it is possible use different aliases for the same table during the creation of spreadsheet?

    Need to produce different joins.

    for example:

    SELECT C1. Name, C2. Remarks

    CLIENTS C1,.

    C2 customers,

    Ticket T,

    Sale S

    WHERE C1. Client_Id = T.Client_Id AND C2. Client_Id = S.Client_Id

    2. How can I use the Alias column to show as a custom in the worksheet column heading?

    for example:

    SELECT Client_Default_Name AS name OF customers


    Thanks in advance.

    Hello

    first question:

    the sql worksheet is always structured according to the EUL (the end user layer). If you have used two customer tables and created a join of tables then the sql is generated according to your requirement. There is no way we can have discoverer create a sql like this. If you are interested with the sql. You can create a custom in the business district folder and paste the sql code and create a report on the top of the custom folder.

    second question:

    You can always change the topic in the discoverer more filing cabinets according to your requriement

    hope this helps

    -N.S.

Maybe you are looking for

  • HP Officejet Pro 8000 Wireless: Download for Officejet Pro 8000 Wireless printer driver

    I've been looking for a printer driver download for my HP Officejet Pro 8000 Wireless printer, but unable to find one and the web page keeps just leading me in circles.  I'm under IE 9.0 and Windows 7 Professional.  Could you give a link to download

  • 3 installs without permission

    WIN XP SP3 - black month not yet installed Tuesday. 32 - bit Running Essentials dry with the Windows Firewall.  All traces of previously installed AV etc removed with suitable tools and advice of experts registry entries. All auto updates inform only

  • Installation help for risk.

    I have a very quiet ride. Once was connected to a network / I cleaned it. My version is Home Edition XP SP1. I'm waiting on the new cable network and I hope to have access to the internet. I would probably be invited to update my SP1 - here lies the

  • When you perform a scan of System Mechanic, showing "your system (C) drive a 152 009 misaligned files (30,26 GB)".

    I have a 64 bit HP with a Western Digital drive.  I am running Windows 7 and using the technologies of Iolo System Mechanic 10.5.  When you run the deep analysis SM 10.5 I am constantly getting a report that "your system (C) drive has 152 009 misalig

  • The reorganization of elements [moving] in a folder

    Example... "' My photos '. In all previous versions of windows, I was able to slide and mix files and images in their respective folders. Now on windows 7 I drag a picture to a new position within its folder and it bounces just where he was. Whats up