primary key for the table

I have a Gr_order table that was settled long ago, and now he needs to be filled
with some more search data.

"Orderid" is a primary key for the table, but the question is how can I insert "orderid" in the insert statement in the procedure. I couldn't find any name sequence. There are 1230
documents that must be inserted.
Desc Gr_order
Orderid  Number Primary key
Desc     Varchar2
INSERT INTO gr_order (orderid,desc)  
VALUES (???, upper(each_pom.desc);
Thank you
Sandy

You can find the code that inserts into the table and see if it uses the sequence ;-). A sequence is not 'attached' to a particular table - this is the insert statement to determine whether a sequence should be used.

You can check if the table has a trigger - some developers like to emulate the behavior of MS - sql server by having a trigger on the table that selects in a sequence. If it has such a release, then you just do your insertions without specifying order_id. But if the table does not have such a release, then you cannot know if the table was originally filled using a sequence or not (unless you can find the instructions for inserting somewhere).

Tags: Database

Similar Questions

  • Primary key for the Table is

    Hello guys,.

    I have a question about the primary key in my fact table. In my fact table, the primary key is a combination of 3 different columns, 2 columns are primary keys in dimension tables 2 diff. Is it normal to have a primary key in a table of facts, which is a combination of 3 different columns. If yes then when us will be important to the OBI tool only 3 columns Phy layer appears as the PK. should I do the other 2 columns as the PK in the physical layer of the OBI tool or can I leave it as it is. Please let me know

    Thank you.

    I did as you asked me to. Can you let me also know what will happen if I do only a single key as PK and let them other 2 touch as it is. This will affect performance in > is it possible or will I get incorrect values?

    No, this will not affect anything, in any case explicitly will give you joined him again in the physical layer.
    But it is advisable to show the key columns in the physical layer of the RPD.

    Thank you
    Vino

  • How to add the primary key for the table with the existing data?

    The table is already busy data. There was no primary key before, so for each column, there are some duplicate values.

    I want to add a new column, which should be of the integer data type and can automatically incremented, from 001. I tried with Oracle SQL Developer, but it says "ORA-01758: table must be empty to add mandatory (NOT NULL) column. How can I do? Thank you!

    Hello

    Look for the [ALTER TABLE | http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_3001.htm#sthref4803] command to find out how to add a column (step (1)) and a (step (3)) constraint to an existing table.

    For the step (2):

    CREATE SEQUENCE  employee_id_seq
    START WITH  1
    ;
    
    UPDATE  employee
    SET     id  = employee_id_seq.NEXTVAL;
    

    When you create a sequence, START WITH 1 is the default value, so that the line is not really necessary above... I've included just to show how you could start with any number you have chosen.

  • a key for the table does not exist in the table

    Hi guys,.

    I imported several tables of physical layer in the administration tool. So, I want to do new foreign key between tables join in the physical schema.
    Required fields for posting a link between these tables are set up. When I press the ok button, an error message is displayed:
    "a key corresponding to the table does not exist in the table blablabla. You want to create a? »

    In fact, what is this error? I don't have all the idea about it. The number of the type of the fields is the same, the names are also the same. I think that he should not have problems to make the new foreign key. But why is it happening?

    Thank you

    Hello

    It is the primary key of the first table. You might not have set this column as the primary key of this table at the level of the db.

    Thank you
    Imtiaz.

  • How to define a Composite primary key for a Table

    Hello

    I'm basically more in Java programming, with little knowledge of Oracle bit as DataBase .so please sorry for my silly doubts.

    Can someone tell me please how to define a Composite primary key on a Table.

    Thanks in advance.

    Published by: user672373773 on 25 Sep, 2009 08:54

    Please go through these links:

    http://plsqlworld.blogspot.com/2009/01/oracleplsql-composite-primary-key.html

    http://sqlzoo.NET/HOWTO/source/z.dir/tip241027/Oracle

    Concerning
    Asif Kabir

    -Mark the response as correct/good

  • primary key for a table with only 1 column

    I create a temporary table in my procedure and there is only a single column in it. I'll eventually use this temporary table in a join. Does make sense to create a primary key for this temporary table? It will make my join run faster? In other words, oracle automatically sorts and keeps the table column is the fact that if a primary key or index is created? I use 10g - 10.2.0.3.0
    The data table is not indexed.

    Oracle will probably make a hash join.

    Have you tried just current execution Plan for your query to explain?

    Hemant K Collette
    http://hemantoracledba.blogspot.com

  • Great advice table no primary key on the table.

    Dear gurus,

    Version: Oracle 11.2.0.3.0 running on Linux HAVE 6.

    I have a big standard table (400 million lines) which is a data dump, it was created with no primary key Yes crazy but it happens (very rare).  I have a few key columns indexed for the purpose of the motion, but I would like to know what are the options I have different indexing on a table to make it more efficient for running a query against it.

    Looking for simple opinion where further research.  I won't not give an example of the table structure - neither include the details, I'm looking for advice.

    Easy points for everyone.

    Thank you.

    Content

  • Change of primary key on the Table clears the other columns

    Preliminary info/Installation
    JDeveloper 11 g 11.1.1.6.0
    We have a table (object view or entity) that has 8 columns. The primary key is composed of 4 1 columns.
    The table is displayed in a page fragment.
    2 of the 4 non-primary key columns are LOV.
    All the 8 columns are needed.
    The table is editable including 2 of primary key columns.

    Question
    Assume that the table displays the 3 lines. If we change a rank 1 non-primary key column and a primary key in row 2 column, everything works well when we are committed to the database
    If, however, we first change a primary key column, then a primary key on a different line column, then the column/row primary key that changed us first, gets annihilated and the other columns LOV on this same line. The 2 columns that are not LOV keep data as it should. We then get a validation error because the required data are not present. All this happens before we try all commit to the database. If debug us and look the iterator, it has the old data in this document, before and after any performance on the binding.
    If we look at and update the data via the App Module, everything works well. We have tried to update the view, etc. through valueChangeListener also with no luck.

    If you change the primary key value, it should not be the primary key.

    This is true in the design of database relational regardless of how access you the data. In addition, EO don't like if you change the primary key value.

    Have you considered adding a surrogate key (use a sequence) and make your PK course a unique key?

    John

  • Primary key for the case in (NVARCHAR2 datatype) in Oracle 10 g

    I have primary keys in my database which are of type NVARCHAR2. By default, the data is inserted in these columns as case sensitive, which means the insertion of these two 'ABCD' and 'Abcd' is allowed.

    Can I change the settings in Oracle so that primary keys are working in sensitive cases? I tried Oracle to raise an error if someone is inserting "Abcd" and if there is already a record with primary key 'ABCD '.

    Note: I use Entity Framework.

    The simplest approach is probably to create a unique index on the UPPER (your_key) function, i.e.

    CREATE UNIQUE INDEX case_insensitive
        ON table_name ( UPPER( key_column_name ) );
    

    If you want to replace the queries to be case-sensitive, so, you can change the NLS_COMP and NLS_SORT for each session and create all your index with these NLS settings by default, but that complicates life in general.

    Either said by the way, do you really need to use the NVARCHAR2 data type? Your really using characters that cannot be represented in your character of database primary keys are defined?

    Justin

  • Reg: Relaxation and Don auto primary key in the table definition

    Hi all
    I wrote

    * 1 problem :*

    SEQUENCE:
    CREATE SEQUENCE ztrig_seq1
    MINVALUE 1
    MAXVALUE 999999999999999999999999999
    START WITH 1
    INCREMENT BY 1
    CACHE 20;

    TRIGGERING FACTOR:
    create or replace trigger ztrig_trig before insert on ztrig
    for each line
    Start
    insert into ztrig values (ztrig_seq1.nextval,:new.name);
    end;

    While inserting data such as:

    Insert into ztrig values ('john');

    It is showing error as:
    Error from the 1 in the command line:
    Insert into ztrig values ('john')
    Error in the command line: 1 column: 12
    Error report:
    SQL error: ORA-00947: not enough values
    00947 00000 - not enough of"values."
    * Cause:
    * Action:

    Please fix this.

    * 2nd problem :*
    Can we give automatic numbering as primarykey when you set the table?


    Thanks in advance.

    999 wrote:
    Hi all
    I wrote

    * 1 problem :*

    SEQUENCE:
    CREATE SEQUENCE ztrig_seq1
    MINVALUE 1
    MAXVALUE 999999999999999999999999999
    START WITH 1
    INCREMENT BY 1
    CACHE 20;

    TRIGGERING FACTOR:
    create or replace trigger ztrig_trig before insert on ztrig
    for each line
    Start
    insert into ztrig values (ztrig_seq1.nextval,:new.name);
    end;

    Modify this trigger as follows.

    CREATE OR REPLACE TRIGGER ztrig_trig BEFORE INSERT ON ztrig
    FOR EACH ROW
    BEGIN
           :NEW. := ztrig_seq1.nextval;
    END;
    /
    

    While inserting data such as:

    Insert into ztrig values ('john');

    It is showing error as:
    Error from the 1 in the command line:
    Insert into ztrig values ('john')
    Error in the command line: 1 column: 12
    Error report:
    SQL error: ORA-00947: not enough values
    00947 00000 - not enough of"values."
    * Cause:
    * Action:

    Change the Insert as follows

    INSERT INTO ztrig (name) VALUES ('john');
    

    Please fix this.

    * 2nd problem :*
    Can we give automatic numbering as primarykey when you set the table?

    The answer is no.

  • Auto to produce the value of the primary key for the valid insertion eah

    I have a table EMP having emp_id, name and age.

    EMP;

    E1 John 23
    E2 Mary 25

    created a page of form/report on the table. the status page displays all the columns. creating new entry, the hidden emp_is and the name, age appear. successful insertion the emp_id is filled with 1 rather than E3.


    1 Rick 22
    E1 John 23
    E2 Mary 25

    How can I make sure that the new inserted row has a value of E3 and the subsequent entries, emp_id is incremented by the following sequence.

    If your emp_id is not numeric and must be 'E' + sequence, then you must delete the existing trigger and create a new one like this:

    CREATE OR REPLACE TRIGGER emp_bi_trg
       BEFORE INSERT
       ON emp
       FOR EACH ROW
    BEGIN
       IF :NEW.emp_id IS NULL
       THEN
          SELECT 'E' || emp_seq.NEXTVAL
            INTO :NEW.emp_id
            FROM DUAL;
       END IF;
    END;
    /
    

    Denes Kubicek
    ------------------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    ------------------------------------------------------------------------------

  • capture of primary key for the records to be committed

    I have a form that has a tabular data block and a push button to validate these changes. When the button is pressed, I would like to be able to determine which records will be engaged. But in doing so
    go_block('block');
    IF :SYSTEM.RECORD_STATUS != 'QUERY' THEN
        insert into event_log (blah blah blah);
        values (:block.record_id);
    END IF;
    only gives me the id of the first record displayed. If if #2 and #4 are made, I don't see #2 in the newspaper. Is it possible for me to grasp all the record id?

    Good triggers connect this type of information would be

    After INSERTION, updated later, after DELETION, they fire for each record after the operation has been executed and you can access all block-point-values in.
    Also possible would be pre triggers that are triggered for each recordbeofre the operation.

  • Why we cannot create more than one primary key on a table. Why we create several unique key on a table. Please explain if anyone have details of this.

    Why we cannot create more than one primary key on a table. Why we create several unique key on a table. Please explain if anyone have details of this.

    «a primary key has semantic meaning, it is to be immutable (never change of value), unique and not null.»

    a unique constraint is simply "at any time, these values are unique - they can change and they can be null.

    You use a unique when constraint

    (a) you do not already have a primary key for a table can have only one
    (b) you allow NULL values in attributes
    "(c) to allow you to update the values in the attributes.

    https://asktom.Oracle.com/pls/Apex/f?p=100:11:0:P11_QUESTION_ID:5541352100346689891

  • primary key for a column made up of duplicates

    Hello
    -> I have created a table and
    -> I have a column consisting of 1,000 records (but where I have duplicates)

    and now, I want to create a primary key for the column
    How can I do it...

    Hello

    Run the utlexcpt.sql script located in the ORACLE_HOME/rdbms/admin directory level to create the exception table.

    Thank you

  • Primary key on the attributes of data type

    Production data Modeler 3.0 is really nice! Kudos to the development team.

    Now for a question. Any idea when the Data Modeler will support (generate after modeling) the following SQL statements?

    CREATE or REPLACE TYPE x_flags_t
    AS AN OBJECT
    (
    ID NUMBER,
    has_note NUMBER,
    has_image NUMBER,
    created_on DATE,
    created_by VARCHAR2 (30 CHAR),
    modified_on DATE,
    Modified_By VARCHAR2 (30 CHAR),
    FINAL
    X_flags_t FUNCTION CONSTRUCTOR
    (
    GITES x_flags_t IN OUT NOCOPY
    )
    RETURN SELF AS RESULT
    ,
    FUNCTION MEMBER update_row
    (
    X_flags_t COTTAGES
    )
    RETURN x_flags_t,
    FUNCTION MEMBER update_note_flag
    (
    X_flags_t COTTAGES
    p_note_flag in NUMBERS
    )
    RETURN x_flags_t
    ) NOT FINAL
    ;
    /


    CREATE TABLE x_flags
    (
    indicators x_flags_t
    )
    /

    ALTER TABLE x_flags
    ADD (CONSTRAINT x_flags_pk PRIMARY KEY * (flags.id)) *.
    /

    Hi Scott,.

    Thanks for your comments.
    I logged an enhancement request to enable a primary key for a Table containing columns of structured Type to refer to attributes of structured Type.

    David

Maybe you are looking for