Check the constraint on the table but to apply only to certain lines?

Hello

Using oracle 11.2.0.3

We have table and you want to put a strain of additional validation on a column on the table, but for this constarint check apply only to some lines in the table

for example, if the line has produced some type of a particular column must always be completed.

What is the best way to do this?

Thank you

Hello

More simply

CHECK (some_column IS NOT NULL

OR product_type! = « X »

)

or, depending on the expected results when product_type is NULL

CHECK (some_column IS NOT NULL

OR NVL (product_type, 'OK'). = « X »

)

Tags: Database

Similar Questions

  • I accidentally deleted my pictures. I checked the trash, but they aren't there. How can I get back them?

    I accidentally deleted my pictures. I checked the trash, but they aren't there. If not, where can I get?

    Hello

    You can try this program: Recuva

    http://www.Piriform.com/Recuva

  • I have a table of the adf, I added a column that contains a button that I created, when I click it must remove this row in the table, but it is not, please help

    I have a table of the adf, I added a column that contains a button that I created, when I click it must remove this row in the table, but it is not, please help

    I don't understand. You use vo and eo for you to use business components.

    Again, this kind of code call in trouble.

    You must post the changes to make them visible to the eo find vo. You must then run the query for the changes in the business layer strips then you must update the iterator he table is based on.

    In your code I see that happen, hooch maybe because it is more often than not formatted and undocumented.

    My advice is to do a small test case that you can manage with easy sql. Once you get it to run transfer you the results to the actual application.

    Timo

  • I already have the complete steps to install the demo, but I can't download it because I have to confirm or check the D, but they sent the confirmation of another e-mail account that is not mine

    I already have the complete steps to install the demo, but I can't download it because I have to confirm or check the D, but they sent the confirmation of another e-mail account that is not mine

    Please register again with a new email address.

    Make sure you have access to this email address.

    Concerning

    Megha Rawat

  • Find the table number B > = number in the table but < then next entry b

    I'm trying to understand the following: find the table number B > = number in the table but < then next entry b

    Table A

    5
    10
    21
    20

    Table B

    8
    12
    16
    23
    40

    The 5 entry in table A, I would like to return 8 b
    For the 10 entry I would lke to return 12 b
    21 entry I would like to return 23 b
    20 entry I would like to return 23 b

    Edited by: Withnoe October 5, 2012 09:19

    Edited by: Withnoe October 5, 2012 10:54

    CREATE TABLE TAB_A (CLASS # VARCHAR2 (10), THE NUMBER OF TERM);
    CREATE TABLE TAB_B (CLASS # VARCHAR2 (10), THE NUMBER OF TERM);

    INSERT INTO TAB_A VALUES ('BIOL 520', 201010);
    INSERT INTO TAB_A VALUES ('BIOL 521', 201250);
    INSERT INTO TAB_A VALUES ('BIOL 522', 200980);

    INSERT INTO TAB_B VALUES ('BIOL 520', 201110);
    INSERT INTO TAB_B VALUES ('BIOL 520', 201150);
    INSERT INTO TAB_B VALUES ('BIOL 520', 201250);
    INSERT INTO TAB_B VALUES ('BIOL 521', 201250);
    INSERT INTO TAB_B VALUES ('BIOL 521', 201260);

    SELECT MIN (TAB_B.TERM) TERM, TAB_B.CLASS # TO TAB_A, TAB_B
    WHERE TAB_A.CLASS # = TAB_B.CLASS #.
    AND TAB_B.TERM > TAB_A.TERM
    GROUP TAB_B.CLASS #;

    Please let us know if you need anything else. Thank you

  • How to check the table have are all views in oracle

    Hello
    How to check the table have are all views in oracle
    SELECT * FROM user_dependencies
    WHERE type='VIEW'
    AND referenced_type='TABLE'
    AND referenced_name ='Your_Table_Name' 
    

    You can use dba_dependencies to find views in the different schema.

  • Help! I need to connect my iPhone5s to the stereo, but it has only one usb port and whenever I connect it, it connects? Is there a setting on my phone, I need to change? Help, please

    Help! I NEED to connect my iPhone5s to the stereo, but it has only one usb port and whenever I connect it, it connects? Is there a setting I need to change on my phone? Help, please

    You will need something like that and a micro USB to USB cable

    http://www.Apple.com/shop/product/MD820AM/A/lightning-to-micro-USB-adapter

  • In XP PRO SP3 WMP11, will add all my files in the library. I added the folder, but it adds only 116 records 2000

    In XP PRO SP3 WMP11, will add all my files in the library. I added the folder, but it adds only 116 records 2000

    In XP PRO SP3 WMP11, will add all my files in the library. I added the folder, but it adds only 116 records 2000

    You cannot view, add, or delete items in the library of Windows Media Player 11

  • ACROBAT BUSINESS TOOLS has been installed on my PC by Dell. Now I have to reinstall the software, but I have only the serial number. Where can I download the software? Thanks for your help.

    ACROBAT BUSINESS TOOLS has been installed on my PC by Dell. Now I have to reinstall the software, but I have only the serial number. Where can I download the software? Thanks for your help.

    Driver downloads & | Reference Dell U.S.

  • I have 3 radio button options to choose, but I want only a certain one for calculating sales tax. How can I assign a calculation to an option button?

    I have 3 radio button options to choose, but I want only a certain one for calculating sales tax. How can I assign a calculation to an option button?

    Ok. Let's say the name of the radio button group is "Radio1", the value of exports in this field is '3', the name of the subtotal is "Subtotal" and tax rate is 16%. You can use this code as the custom calculation of the tax field script:

    Event.Value = (this.getField("Radio1").valueAsString == "3")? Number (this.getField("Subtotal").valueAsString) * 0.16: 0;

  • Check the tables in EBS

    Hello

    I use Oracle R12.

    Is oracle's hold no audit tables to track every transaction through EBS. For example, if I delete a folder of contacts using the Oracle table seeds API and validation, then it is not only the data but also the details of the transaction is completely lost.

    My requirement is that I need to check the changes that happened in some paintings, whether create, update or delete transactions.

    Is this possible? Is Oracle any method to achieve this?

    Thank you

    Anoop

    The audit is closed as default. You can open it to a user or users, or any database, but you should consider the number of rows will be inserted by the audit of the process. You may have too many lines according to your amount of the transaction.

    http://www.Oracle-base.com/articles/10G/auditing-10gR2.php

    Concerning

  • checking the tables...

    Hi Experts,

    Could someone help me with the following problem.
    We strive to implement the function of 'check' on a table. What is the best way to do audits? (keep track of any changes in the table)
    That's what we do...
      Main_table
      id
      first_name
      last_name
       dob
      hire_date
      created_date
      created_by
      updated_date
      updated_by
    
    
      audit_table
      ad_action (whether it is insert,update or delete)
      ad_time (time)
      ad_user (whos is the user)
      id 
      first_name
      last_name
       dob
      hire_date
      created_date
      created_by
      updated_date
      updated_by
    
    and i have a trigger on the "main_table" like this
    
    
      CREATE OR REPLACE TRIGGER Main_table_AIUD after
    insert or update or delete on Main_table for each row
    begin
       declare
          ljn_action varchar2(3);
       begin
          if inserting then
             ljn_action := 'INS';
          elsif updating then
             ljn_action := 'UPD';
          else
             ljn_action := 'DEL';
          end if;
          --
          if inserting  then
             insert into audit_table
             (
              ad_action,
              ad_time,
              ad_user, 
              id 
              first_name
             last_name
             dob
             hire_date
             created_date
             created_by
             updated_date
             updated_by
             )
             values
             (
              ljn_action
             ,sysdate
             ,nvl(v('APP_USER') ,USER)
             :new.id,
            :new.first_name,
             :new.last_name,
              :new.dob,
             :new.hire_date,
             :new.created_date,
             :new.created_by,
             :new.updated_date,
              :new.updated_by
             );
          elsif updating then
            insert into audit_table
             (
              ad_action,
              ad_time,
              ad_user, 
              id 
              first_name
             last_name
             dob
             hire_date
             created_date
             created_by
             updated_date
             updated_by
             )
             values
             (
              ljn_action
             ,sysdate
             ,nvl(v('APP_USER') ,USER)
             :old.id,
            :old.first_name,
             :old.last_name,
              :old.dob,
             :old.hire_date,
             :old.created_date,
             :old.created_by,
             :old.updated_date,
              :new.updated_by
             );
          else
             insert into audit_table
             (
              ad_action,
              ad_time,
              ad_user, 
              id 
              first_name
             last_name
             dob
             hire_date
             created_date
             created_by
             updated_date
             updated_by
             )
             values
             (
              ljn_action
             ,sysdate
             ,nvl(v('APP_USER') ,USER)
             :old.id,
            :old.first_name,
             :old.last_name,
              :old.dob,
             :old.hire_date,
             :old.created_date,
             :old.created_by,
             :old.updated_date,
              :new.updated_by
             );
          end if;
       end;
    end;
    /
    For "Insert" and "Delete" as I need to enter all parts of my code would be ok.

    But for "update" How can I capture only the columns that have changed? and put it in the audit table
    so next time if I go to the audit table, I see clearly that these elements had changes.

    Is there a better way to do it?

    Please let me know

    Thank you

    Marella Phani wrote:
    (3) if it is an action "update" on a table. How do we know the data of 'old' and 'new data' in the audit tables?

    It is value according to the audit. And like many, I know, unfortunately, the only way to do so far is triggers.

  • analyze the work of the table but dbms_stats does not work

    Hi all

    I have a very simple question, although analyze command became obsolete for many years, when I use analyze, command, I get the result of empty_blocks (user_tables) but when I use the dbms_stat package I get nothing.

    SQL > select * from v version $;

    BANNER
    ----------------------------------------------------------------
    Oracle Database 10 g Express Edition Release 10.2.0.1.0 - product
    PL/SQL Release 10.2.0.1.0 - Production
    CORE 10.2.0.1.0 Production
    AMT for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production

    SQL > create table deneme2 in select * from object;

    table created


    SQL > exec dbms_stats.gather_table_stats (USER, 'DENEME2');

    PL/SQL procedure successfully completed.

    SQL > select blocks, empty_blocks from user_tables where table_name = 'DENEME2;

    BLOCKS EMPTY_BLOCKS
    ---------- ------------
    13            0

    SQL > analyze table deneme2 calculating statistics;

    Parsed table.

    SQL > select blocks, empty_blocks from user_tables where table_name = 'DENEME2;

    BLOCKS EMPTY_BLOCKS
    ---------- ------------
    13            3

    Which is wrong with dbms_stats? I missed somewhere? Does anyone have any idea who why dbms_stat can't work?

    Thanks in advance.

    Hello

    That's what said ORACLE. See the link below:

    http://docs.Oracle.com/CD/B28359_01/server.111/b28310/general002.htm

    «Oracle is recommended to use the most versatile DBMS_STATS package for gathering statistics for the optimizer, but you must use the ANALYZE instruction to collect statistics that are not related to the optimizer, such as empty blocks, spatial average and so on.»

  • Display the column in the table, but not in the IR

    Hi guys,.

    [apex Oracle 11 g 4.2]

    Is there a way to display a column in a graph that is generated by the IR and is not in the table-IR?

    I know I can chosse columns in the IR and choose to not display this column. It's going to work.

    But if I put the column 'hidden' in the attributes of IR Section I can't create a chart out of it.

    So I want to create a graph of the same data that the (default) column is hidden.

    THX in advance Thorsten

    There is no way to do it.

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Apress.com/9781430235125
    http://Apex.Oracle.com/pls/Apex/f?p=31517:1
    http://www.Amazon.de/Oracle-Apex-XE-Praxis/DP/3826655494
    -------------------------------------------------------------------

  • Privileges - hide the data on the table, but allow the visualization of the table structure?

    I was wondering if there is a lien that would allow someone to be able to view a table exists, its column names, but hide the contents of the actual data in the table?

    I know he has a right to SELECT which, if not given it seems just totally hide the table

    Thanks in advance

    I was wondering if there is a lien that would allow someone to be able to view a table exists, its column names, but hide the contents of the actual data in the table?

    The solutions are:
    -grant SELECT on DBA_TAB_COLUMNS ;
    -a custom view SYS. CUSTOM_TAB_COLUMNS selects from DBA_TAB_COLUMNS, which is filtered for specific schemas/tables.
    -Fine grain access
    -Security label

    Published by: user11181920 on October 23, 2012 11:15

Maybe you are looking for

  • HP 350 G1F7Y99EA: update BIOS HP 350 f.11 to f.12 G1

    For 3 months I have a HP 350 G1 F7Y99EA, which has been transformed into 8 GB and a Kingston mS200 SSD 120 GB mSata has been added as well. My system drive is on the HARD drive but the OS (Win7 pro x 64) is on the SSD and I start from there. I have 4

  • Refreshing (?) a Windows 7 install and issues related other sorta...

    First, asker time question... Please forgive the wall of text. I upgraded my desktop computer HP from Vista to Windows 7 using their free upgrade method too complicated who was to get several DVDs of them, creating about 5 more on my side and invest

  • Sync Outlook blackBerry Smartphones issue: sync Bennett tells me to remove 300 + entries in Outlook

    Hi all With my wife, we had 2-BB Curve 8520 and we are now trying to synchronize both of them with our Outlook 2003 SP3 on XP SP3. Both do the same thing: 1 / first synchronization goes well, BB calendar is full,. 2 / all syncs well for a few days. 3

  • From the EOs 2 VO

    Hi allI have A table with two fields:ID_AAttribue_AAnd a B table with 3 fields:ID_AID_CAttribute_BID_A is the priamry key in table a.(ID_A, ID_C) is a primary key in table BB.ID_A is a foreign key on A.ID_AI have a page with the 4 elements:an article

  • Automatic approval when the applicant is approver

    HelloI am setting up a workflow for approval of level one (using SOA in 11gR2PS2) where approval is a role (say A) IOM. Still it works great except for the fact that, when a member of role requests (A), the request is forwarded for approval rather th