10g 10.2.0.1.0 - Check Constraint with negative values possibly BUG.

Hello,
Why this doesn't work ?
create table a (b numeric(1));
alter table a
add constraint b CHECK (b in (0, 1, -1)) ENABLE;
select * from a where b = -1;
I get the following error: java.sql.SQLException: No more data to read from socket
- Through the jdbc client. It happens with the Oracle Client too.
When i change my check constraint to this:
alter table a
add constraint b CHECK (b in (-1, 0, 1)) ENABLE;
It works.
It's a (known) bug ?
Regards,
Francisco

hi dear,
I want to upgrade my OMS server 10.2.0.1 to 10.2.0.5
I downloaded the patch 10.2.0.5 and read the README.txt
Part of the README is:
1.2 Enter the following command to extract the installation files:
$ unzip GridControl_10.2.0.5_<platform name>.zip
This command extracts the following files and directory:
|- p3731593_10205_<platform name>.zip
|- 3731596.zip
|- 3822442.zip
|- README.txt
|- doc/
NOTE: <platform name> will be "LINUX" or "Win32" depending on the platform for which you are installing. For installing Enterprise Manager 10g Grid Control Release 5 (10.2.0.5), refer to the Release Notes available in the "doc" directory.
- p3731593_10205_<platform name>.zip is the ZIP file that contains 10.2.0.5 patch set software.
This zip can be used for:
- Upgrading Oracle Management Service Release 2 (10.2.0.x) or higher to Oracle Management Service Release 5 (10.2.0.5)
- Upgrading Oracle Management Repository (sysman schema)
- Upgrading Oracle Management Agent on the host where OMS is running.
NOTE: This will not upgrade the database in which the Management Repository (sysman schema) resides.
- 3731596.zip is for patching Management Agent by staging the patch set. To understand how you can apply the Management Agent 10.2.0.5 patch set, refer to method 2 described in section 4.3.3 "Upgrading Management Agent - Multiple Hosts at a Time" of the Release Notes. The Release Notes can be found in the "doc" directory.
- 3822442.zip is for patching Management Agent by distributing the full patch set.  To understand how to apply the Management Agent 10.2.0.5 patch set, refer to method 1 described in section 4.3.3 "Upgrading Management Agent - Multiple Hosts at a Time" of the Release Notes. The Release Notes can be found in the "doc" directory.3731596.zip - by staging
3822442.zip - by distributing
Does the two above have the same function or purpose?
I can not understand the meaning of the two :( . which do you think is the right one for my setup?
Thanks a lot

Similar Messages

  • Creating a check constraint with a join

    Hi,
    is it possible to create a check constraint under the data models using a join on lookup table?
    I would like to filter out tuples in the target table involving conditions from an another table.
    Regards

    Numbers has checkable boxes but they don't work once exported to PDF.
    And there is iBooks Author as well which can create ePubs.
    If it is just for yourself on your Mac I highly recommend Qu-s.
    Peter

  • Solver VBA SolverAdd constraints with decimals not possible

    This issue is related to the German versions of Excel, it tried all from XL2002 up to XL2013.
    I can add a constrain with decimals to the solver manually and it works as expected:
    When I record a macro the recorded constrain line is this:
    SolverAdd CellRef:="$A$1", Relation:=3, FormulaText:="0,001"
    But when I run that line the constrain is always ">= 1", the decimal part is missing! I tried all variations that I can think of, but nothing works. When I run this macro:
    Sub Makro1()
    SolverReset
    SolverAdd CellRef:="$A$1", Relation:=3, FormulaText:=0.001
    SolverAdd CellRef:="$A$1", Relation:=3, FormulaText:="0.001"
    SolverAdd CellRef:="$A$1", Relation:=3, FormulaText:="0,001"
    End Sub
    The result is this:
    How can I set a constrain with decimals into the Solver?
    Andreas.

    The answer for this from Frontline Systems Inc. is:
    This is an old VBA bug.
    Just use:
    FormulaText:="=1"
    Rather than
    FormulaText:="1"
    That sounds strange... "old VBA bug"?? VBA is able to detect and work with the language depended decimal delimiters and such things!
    So I went a little into the depths and have looked more closely at SOLVER.XLAM and there I found the bug:
    If "." <> Application.International(xlDecimalSeparator) Then
    dummy = InStr(FormulaText, Application.International(xlDecimalSeparator))
    Do While dummy <> 0
    Mid(FormulaText, dummy, 1) = "."
    dummy = InStr(FormulaText, Application.International(xlDecimalSeparator))
    Loop
    End If
    If Not IsNumeric(FormulaText) Then
    On Error Resume Next
    If TypeName(FormulaText) = "Range" And Not IsCellReference(Stylecheck(CStr(FormulaText))) Then
    FormulaText = FormulaText.Address
    End If
    FormulaText = CStr(FormulaText)
    FormulaText = Stylecheck(FormulaText)
    On Error GoTo mainerror
    Else
    FormulaText = CDbl(FormulaText)
    End If
    They replace the "," with a "." and then they call CDBL (and not VAL), that is the reason.
    In Germany (Europe) the "." is the thousand delimiter and the "," is the decimal delimiter. And CDBL knows that!
    Okay, so why does "=0,0001" work? Obvious the CBDL line isn't executed in this case.
    The solver routines creates hidden names in the sheet and store anything there. If you like to see them execute this:
    Sub ShowNames()
    Dim N As Name
    For Each N In Names
    N.Visible = True
    Next
    End Sub
    And names are also language depended, but when we want to store values into a name we have to "speak" English.
    The code changes "=0,0001" to "=0.0001" and stores that into the name manager. So when we look into the names we can see "=0,0001" at screen (in Europe).
    And the Solve routines grabs that values... what a mess. :-)
    If you want to write language-independent programs therefore this syntax is recommended:
      SolverAdd "A1", 3, "=" & 0.0001
    Andreas.

  • Generating check constraint

    Hi I've got a problem and was wondering if anyone could shed some light on the problem.
    Recently we started using designer 10g. When I generate a table using "generate database from server model" all the columns which are defined by a domain and have a check constraint, due to the specified values in the domain, are no longer part of the create statement of the table. Designer seems to put them in the constraint file as part of an alter table along with a weird name.
    Is it possible, as in designer 2000, to make the check constraint part of the create statement in 10g and making it a sys constraint ? And how ?
    I've been looking around but can't seem to find the solution (or the problem causing it).
    Thnx for any help on the subject.

    Well we are planning to migrate our old designer (designer 2000) to the 10g version. One of the things that was possible in designer 2000 was defining a domain for a column and when you generated the SQL DDL it would generate a check constraint but as part of the create table statement.
    eg:
    type VARCHAR2(2) NOT NULL CHECK ( opvolging_type IN 'VC' , 'NL' , 'WW' , 'LB' ) ),
    The check constraint would then be defined as a check constraint with name SYS...
    Apparently some ppl at my company do not want to use explicit names for check constraints and they were wondering if it was at all possible to make them part of the create table script again.

  • How to modify a CHECK constraint.

    We need to modify a check constraint to allow new values. Is there a way we can modify the existing constraint or should we drop and recreate including new values.
    Example:
    We have a table SLOG and SNO is a column accepting numeric values. Currently there is a constraint on this column so that it accepts values of 1,2,3,4. Now I want to insert a value of 5 to this column. Since there is a CHECK constraint on this column it prevents the value of 5.
    So the constraint needs to be modified. Is there a way we can modify the constraint using a DDL command (like ALTER TABLE) or should I drop and re create the constraint.
    Thanks in advance.
    Balaji

    Hello,
    Is there a way we can modify the constraint using a DDL command You can just MODIFY the state of your constraint ( constraint_state ).
    So, if you want to modify the definition of your constraint you have to drop and create the CHECK constraint with its new definition.
    Sorry, when I was writing my post, I didn't see the question was already answered.
    Best regards,
    Jean-Valentin
    Edited by: Lubiez Jean-Valentin on Jul 11, 2010 11:04 AM

  • Oracle check constraint bug ?

    Hi,
    This is an 'interesting' bug:
    create table mytable (
    id number,
    status number,
    constraint mytable_pk primary key (id)
    insert into mytable (id, status) values (1, 0);
    insert into mytable (id, status) values (2, -1);
    On XE (10.2.0.1) and 10.2.0.4:
    Following command gives the expected ORA-02293 error (using string values instead of numbers): alter table mytable add constraint mytable_status_chk check (status in ('0', '1'));
    BUT no error with the following command: alter table mytable add constraint mytable_status_chk check (status in ('-1', '0', '1'));
    On XE:
    The query select * from mytable where status=0 returns no records until the constraint is dropped again !
    Best regards,
    Serge
    Edited by: sergeko on Nov 19, 2010 11:19 AM
    Edited by: sergeko on Nov 19, 2010 11:21 AM

    I don't have access to any 10.x or XE currently and cannot reproduce on EE 9.2.0.9 or 11.1.0.6.
    It's possible that you're running into an optimizer issue with the constraint.
    This might be visible if you run an explain plan on the statement, get the execution plan via dbms_xplan.display and check the predicates section both with and without the constraint.
    I take it that you don't get the problem if you use a check constraint with numbers not strings.
    I wonder also whether it makes a difference if you declare status as not null.
    Edited by: DomBrooks on Nov 19, 2010 10:44 AM

  • Regexp_like with check constraint

    Hi all,
    My requirement is User should not enter the data like ( ½, ¼,...).
    I have created table with check constraint with the following syntax:
    CREATE TABLE mytest (c1 VARCHAR2(20),
    CHECK (REGEXP_LIKE(c1,'^[[:alnum:]+[:digit:]+[!@#]]+$')));
    The above means, except alphanumeric, digits, and keyboard characters should allow. But it is not allowing any characters.
    Please help me, any mistake in the above syntax.
    Thanks
    Mano

    Hi, Mano,
    user533671 wrote:
    Hi all,
    My requirement is User should not enter the data like ( ½, ¼,...).
    I have created table with check constraint with the following syntax:That's a couple of examples of values that are not allowed. Now give some examples of values that are allowed, and the reasons why each are allowe or not.
    For example, is 'GREEN/BLUE', with a slash between letters, allowed? How about '1/' with no number after the slash?
    >
    CREATE TABLE mytest (c1 VARCHAR2(20),
    CHECK (REGEXP_LIKE(c1,'^[[:alnum:]+[:digit:]+[!@#]]+$')));
    The above means, except alphanumeric, digits, and keyboard characters should allow. But it is not allowing any characters.
    Please help me, any mistake in the above syntax.You're using square brackets inside square brackets. If you really need to do that, then the right ']' must be the first character listed.
    Post 5 or 10 INSERT statements. Tell which INSERTs should work, and which ones should fail because of the CHECK constraint, and explain why in each case.

  • 10g R2 NVARCHAR2 check constraint problems

    Hi, Thanks for taking a look...
    I've just installed 10g R2 on Solaris 10 and run into a small problem with NVARCHAR2s.
    I have a table with a check constraint to make sure the column is a valid value on an nvarchar2 column. Querying the table for a specific value results in no data found, however the data appears to be intact.
    The database NLS_CHARACTERSET is AL32UTF8 and NLS_NCHAR_CHARACTERSET is AL16UTF16.
    I think the following script results can show the problem better than I can explain it.
    Any suggestions would be appreciated. Thanks.
    Mike
    SQL*Plus: Release 10.2.0.1.0 - Production on Mon Apr 17 13:51:40 2006
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
    With the Partitioning and Data Mining options
    SQL> @problem_script.sql
    SQL> create table foo (
    2 bar nvarchar2(10) constraint ck_bar check (bar in ('abc','def'))
    3 );
    Table created.
    SQL> insert into foo values ('abc');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL>
    SQL> REM Strange. This worked in every version prior to 10g R2.
    SQL> REM Why doesn't it work now?
    SQL>
    SQL> select * from foo where bar = 'abc';
    no rows selected
    SQL>
    SQL> REM Even more strange is why this doesn't work:
    SQL>
    SQL> select * from foo where bar = N'abc';
    no rows selected
    SQL>
    SQL> REM Stranger still are these two queries:
    SQL>
    SQL> select bar, decode(bar, 'abc', 'It matches', 'No it doesnt')
    2 from foo;
    BAR DECODE(BAR,'A
    abc It matches
    SQL>
    SQL> REM This is still strange, but not unexpected given the prior query
    SQL>
    SQL> select bar, decode(bar, 'abc', 'It matches', 'No it doesnt')
    2 from foo
    3 where bar = 'abc';
    no rows selected
    SQL>
    SQL> REM Strangest of all is why this DOES work:
    SQL>
    SQL> alter table foo disable constraint ck_bar;
    Table altered.
    SQL> select * from foo where bar = 'abc';
    BAR
    abc
    SQL>
    SQL>
    SQL> REM Regular varchars are unchanged...
    SQL>
    SQL> create table bar (
    2 foo varchar2(10) constraint ck_foo check (foo in ('abc','def'))
    3 );
    Table created.
    SQL> insert into bar values ('abc');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from bar where foo = 'abc';
    FOO
    abc

    Nope.
    SQL> select * from foo where bar = TO_NCHAR('abc');
    no rows selected
    Of all the things I've tried (and I think I've tried just about everything), only the TO_CHAR(bar) and disabling the check constraint work. The fact that DECODE(bar, 'abc', 'true', 'false') in the select list is also confusing since it's converted there correctly, but not in the WHERE clause. And why does it work as epxected when the constraint is disabled?
    My thoughts are that it can't be an Oracle bug, otherwise I'm sure I wouldn't be the first to find it. I've built the instance using the same configuration script I used for the 10g R1 database that works, so the configuration parametes are the same.
    More things that don't make sense:
    SQL> select dump(bar), dump('abc') from foo;
    DUMP(BAR)
    DUMP('ABC')
    Typ=1 Len=6: 0,97,0,98,0,99
    Typ=96 Len=3: 97,98,99
    SQL> select dump(bar), dump(to_nchar('abc')) from foo;
    DUMP(BAR)
    DUMP(TO_NCHAR('ABC'))
    Typ=1 Len=6: 0,97,0,98,0,99
    Typ=1 Len=6: 0,97,0,98,0,99
    Thanks for your help though...
    Mike

  • Peculiar problem in oracle 10g  on AIX 5.3.0 With Check constraints

    Hi Every One,
    I am facing peculiar problem in oracle 10.2.0.1.0,AIX 5.3.0. I created table with check constraints like this
    create table test1 (name nvarchar2(1),check (name in('Y','N')));
    SQL> create table test1 (name nvarchar2(1),check (name in('Y','N')));
    Table created.
    SQL> insert into test1 values ('Y');
    1 row created.
    SQL> COMMIT;
    SQL> select from test1 where name = 'Y';* Why this statement is n't working
    no rows selected
    SQL> select * from test1;
    N
    Y
    ANOTHER INTERSTING ONE IS
    SQL> select * from test1 where name in('Y'); Why this statement is n't working
    no rows selected
    SQL> select * from test1 where name in('Y','Y'); it's working
    N
    Y
    SQL> select * from test1 where name in('','Y'); it's working
    N
    Y
    SQL> select * from test1 where name in('7','Y'); it's working
    N
    Y
    Like
    SQL> select * from test1 where name like 'Y'; it's not working
    no rows selected
    I created a table without check constraints
    SQL> create table test2 (name nvarchar2(1));
    Table created.
    SQL> insert into test2 values ('Y');
    1 row created.
    SQL> select * from test2;
    N
    Y
    SQL> select * from test2 where name ='Y'; it's working
    N
    Y
    SQL> select * from test2 where name like 'Y'; it's working
    N
    Y
    Database Details
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    NLS_CURRENCY $
    NLS_ISO_CURRENCY AMERICA
    NLS_NUMERIC_CHARACTERS .,
    NLS_CHARACTERSET WE8MSWIN1252
    NLS_CALENDAR GREGORIAN
    NLS_DATE_FORMAT DD-MON-RR
    NLS_DATE_LANGUAGE AMERICAN
    NLS_SORT BINARY
    NLS_TIME_FORMAT HH.MI.SSXFF AM
    PARAMETER VALUE
    NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_DUAL_CURRENCY $
    NLS_COMP BINARY
    NLS_LENGTH_SEMANTICS BYTE
    NLS_NCHAR_CONV_EXCP FALSE
    NLS_NCHAR_CHARACTERSET AL16UTF16
    NLS_RDBMS_VERSION 10.2.0.1.0
    Why it's happening. Whehter check constraint is valid or not in Equallity operator and like and in .
    Whereever we using single character column with check constraint,it's working with Equality operator and like and in.
    IT'S WORKING FINE WITHOUT CHECK CONSTRAINTS.WE HAVE TWO AIX MACHINES WITH ORACLE10G.THE SAME PROBLEM OCCURING IN TWO MACHINES
    PLEASE HELP ME .
    THANK YOU,
    WITH REGARDS,
    N.VINODH

    h
    Edited by: user3266490 on Dec 3, 2008 2:30 AM

  • Check constraint from domain missing after generation

    Hi,
    I've got the following problem with designer 10g. When I create a column and specify a specific domain, then generate the scripts for 10g (or 8i,9,...) the check constraints that is specified in the domain goes missing. The strange part is that we have about 50 domains and 49 of them work perfect but one of them just doesn't want to be generated. I've been comparing the domain to the others but I don't see any major differences that would cause the problem. Anyone know what could cause the problem or where I should (I think it is somewhere in the design & generate part) ?
    Help would be greatly appreciated.
    Grtz
    Message was edited by:
    Yves C

    Kent,
    in the DM v3.3.0.747 I have defined domains using value lists that lets you specify data values for the domain instead of define a check constraint, example Domain Name: "YesNo" and Value List -> "Y", "N".
    After adding a new column and set with the domain created, I force to apply the standard names to table with the button "Naming Rules", and the constraint created is correctly named . Notice that I need to force to apply the standard names because by default these constraints are created without name.
    Now I checked create a domain with check constraint definition for 11g (instead of using a list of values) and the behavior was the same.
    I recently upgraded to version 4.0EA2 and it works in the same way for both, so see if forcing to apply the "naming rules" solves your issue.
    Regards.
    Ariel.

  • Primary key and relevant not null check constraints....

    Hi ,
    There are some constraints of primary key type and not null check constraints on columns which constitute each primary key....
    Should I/Do I have to drop them....????
    Do they burden the db at the time of data validation....????
    Thanks...
    Sim

    Hi,
    >>There are some constraints of primary key type and not null check constraints on columns which constitute each primary key..
    In fact, a column that constitutes a primary key, by default cannot accept NULL values. In this case, defines a PK column as NOT NULL would not be necessary.
    LEGATTI@ORACLE10> create table x (id number constraint pk_x primary key);
    Table created.
    LEGATTI@ORACLE10> desc x
    Name                  Null?    Type
    ID                    NOT NULL NUMBER
    LEGATTI@ORACLE10> select constraint_name,constraint_type,table_name,search_condition from user_constraints where table_name='X';
    CONSTRAINT_NAME                C TABLE_NAME      SEARCH_CONDITION                
    PK_X                           P X
    LEGATTI@ORACLE10> create table y (id number not null constraint pk_y primary key);
    Table created.
    LEGATTI@ORACLE10> desc y
    Name                  Null?    Type
    ID                   NOT NULL NUMBER
    LEGATTI@ORACLE10> select constraint_name,constraint_type,table_name,search_condition from user_constraints where table_name='Y';
    CONSTRAINT_NAME                C TABLE_NAME      SEARCH_CONDITION
    SYS_C006327381 C Y "ID" IS NOT NULL 
    PK_Y                           P Y
    LEGATTI@ORACLE10> alter table y drop constraint SYS_C006327381;
    Table altered.
    LEGATTI@ORACLE10> desc y
    Name                                      Null?    Type
    ID                                        NOT NULL NUMBER
    LEGATTI@ORACLE10> insert into y values (NULL);
    insert into y values (NULL)
    ERROR at line 1:
    ORA-01400: cannot insert NULL into ("LEGATTI"."Y"."ID")
    LEGATTI@ORACLE10> insert into y values (1);
    1 row created.
    LEGATTI@ORACLE10> insert into y values (1);
    insert into y values (1)
    ERROR at line 1:
    ORA-00001: unique constraint (LEGATTI.PK_Y) violated
    >>Should I/Do I have to drop them....????
    I don't see any problem, otherwise, drop the NOT NULL constraint is the same with alter the column table like below:
    LEGATTI@ORACLE10> create table z (id number not null constraint pk_z primary key);
    Table created.
    LEGATTI@ORACLE10> select constraint_name,constraint_type,table_name,search_condition from user_constraints where table_name='Z';
    CONSTRAINT_NAME                C TABLE_NAME                     SEARCH_CONDITION
    SYS_C006328420 C Z "ID" IS NOT NULL
    PK_Z                           P Z
    LEGATTI@ORACLE10> desc z
    Name                                      Null?    Type
    ID                                        NOT NULL NUMBER
    LEGATTI@ORACLE10> alter table z modify id NULL;
    Table altered.
    LEGATTI@ORACLE10> select constraint_name,constraint_type,table_name,search_condition from user_constraints where table_name='Z';
    CONSTRAINT_NAME                C TABLE_NAME                     SEARCH_CONDITION
    PK_Z                           P Z
    LEGATTI@ORACLE10> desc z
    Name                                      Null?    Type
    ID                                        NOT NULL NUMBERCheers
    Legatti

  • DB Diagram: Modality Difference between NOT NULL and check constraint

    Hi,
    I am using jdev 11g (11.1.1.10) I am trying to create a db diagram from two tables. I have a FK that is NOT NULL (defined on the column). When i try to display these two tables modality, it does not show up in the diagram. I noticed that there are two ways NOT null can be defined on a table (right click on the db object to edit it; a) under column definitions there is a check box for not null, b) there is a check constraint that one can add to do not null.
    I am confused and was wondering whether I must I have check constraints on the database in order to display modality (optional versus mandatory). Logically speaking it does not make any sense though.

    Hi Susan,
    Thanks for your email. I understand that in order to show modality under
    UML notation, one must define a COLUMN being NOT NULL instead of defining a check constraint.
    I still do not understand how modality (optional versus mandatory) is shown in ERD notation in JDev. I tried flipping ERD/UML notations and made sure icons for tables were showing, but no MODALITY is shown in ERD notation ( an '0" icon or a "|" icon for optional and mandatory). Is it the solid line versus dotted line in the ERD diagram? I am confused because generally under Crawfoot ERD notation '0" icon or a "|" icon is shown for modality.
    Modality gets picked up in jdev diagram when COLUMN not null is specified and UML notation is used
    ALTER TABLE DETAILAJ MODIFY EMPID not null;
    Modality does not get picked up in jdev db diagram when check constraint is specified and UML notation is used
    ALTER TABLE DETAILAJ
    ADD CONSTRAINT CK_NN_DETAILAJ__EMPID CHECK(EMPID IS NOT NULL) ;
    Another question i have related to the matter mentioned above is as follows. Since I want to see modality in db diagram, it follows that I must define a column as not null instead of a check constraint. I must also use NO VALIDATE on NOT NULL column because i have prior data that does not meet the new restriction. I noticed that if i use the following syntax to define a NOT NULL column, two things happen.
    a) A constraint is defined as not null automatically and a system generated name is given to the constraint.
    b) DB diagram in Jdev does not show the modality.
    My question is whether there is a way to see modality in this case.
         alter table DETAILAJ
         MODIFY EMPID NOT NULL ENABLE NOVALIDATE ;
    Edited by: user11219846 on Nov 19, 2009 11:07 AM

  • How to use external functions in check constraints

    I created my own function:
    create or replace
    function if_num_get_num (inval in varchar2)
    return number
    is
    dummy number;
    Begin
    dummy := to_number(inval);
    return dummy;
    exception
    when others then return null;
    end;Can I use it in table check constraint?
    When I use standard function INSTR everything is OK.
    ALTER TABLE A_S
    ADD CONSTRAINT A_S_CHK1 CHECK
      (INSTR(NAZWA_ZA, ':') > 0)
    ENABLE;but when I try to create it with my function:
    ALTER TABLE A_S
    ADD CONSTRAINT A_S_CHK1 CHECK
      (IF_NUM_GET_NUM(INSTR(NAZWA_ZA, ':')) > 0)
    ENABLE;I get a message "Invalid column IF_NUM_GET_NUM"

    Read the restrictions.
    >
    Restrictions on CHECK Constraints
    A CHECK constraint requires that a condition be true or unknown for every row of the table. If a statement causes the condition to evaluate to false, then the statement is rolled back. The condition of a CHECK constraint has these limitations:
    * The condition must be a boolean expression that can be evaluated using the values in the row being inserted or updated.
    * The condition cannot contain subqueries or sequences.
    * The condition cannot include the SYSDATE, UID, USER, or USERENV SQL functions.
    * The condition cannot contain the pseudocolumns LEVEL or ROWNUM.
    * The condition cannot contain the PRIOR operator.
    ** The condition cannot contain a user-defined function.*
    >
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17125/adfns_constraints.htm#ADFNS282

  • How to add a check constraint to a column to accept values in the following format: "L214"?

    All I could come up with is this:
    check (column_name like '____');
    But That doesn't enforce the first character to be a letter and the other three to be numbers.

    Hi,
    "PS: Why the f***you have so many subforums here?"
    Because it is much easier to seperate and let experts answer to specific details of SQL Server. SQL Server is not a small product as many people think ;-)
    Here is the solution:
    CREATe table SampleA (A INT, B VARCHAR(MAX) CHECK (B LIKE '[A-Z][0-9][0-9][0-9]'))
    INSERT INTO SampleA VALUES (1,'0000')
    Msg 547, Level 16, State 0, Line 2
    The INSERT statement conflicted with the CHECK constraint "CK__SampleA__B__38B96646". The conflict occurred in database "master", table "dbo.SampleA", column 'B'.
    The statement has been terminated.
    INSERT INTO SampleA VALUES (1,'L000')
    --(1 row(s) affected)
    INSERT INTO SampleA VALUES (1,'L0001')
    Msg 547, Level 16, State 0, Line 2
    The INSERT statement conflicted with the CHECK constraint "CK__SampleA__B__38B96646". The conflict occurred in database "master", table "dbo.SampleA", column 'B'.
    The statement has been terminated.
    -Jens
    Jens K. Suessmeyer http://blogs.msdn.com/Jenss

  • Is it possible to create a dynamic(with a select) check constraint?

    create table a (col_to_be_coded_fora number);
    create table b (col_to_be_coded_forb number);
    create table c (col_name varchar2(20), col_code number, col_desc varchar2(20));
    insert into c values ('col_to_be_coded_fora', 1, 'active');
    insert into c values ('col_to_be_coded_fora', 2, 'de-active');
    insert into c values ('col_to_be_coded_fora', 3, 'pending');
    insert into c values ('col_to_be_coded_forb', 10, 'school');
    insert into c values ('col_to_be_coded_forb', 20, 'hospital');
    insert into a values ( 1); -- meaning 'active' for table a, column col_to_be_coded_fora, can go in
    insert into a values (10); -- meaning nothing for table a, column col_to_be_coded_fora, must give error
    insert into b values ( 1); -- meaning nothing for table b, column col_to_be_coded_forb, must give error
    insert into b values (10); -- meaning 'school' for table b, column col_to_be_coded_fora, can go in
    I know i can handle this problem with dividing table c into to tables and creating foreign key relationship.
    in this demo case i have only a and b, 2 tables but i want to encode thousands of tables with a table like c.
    &#304;s it possible to create a dynamic check constraint on a table which selects c table for the inputs that have permision?
    Or do i have to use after insert, update triggers on table a and b to ensure this functionality?
    Is there a smarter implementation for this need, may be a design change?
    Thank you,
    Kind regards.
    Tonguç

    Hi Tonguç,
    A small design change makes it possible to do this with simple foreign key constraints.
    I would do something like:
    ual303@ORKDEV01> CREATE TABLE c (
      2    col_name VARCHAR2(20),
      3     col_code NUMBER,
      4     col_desc VARCHAR2(20),
      5     PRIMARY KEY (col_name, col_code)
      6  );
    Tabel is aangemaakt.
    ual303@ORKDEV01> CREATE TABLE a (
      2    col_to_be_coded_fora NUMBER PRIMARY KEY,
      3     col_name VARCHAR2(20) DEFAULT 'col_to_be_coded_fora' CHECK (col_name = 'col_to_be_coded_fora'),
      4     FOREIGN KEY (col_name, col_to_be_coded_fora) REFERENCES c
      5  );
    Tabel is aangemaakt.
    ual303@ORKDEV01> CREATE TABLE b (
      2    col_to_be_coded_forb NUMBER PRIMARY KEY,
      3     col_name VARCHAR2(20) DEFAULT 'col_to_be_coded_forb' CHECK (col_name = 'col_to_be_coded_forb'),
      4     FOREIGN KEY (col_name, col_to_be_coded_forb) REFERENCES c
      5  );
    Tabel is aangemaakt.
    ual303@ORKDEV01> insert into c values ('col_to_be_coded_fora', 1, 'active');
    1 rij is aangemaakt.
    ual303@ORKDEV01> insert into c values ('col_to_be_coded_fora', 2, 'de-active');
    1 rij is aangemaakt.
    ual303@ORKDEV01> insert into c values ('col_to_be_coded_fora', 3, 'pending');
    1 rij is aangemaakt.
    ual303@ORKDEV01> insert into c values ('col_to_be_coded_forb', 10, 'school');
    1 rij is aangemaakt.
    ual303@ORKDEV01> insert into c values ('col_to_be_coded_forb', 20, 'hospital');
    1 rij is aangemaakt.
    ual303@ORKDEV01> -- meaning 'active' for table a, column col_to_be_coded_fora, can go in
    ual303@ORKDEV01> insert into a(col_to_be_coded_fora) values ( 1);
    1 rij is aangemaakt.
    ual303@ORKDEV01> -- meaning nothing for table a, column col_to_be_coded_fora, must give error
    ual303@ORKDEV01> insert into a(col_to_be_coded_fora) values (10);
    insert into a(col_to_be_coded_fora) values (10)
    FOUT in regel 1:
    .ORA-02291: integrity constraint (UAL303.SYS_C0033537) violated - parent key not found
    ual303@ORKDEV01> -- meaning nothing for table b, column col_to_be_coded_forb, must give error
    ual303@ORKDEV01> insert into b(col_to_be_coded_forb) values ( 1);
    insert into b(col_to_be_coded_forb) values ( 1)
    FOUT in regel 1:
    .ORA-02291: integrity constraint (UAL303.SYS_C0033540) violated - parent key not found
    ual303@ORKDEV01> -- meaning 'school' for table b, column col_to_be_coded_fora, can go in
    ual303@ORKDEV01> insert into b(col_to_be_coded_forb) values (10);
    1 rij is aangemaakt.
    ual303@ORKDEV01>Cheers,
    Colin

Maybe you are looking for

  • CVS  files checked out- import problem

    Hi all, when I update a project using CVS, in 9i the tool used to prompt me like 'do you want to open new files in active project?' in 10i it doesn't , so when I create and deploy wars the new files sometimes are missing. do you know any workaround?

  • EL Expression questions

    Hi, I have two questions on the El Expression in the JSF: 1)Can anyone link a El Expression (for JSF) references page? 2)Can I use a El Expression (like the ternary selection operator) in action attributes or in actionListener or valueListener attrib

  • Question about sequence table

    hello when i set up the sequence table within the mapping work bench,i DON'T select write it to database,i wonder if i need to generate the class code for the sequence table,and put it in my project source files package with all of the other table cl

  • Contacts and Brother QL-580N Label Printer

    Hi, I'm trying to get Contacts app in Mountain Lion (previously known as Address Book) to print natively to a Brother QL-580N printer. By 'natively' I mean without having to install Brother's GUI application. At the time that I added the printer in S

  • Video length Quality

    I'm apologize if this has been discussed ahead of time. I have read that at Best Quality settings, "iDVD evaluates the amount of video and chooses the best quality setting possible" So my question is at what amount of video do I get best quality sett