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

Similar Messages

  • 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

  • Problem with check constraint in mysql

    I am using mysql v8.14 and I have a problem on CHECK which is given below. I want to insert just 'friends' and 'all' on privacy attribute
    but mysql inserts everything.
    Can anyone help me, please? Thanks
    CREATE TABLE `customer`
    `cid` NUMERIC(6),
    `cname` VARCHAR(25),
    `password` VARCHAR(6),
    `email` VARCHAR(25),
    `phone` NUMERIC(12),
    `privacy` VARCHAR(10),
    PRIMARY KEY (`cid`),
    CHECK (`privacy`= `friends` OR `privacy`= `all`)
    );

    I am not familiar with MySQL syntax, but I would offer this observation:
    In your definition of the check constraint:
    CHECK (`privacy`= `friends` OR `privacy`= `all`)you are using the same delimiters (`) around both your column names and your literals. Is that correct?
    i.e. in Oracle I would use
    CHECK(privacy = 'friends' OR privacy = 'all')because privacy is not a literal, it is a column name.
    Is your syntax correct?

  • 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

  • Problem in creating CHECK constraint

    While creating a table, i want to apply a CHECK constraint, that pension_amount should be in accordance of pension_code, i am getting error mentioned below.
    CREATE TABLE pension_amount_check
       pension_amount         NUMBER (4),
       pension_code   NUMBER (1),
       CONSTRAINT amount_chk CHECK
          (CASE
              WHEN pension_code = 1 THEN (pension_amount = 3000 OR pension_amount > 3000)
              WHEN pension_code = 2 THEN pension_amount = 1500
           end)
    ORA-00907: missing right parenthesisHow i can resolve this.

    CREATE TABLE pension_amount_check
       pension_amount         NUMBER (4),
       pension_code   NUMBER (1),
       CONSTRAINT amount_chk CHECK
             (pension_code = 1 AND pension_amount  >= 3000)
              OR
             (pension_code = 2 AND pension_amount  = 1500)
    )http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17125/adfns_constraints.htm#ADFNS282

  • 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.

  • 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.

  • 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

  • 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

  • Urgent Check Constraint Error

    hi
    i have a check constraint on a table B mean Nvl(Quantity,0)>=0 but when i update a table from a trigger on insertion of another table A
    with :New.Quantity -ive it gives check constraint error.
    Please Note it does not turn the balance into negative for table B
    second because im inserting in table A then :new.quantity reffers to table A values not the table B
    why this constraint error appears.
    any body suggest
    thanks in advance

    tĦ€ §µåдŋ wrote:
    i have a check constraint on a table B mean Nvl(Quantity,0)>=0 but when i update a table from a trigger on insertion of another table A
    with :New.Quantity -ive it gives check constraint error.
    Please Note it does not turn the balance into negative for table B
    second because im inserting in table A then :new.quantity reffers to table A values not the table B
    why this constraint error appears.Not urgent at all.
    So you have a constraint on table B and then a trigger on table A attempts to update table B with a negative quantity which violates the constraint and it throws a constraint error.
    That sounds right to me. What's the problem?

  • Check constraint in Data Modeler

    Hi
    I have a problem with merging two logical models.
    in first I have a table with column ranking number(2),
    in second model I modify this column:
    ranking varchar2(10) default 'A'
    and create check constraint ranking_ch:
    ranking..... check ('A', 'B',.....)
    Then I compare models I have only
    alter table....
    modify ranking varchar2(10) default 'A'
    but I have not constraint ranking_ch.
    Why?

    Thanks.
    Another topic:
    I have a problem with reverse engineering with Data Modeler:
    1.I have a simple script (*.sql):
    create table jw
    (a number(2),
    b varchar2(30)
    2.I use function file/import/ddl file - on Relational diagram is OK:
    I have table with two columns.
    3. I use function Engineer to Logical Model and I see entity with:
    a numeric_0_2_0
    b varchar_0_0_30
    Modeler creates two new domains.
    Why?

  • 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

  • Domain check constraint using column name

    Hello,
    in the domain administration of Data Modeler, I defined a domain "age",
    and set it to logical type "Integer". Now I want to define a check constraint
    for that domain, saying, that every attribute of domain "age" must have
    values greater than 18.
    But how should I specify the column name for that check-constraint, since
    I cannot know now, to which columns this domain will be applied to, and
    these columns could have different names!
    I tried {column} > 18 and hoped that {column} might be substituted by
    the appropriate column name when generating DDL but it was not,
    the DDL contained "check ( {column} > 18 ) which did of course not work.
    Does anybody have an idea?

    Thanks a lot, that solved the problem. I noticed additionally, that %COLUMN% is case sensitive, so %COLUMN% gets substituted by the column name in the DDL, while %column% does not.

  • How to Disable check constraint in cronacle

    Hi All,
    We found that one job failed in cronacle with the following error
    *ORA-20800: JCS-02138: problem with parameter "PRINT_BANNERPAGE"
    SAP recommended the soultion saying
    Disable the "Check Constraints" that are being used in the scripts currently in Cronacle or apply some patch.So we want to explore the first option i.e check constraint
    Can any one help me in Regarding the check constraints.
    Thanks in advance
    shylaja

    Hi,
    Scripts can have check constraints and reference contraints, you will find these under the script properties when you edit the script.
    I would set the constraint to optional, meaning that you still have the dropdown available but it no longer complains if it does not like the chosen value.
    Regards,
    Anton.

  • Column check constraint cannot reference other columns  !????

    Hello,
    why it don't work?
    I have read that Check Constraint must work with other columns. What is the Problem here (KK_ID)?
    DROP TABLE Pat CASCADE CONSTRAINTS;
    CREATE TABLE Pat
    PAT_ID           NUMBER(12) NOT NULL
              CONSTRAINT pat_id PRIMARY KEY initially immediate,
    NAME           VARCHAR2(50)NOT NULL initially immediate,
    date_b          DATE NOT NULL initially immediate,
    PRIVAT_KNZ VARCHAR2(20)
              CONSTRAINT PRIVAT_KNZ_ CHECK (UPPER(PRIVAT_KNZ) in ('Y','N')) initially deferred,
    KK_ID           NUMBER(10)
              CONSTRAINT KK_ID CHECK      ((UPPER(PRIVAT_KNZ) in ('N')) AND KK_ID is NOT NULL) OR ((UPPER(PRIVAT_KNZ) in ('Y')),
              CONSTRAINT REF_KEY_KK FOREIGN KEY (KK_ID)
              REFERENCES Tab2 (KK_ID) initially deferred          
    The field KK_ID must became a value if PRIVAT_KNZ has a 'N'. If PRIVAT_KNZ has a value 'Y' then can KK_ID have a NULL or a value.
    ERROR__________________________________________________________________
    DROP TABLE Patient CASCADE CONSTRAINTS
    ERROR at line 1:
    ORA-00942: table or view does not exist
              CONSTRAINT KK_ID CHECK      ((UPPER(PRIVAT_KNZ) in ('N')) AND KK_ID is NOT NULL) OR ((UPPER(PRIVAT_KNZ) in ('J')),
    ERROR at line 12:
    ORA-02438: Column check constraint cannot reference other columns
    Thank you in advance!!!!
    Andrej

    Thank You very much!
    It works great!
    But i don't understand why i must put coma, after
    KK_ID                NUMBER(10) NUll REFERENCES KRANKENKASSE ,
    And then follows the contstraint? How can i see, that constraint KK_ID belongs to column KK_ID?
    How can i make,than the constrain belongs to definition of Columns KK_ID?
    Thank you in advance!
    DROP TABLE Krankenkasse CASCADE CONSTRAINTS;
    CREATE TABLE Krankenkasse
    KK_ID                NUMBER(10)
                        CONSTRAINT KK_id_PR PRIMARY KEY,
    BEZEICHNUNG          VARCHAR2(20)
    INSERT INTO Krankenkasse VALUES(1, 'AOK');
    INSERT INTO Krankenkasse VALUES(2, 'Techniker');
    INSERT INTO Krankenkasse VALUES(3, 'Barmer');
    DROP TABLE Patient CASCADE CONSTRAINTS;
    CREATE TABLE Patient
    PATIENTEN_ID           NUMBER(12) NOT NULL
         CONSTRAINT pat_id PRIMARY KEY initially immediate,
    NACHNAME           VARCHAR2(50)NOT NULL initially immediate,
    VORNAME           VARCHAR2(20)NOT NULL initially immediate,
    ADRESSE           VARCHAR2(100)Null,
    GEB_DATUM           DATE NOT NULL initially immediate,
    PRIVAT_KNZ           VARCHAR2(20)
                   CONSTRAINT PRIVAT_KNZ CHECK (UPPER(PRIVAT_KNZ) in ('J','N'))
                   initially deferred,
    KK_ID                NUMBER(10) NUll REFERENCES KRANKENKASSE,
                   CONSTRAINT KK_ID CHECK
                   ((Upper(PRIVAT_KNZ) in ('N') AND KK_ID is NOT Null) OR (UPPER(PRIVAT_KNZ)in ('J')))
    INSERT INTO PATIENT VALUES(1,'Schmidt','Bernd','Adresse1', TO_DATE('01101965', 'DDMMRRRR'),'N',1);
    INSERT INTO PATIENT VALUES(2,'Mueller','Heiko','Adresse2', TO_DATE('15061955', 'DDMMRRRR'),'N',1);
    INSERT INTO PATIENT VALUES(3,'Becker','Josef','Adresse3', TO_DATE('03101947', 'DDMMRRRR'),'J',2);
    INSERT INTO PATIENT VALUES(4,'Winter','Paul','Adresse4', TO_DATE('01051933', 'DDMMRRRR'),'J',Null);
    INSERT INTO PATIENT VALUES(5,'Winter','Paul','Adresse4', TO_DATE('01051933', 'DDMMRRRR'),'N',Null);
    commit;
    __________________________________________________________________________

Maybe you are looking for

  • How do I edit/delete the same section of multiple tracks?

    Basically I'm doing a podcast with multiple voice tracks. Once I sync and line everything up, I still have sections of audio I want to take out. But obviously with the tracks synced, I need to delete it from all of them at once and have the audio "sn

  • Moved Library to external drive and can't get my library!

    Someone please help me! I have moved all my photos to an external drive but do not understand how I can get iPhoto to automatically recognize this and grab my photos into the library on startup. I did the same thing in iTunes and had no issues! I'm s

  • Installing Problem: Oracle 8.0.5.1 on Redhat 6.0

    Hello All, I'm an oracle and LINUX Newbi. I have been trying to install Oracle 8.0.5.1 on Redhat 6.0 and when I try to run any of the executable the application core dumps. I have tried all the fixes in the newsgroup.. ie,manually copying $ORACLE_HOM

  • Simple Select statement in MS Access

    I am not able to get this simple select statement working in MS Access. "SELECT PhotoLocation from RfidData WHERE TeamID = '"+teamID ; It is using a variable called teamID which is a string. The error is java.sql.SQLException: [Microsoft][ODBC Micros

  • Windows 7 starter OS and wireless connectivity

    Is it possible to to get wireless access for to a deskjet 4625 all in one printer through a laptop running Windows 7 starter - 32bit?  Thankyou