Advanced Table Compression Create Table with LOBs

Hi,
I need some help with the Advanced Table Compression when creating a table especially when they contain a LOB.
Here are 3 examples:
Exp#1
CREATE TABLE emp (
      emp_id NUMBER, 
      first_name VARCHAR2(128), 
      last_name VARCHAR2(128)
) COMPRESS FOR OLTP;
This one is ok - all elements are compressed.
Exp#2
CREATE TABLE photos (
      photo_id NUMBER,
      photo BLOB)
      LOB(photo) STORE AS SECUREFILE (COMPRESS LOW);
This one I am confused - is it just the LOB(photo) that is compressed or the whole table. If it is just the LOB then what syntax do I need for the whole table?
I also assume that the LOB is being stored in the default tablespace associated with this table - correct me if I am wrong!
Exp#3
CREATE TABLE images (
      image_id NUMBER,
      image BLOB)
      LOB(image) STORE AS SECUREFILE (TABLESPACE lob_tbs COMPRESS);
This one I am confused - I think it is telling me that LOB(image) is being compresses and stored in tablespace lob_tbs and the other elements are being stored uncompressed in the default tablespace.
Again if it is just the LOB then what syntax do I need for the whole table?
Thanks & regards
-A

Welcome to the forums !
Pl post details of OS, database and EBS versions. Pl be aware that Advanced Compression is a separately licensed product. Pl see if these links help
http://blogs.oracle.com/stevenChan/2008/10/using_advanced_compression_with_e-business_suite.html
http://blogs.oracle.com/stevenChan/2008/11/early_benchmarks_using_advanced_compression_with_ebs.html
http://blogs.oracle.com/stevenChan/2010/05/new_whitepaper_advanced_compression_11gr1_benchmar.html
HTH
Srini

Similar Messages

  • Updating an existing table using Create Table As

    I want to update a table, because the schema has changed..
    Example:
    create table a (a number(2), b varchar(2) NOT NULL);
    insert into a values (22, 'JA');
    Suppose i want to ad a column c number(3) between a and b, and i want to increase datalength of b to 3,
    the i perform the following
    create table a_temp as (select a, cast(0 as number(3)) c, cast(b as varchar(3)) b from a);
    drop table a;
    rename a_temp to a;
    But now all columns allow null... I want the last column to be NOT NULL!
    How do i do this (within the statement)?
    Then another question, the statement:
    RENAME a_temp to a;
    does not allow the owner name in it,
    but how does it know which table it has to rename?
    Cant you rename a table for another owner?
    Is it true that owner==tablespace?
    Thanks in advance

    You may find this article helpful:
    http://www.dizwell.com/prod/node/63
    It uses the online table redefinition capability to partition a table which previously wasn't partitioned. It's exactly the same principle adding a column, changing constraints, renaming columns, making columns longer and so on.
    You might also find this article useful:
    http://www.dizwell.com/prod/node/64
    It discusses the issues surrounding renaming a table, including how I can rename your tables.
    Generally, you might want to poke around the articles link at www.dizwell.com if you are in a learning sort of mood.
    No, it's not true that owner=tablespace. A tablespace is a logical way of thinking of a set of physical data files. Those files can contain anything (index, cluster, table, materialized view) owned by anyone who happens to have the rights to store things there. Therefore, the tablespace representation of those files also contains lots of objects owned by lots of users.
    The only relationship between an owner and a tablespace is that when I create you as a user, I state which tablespace will be used to store your objects **by default** -but that default can always be over-ridden, provided that you have been granted rights (that is, space quotas) on other tablespaces.

  • Problem CREATE TABLE with PRIMARY KEY Still in Trouble ! Please Help!

    Hi there !
    I use the orcle 8i, and i don't know why i can't create table with any primary key EXample:
    SQL> CREATE TABLE O_caisses
    2 (No_caisse NUMBER(3) constraint caisses_pk PRIMARY KEY,
    3 NB_BILLETS NUMBER(5)
    4 )
    5 /
    CREATE TABLE O_caisses
    ERROR at line 1:
    ORA-18008: cannot find OUTLN schema
    ***********some Debuger show me this way: *********************
    Well there r certain point u got to notice when creating a table with constraints.
    1) U can create table with COLUMN level constraint.
    2) U can create table with TABLE level constraint.
    3) In COLUMN level constraint u can't give a constraint a name
    but only mention the type of constraint.
    4) In TABLE level constraint u can give a name to constraint.
    Following are the examples of both
    --COLUMN LEVEL
    CREATE TABLE O_caisses
    (No_caisse NUMBER(3) PRIMARY KEY,
    NB_BILLETS NUMBER(5));
    --TABLE LEVEL
    CREATE TABLE O_caisses
    (No_caisse NUMBER(3),
    NB_BILLETS NUMBER(5),
    constraint pk_caisse primary key (No_caisse));
    ********************And this is another one:*****************
    SQL>grant create any outline to username;
    BUT the problem is still present, i don't know what to do now !
    Please could some body help me !
    Thanks alot!
    Luong.

    The clue is in the error message: the OUTLN schema is missing.
    This is something Oracle 8i introduced to help manage the CBO (or soemthing equally geeky and internal). For some reason your database no longer has this user. It ought to be created automatically during installation (or upgrade) but catproct may not have completed probably or some over zealous admin type has dropped it.
    Solution is to re-install (or re-upgrade) as you cannot create this user on their own. Alas.
    HTH, APC

  • How can I add a new column in compress partition table.

    I have a compress partition table when I add a new column in that table it give me an error "ORA-22856: CANNOT ADD COLUMNS TO OBJECT TABLES". I had cretaed a table in this clause. How can I add a new column in compress partition table.
    CREATE TABLE Employee
    Empno Number,
    Tr_Date Date
    COMPRESS PARTITION BY RANGE (Tr_Date)
    PARTITION FIRST Values LESS THAN (To_Date('01-JUL-2006','DD-MON-YYYY')),
    PARTITION JUNK Values LESS THAN (MAXVALUE));
    Note :
    When I create table with this clause it will allow me to add a column.
    CREATE TABLE Employee
    Empno Number,
    Tr_Date Date
    PARTITION BY RANGE (Tr_Date)
    PARTITION FIRST Values LESS THAN (To_Date('01-JUL-2006','DD-MON-YYYY')),
    PARTITION JUNK Values LESS THAN (MAXVALUE));
    But for this I have to drop and recreate the table and I dont want this becaue my table is in online state i cannot take a risk. Please give me best solution.

    Hi Fahed,
    I guess, you are using Oracle 9i Database Release 9.2.0.2 and the Table which you need to alter is in OLTP environment where data is usually inserted using regular inserts. As a result, these tables generally do not get much benefit from using table compression. Table compression works best on read-only tables that are loaded once but read many times. Tables used in data warehousing applications, for example, are great candidates for table compression.
    Reference : http://www.oracle.com/technology/oramag/oracle/04-mar/o24tech_data.html
    Topic : When to Use Table Compression
    Bug
    Reference : http://dba.ipbhost.com/lofiversion/index.php/t147.html
    BUG:<2421054>
    Affects: RDBMS (9-A0)
    NB: FIXED
    Abstract: ENH: Allow ALTER TABLE to ADD/DROP columns for tables using COMPRESS feature
    Details:
    This is an enhancement to allow "ALTER TABLE" to ADD/DROP
    columns for tables using the COMPRESS feature.
    In 9i errors are reported for ADD/DROP but the text may
    be misleading:
    eg:
    ADD column fails with "ORA-22856: cannot add columns to object tables"
    DROP column fails with "ORA-12996: cannot drop system-generated virtual column"
    Note that a table which was previously marked as compress which has
    now been altered to NOCOMPRESS also signals such errors as the
    underlying table could still contain COMPRESS format datablocks.
    As of 10i ADD/SET UNUSED is allowed provided the ADD has no default value.
    Best Regards,
    Muhammad Waseem Haroon
    [email protected]

  • Create table runs in Toad but not in Linux

    Hello,
    I've just started writing in SQL 3 days ago so I would like to apologize in advance for the shabby code and the stupid question. I'm hoping that somebody can help me with my problem.
    Anyway, this has been bugging me for 2 days now and I can't seem to find the problem. The code below is just a simple create table that I coded in Toad for Oracle by Quest Software and runs fine in it but when I try to copy it over to our linux server and run it using '@/home/user/atm_dc.sql', the table is not created.
    Can someone help me?
    Thanks.
    drop table atm_dc;
    CREATE TABLE atm_dc
    AS (
    SELECT
    'I' as action_code,
    rpad(' ',22,' ') as card_num,
    rpad(' ',24,' ') as client_cd,
    '000119' as inst_cd,
    rpad(sa01mast.brncd,6,' ') as branch_cd,
    ' ' as vip_flag,
    ' ' as owner_cd,
    '0' as basic_card_flag,
    rpad(' ',22,' ') as basic_card_num,
    rpad(' ',4,' ') as title,
    case when length(cf01cif.sname) > 0 then
    rpad(cf01cif.sname,20,' ') else
    rpad(' ',20,' ') end as family_name,
    rpad(' ',20,' ') as first_name,
    rpad(' ',26,' ') as embossed_name,
    rpad(' ',26,' ') as encoded_name,
    case when length(cf01cif.maritsts) > 0 then
    case when cf01cif.maritsts in ('M') then '2' else '1' end else
    ' ' end as marital_status,
    case when length(cf01cif.sex) > 0 then
    case when cf01cif.sex in ('F') then 'F' else 'M' end else
    ' ' end as gender,
    rpad(' ',15,' ') as legal_id,
    '608' as nationality_code,
    '00' as num_of_children,
    rpad('0',12,'0') as credit_limit,
    '0' as issuers_client,
    ' ' as lodging_period,
    ' ' as res_status,
    rpad('0',12,'0') as net_yearly_income,
    '00' as no_of_dependents,
    case when length(cf01cif.birthdt) > 0 then
    to_char(cf01cif.birthdt,'YYYYMMDD') else rpad(' ',8,' ')
    end as birth_date,
    rpad(' ',5,' ') as birth_city,
    case when length(cf01cif.cntry) > 0 then
    rpad(cf01cif.cntry,3,' ') else rpad(' ',3,' ')
    end as birth_cntry,
    case when length(cf01addr.addr1) > 0 then
    rpad(substr(cf01addr.addr1,1,30),30,' ') else rpad(' ',30,' ')
    end as address1,
    case when length(cf01addr.addr2) > 0 then
    rpad(substr(cf01addr.addr2,1,30),30,' ') else rpad(' ',30,' ')
    end as address2,
    case when length(cf01addr.addr3) > 0 then
    rpad(substr(cf01addr.addr3,1,30),30,' ') else rpad(' ',30,' ')
    end as address3,
    case when length(cf01addr.addr4) > 0 then
    rpad(substr(cf01addr.addr4,1,30),30,' ') else rpad(' ',30,' ')
    end as address4,
    case when length(cf01addr.city) > 0 then
    rpad(substr(cf01addr.city,1,5),5,' ') else rpad(' ',5,' ')
    end as city_code,
    case when length(cf01addr.postcd) > 0 then
    rpad(cf01addr.postcd,10,' ') else rpad(' ',10,' ')
    end as zip_code,
    case when length(cf01addr.cntry) > 0 then
    rpad(cf01addr.cntry,3,' ') else
    rpad(' ',3,' ') end as country_code,
    rpad(' ',15,' ') as phone_no1,
    rpad(' ',15,' ') as phone_no2,
    rpad(' ',15,' ') as mobile_phone,
    rpad(' ',50,' ') as email_id,
    rpad(' ',40,' ') as employer,
    rpad(' ',30,' ') as emp_addr1,
    rpad(' ',30,' ') as emp_addr2,
    rpad(' ',30,' ') as emp_addr3,
    rpad(' ',30,' ') as emp_addr4,
    rpad(' ',5,' ') as emp_city_cd,
    rpad(' ',10,' ') as emp_zip_cd,
    rpad(' ',3,' ') as emp_cntry_cd,
    rpad(' ',8,' ') as cont_start_dt,
    ' ' as emp_status,
    to_char(sa01mast2.opendt,'YYYYMMDD') as open_dt,
    rpad(' ',8,' ') as start_val_dt,
    '001' as prod_code,
    '0' as delivery_mode,
    rpad(sa01mast.brncd||sa01mast.modcd||lpad(sa01mast.acno,6,'0')||
    lpad(sa01mast.chkdgt,2,'0'),24,' ') as account1,
    'PHP' as acct1_currency,
    case when sa01mast.crline in ('SA') then '10' else '20'
    end as account1_type,
    rpad(' ',12,' ') as limit_cash_dom,
    rpad(' ',12,' ') as limit_purch_dom,
    rpad(' ',12,' ') as limit_te_dom,
    rpad(' ',12,' ') as reserved1,
    rpad(' ',12,' ') as limit_cash_int,
    rpad(' ',12,' ') as limit_purch_int,
    rpad(' ',12,' ') as limit_te_int,
    rpad(' ',12,' ') as reserved2,
    rpad(' ',12,' ') as autho_limit_dom,
    rpad(' ',12,' ') as autho_limit_int,
    rpad(' ',12,' ') as reserved3,
    rpad(' ',4,' ') as activity_cd,
    rpad(' ',4,' ') as socio_prof_code,
    '00' status_code,
    rpad(' ',10,' ') as staff_id,
    '0' as delivery_flag,
    rpad(' ',8,' ') as delivery_date,
    rpad(' ',14,' ') as bank_dsa_ref,
    rpad(' ',50,' ') as ud_field1,
    rpad(' ',50,' ') as ud_field2,
    rpad(' ',50,' ') as ud_field3,
    rpad(' ',50,' ') as ud_field4,
    rpad(' ',50,' ') as ud_field5,
    rpad(' ',26,' ') as emboss_line3,
    rpad(' ',45,' ') as mailing_addr1,
    rpad(' ',45,' ') as mailing_addr2,
    rpad(' ',45,' ') as mailing_addr3,
    rpad(' ',45,' ') as mailing_addr4,
    rpad(' ',10,' ') as mailing_zip_code,
    rpad(' ',5,' ') as mailing_city_code,
    rpad(' ',3,' ') as mailing_country_code,
    rpad(' ',15,' ') as phone_home,
    rpad(' ',15,' ') as phone_alt,
    rpad(' ',15,' ') as phone_mobile,
    '0' as photo_indicator,
    ' ' as language_indicator,
    rpad(' ',25,' ') as maiden_name,
    rpad('0',8,'0') as check_sum
    FROM cf01cif, sa01mast, cf01addr, sa01mast2
    WHERE cf01cif.cifkey=sa01mast.cifkey and
         cf01cif.cifkey=cf01addr.cifkey and
    sa01mast2.brncd = sa01mast.brncd and
    sa01mast2.modcd = sa01mast.modcd and
    sa01mast2.acno = sa01mast.acno and
    sa01mast2.chkdgt = sa01mast.chkdgt and
              sa01mast2.opendt < sysdate
    );

    You can use the SPOOL command to create a output file. Run the below script. This will create a file "output.log". Check in the file for any error messages
    set echo on
    spool output.log
    drop table atm_dc
    CREATE TABLE atm_dc
    AS (
    SELECT
    'I' as action_code,
    rpad(' ',22,' ') as card_num,
    rpad(' ',24,' ') as client_cd,
    '000119' as inst_cd,
    rpad(sa01mast.brncd,6,' ') as branch_cd,
    ' ' as vip_flag,
    ' ' as owner_cd,
    '0' as basic_card_flag,
    rpad(' ',22,' ') as basic_card_num,
    rpad(' ',4,' ') as title,
    case when length(cf01cif.sname) > 0 then
    rpad(cf01cif.sname,20,' ') else
    rpad(' ',20,' ') end as family_name,
    rpad(' ',20,' ') as first_name,
    rpad(' ',26,' ') as embossed_name,
    rpad(' ',26,' ') as encoded_name,
    case when length(cf01cif.maritsts) > 0 then
    case when cf01cif.maritsts in ('M') then '2' else '1' end else
    ' ' end as marital_status,
    case when length(cf01cif.sex) > 0 then
    case when cf01cif.sex in ('F') then 'F' else 'M' end else
    ' ' end as gender,
    rpad(' ',15,' ') as legal_id,
    '608' as nationality_code,
    '00' as num_of_children,
    rpad('0',12,'0') as credit_limit,
    '0' as issuers_client,
    ' ' as lodging_period,
    ' ' as res_status,
    rpad('0',12,'0') as net_yearly_income,
    '00' as no_of_dependents,
    case when length(cf01cif.birthdt) > 0 then
    to_char(cf01cif.birthdt,'YYYYMMDD') else rpad(' ',8,' ')
    end as birth_date,
    rpad(' ',5,' ') as birth_city,
    case when length(cf01cif.cntry) > 0 then
    rpad(cf01cif.cntry,3,' ') else rpad(' ',3,' ')
    end as birth_cntry,
    case when length(cf01addr.addr1) > 0 then
    rpad(substr(cf01addr.addr1,1,30),30,' ') else rpad(' ',30,' ')
    end as address1,
    case when length(cf01addr.addr2) > 0 then
    rpad(substr(cf01addr.addr2,1,30),30,' ') else rpad(' ',30,' ')
    end as address2,
    case when length(cf01addr.addr3) > 0 then
    rpad(substr(cf01addr.addr3,1,30),30,' ') else rpad(' ',30,' ')
    end as address3,
    case when length(cf01addr.addr4) > 0 then
    rpad(substr(cf01addr.addr4,1,30),30,' ') else rpad(' ',30,' ')
    end as address4,
    case when length(cf01addr.city) > 0 then
    rpad(substr(cf01addr.city,1,5),5,' ') else rpad(' ',5,' ')
    end as city_code,
    case when length(cf01addr.postcd) > 0 then
    rpad(cf01addr.postcd,10,' ') else rpad(' ',10,' ')
    end as zip_code,
    case when length(cf01addr.cntry) > 0 then
    rpad(cf01addr.cntry,3,' ') else
    rpad(' ',3,' ') end as country_code,
    rpad(' ',15,' ') as phone_no1,
    rpad(' ',15,' ') as phone_no2,
    rpad(' ',15,' ') as mobile_phone,
    rpad(' ',50,' ') as email_id,
    rpad(' ',40,' ') as employer,
    rpad(' ',30,' ') as emp_addr1,
    rpad(' ',30,' ') as emp_addr2,
    rpad(' ',30,' ') as emp_addr3,
    rpad(' ',30,' ') as emp_addr4,
    rpad(' ',5,' ') as emp_city_cd,
    rpad(' ',10,' ') as emp_zip_cd,
    rpad(' ',3,' ') as emp_cntry_cd,
    rpad(' ',8,' ') as cont_start_dt,
    ' ' as emp_status,
    to_char(sa01mast2.opendt,'YYYYMMDD') as open_dt,
    rpad(' ',8,' ') as start_val_dt,
    '001' as prod_code,
    '0' as delivery_mode,
    rpad(sa01mast.brncd||sa01mast.modcd||lpad(sa01mast.acno,6,'0')||
    lpad(sa01mast.chkdgt,2,'0'),24,' ') as account1,
    'PHP' as acct1_currency,
    case when sa01mast.crline in ('SA') then '10' else '20'
    end as account1_type,
    rpad(' ',12,' ') as limit_cash_dom,
    rpad(' ',12,' ') as limit_purch_dom,
    rpad(' ',12,' ') as limit_te_dom,
    rpad(' ',12,' ') as reserved1,
    rpad(' ',12,' ') as limit_cash_int,
    rpad(' ',12,' ') as limit_purch_int,
    rpad(' ',12,' ') as limit_te_int,
    rpad(' ',12,' ') as reserved2,
    rpad(' ',12,' ') as autho_limit_dom,
    rpad(' ',12,' ') as autho_limit_int,
    rpad(' ',12,' ') as reserved3,
    rpad(' ',4,' ') as activity_cd,
    rpad(' ',4,' ') as socio_prof_code,
    '00' status_code,
    rpad(' ',10,' ') as staff_id,
    '0' as delivery_flag,
    rpad(' ',8,' ') as delivery_date,
    rpad(' ',14,' ') as bank_dsa_ref,
    rpad(' ',50,' ') as ud_field1,
    rpad(' ',50,' ') as ud_field2,
    rpad(' ',50,' ') as ud_field3,
    rpad(' ',50,' ') as ud_field4,
    rpad(' ',50,' ') as ud_field5,
    rpad(' ',26,' ') as emboss_line3,
    rpad(' ',45,' ') as mailing_addr1,
    rpad(' ',45,' ') as mailing_addr2,
    rpad(' ',45,' ') as mailing_addr3,
    rpad(' ',45,' ') as mailing_addr4,
    rpad(' ',10,' ') as mailing_zip_code,
    rpad(' ',5,' ') as mailing_city_code,
    rpad(' ',3,' ') as mailing_country_code,
    rpad(' ',15,' ') as phone_home,
    rpad(' ',15,' ') as phone_alt,
    rpad(' ',15,' ') as phone_mobile,
    '0' as photo_indicator,
    ' ' as language_indicator,
    rpad(' ',25,' ') as maiden_name,
    rpad('0',8,'0') as check_sum
    FROM cf01cif, sa01mast, cf01addr, sa01mast2
    WHERE cf01cif.cifkey=sa01mast.cifkey and
    cf01cif.cifkey=cf01addr.cifkey and
    sa01mast2.brncd = sa01mast.brncd and
    sa01mast2.modcd = sa01mast.modcd and
    sa01mast2.acno = sa01mast.acno and
    sa01mast2.chkdgt = sa01mast.chkdgt and
    sa01mast2.opendt < sysdate
    spool off

  • Error when CREATE TABLE

    Hi,
    I'm trying to create the following table
    SQL>  CREATE TABLE T_IMP (
      2      C_ID VARCHAR2(16 BYTE) NOT NULL ENABLE,
      3      I_ID VARCHAR2(50 BYTE) NOT NULL ENABLE,
      4      POWER NUMBER(*,0) DEFAULT 0,
      5      HRS NUMBER(*,0) DEFAULT 0,
      6      KWH NUMBER GENERATED ALWAYS AS (POWER*HRS) VIRTUAL VISIBLE ,
      7      ACT VARCHAR2(1 BYTE) DEFAULT 'Y' NOT NULL ENABLE,
      8      USRC VARCHAR2(64 BYTE),
      9      DATE_F DATE DEFAULT CURRENT_TIMESTAMP NOT NULL ENABLE,
    10      CONSTRAINT T_IMP_PK PRIMARY KEY (C_ID, I_ID)
    11     );But I get this error:ORA-00406: COMPATIBLE parameter needs to be 11.0.0.0.0 or greater
    ORA-00722: Feature "Virtual columns"below you can see my Oracle versione and compatible parameter:
    Oracle version: 11.2.0.1.0
    select name, value
    from v$parameter
    where name = 'compatible';
    NAME                 VALUE
    compatible           10.2.0.3.0How can I create my table with Virtual columns?
    Thanks in advance!

    R. Royal wrote:
    Ok,
    but my not-rhetorical question is:
    Can I modify the compatible parameter to allow me to create the table?Yes you can. But just make sure that the person who has set it that way does not come to you screaming!!
    Seriously, some parameter is changed by someone for some reason. The reason could be good or bad, but there must be a reason. And your job is to find it out ;)

  • SQL Developer 1.5.1 - warning messages generated by CREATE TABLE

    Hi,
    Have an issue with a CREATE TABLE statement - it works correctly, but generates a warning message when used in SQL Developer (1.2 or 1.5.1). Full test case below:
    Setup:
    drop table samplenames;
    drop table customers;
    drop table phones;
    drop table customers_phone;
    drop sequence primkey;
    create table samplenames
    (name VARCHAR2(10));
    insert into samplenames values ('dan');
    insert into samplenames values ('joe');
    insert into samplenames values ('bob');
    insert into samplenames values ('sam');
    insert into samplenames values ('weslington');
    insert into samplenames values ('sue');
    insert into samplenames values ('ann');
    insert into samplenames values ('mary');
    insert into samplenames values ('pam');
    insert into samplenames values ('lucy');
    create sequence primkey
    start with 1000000
    increment by 1;
    create table customers as
    select primkey.nextval as cust_id,
    tmp1.name || tmp2.name as first_name,
    tmp3.name || tmp4.name || tmp5.name as last_name
    from samplenames tmp1,
    samplenames tmp2,
    samplenames tmp3,
    samplenames tmp4,
    samplenames tmp5;
    CREATE TABLE PHONES AS
    SELECT cust_id, 'H' as phn_loc, trunc(dbms_random.value(100,999)) as area_cde,
    trunc(dbms_random.value(1000000,9999999)) as phn_num
    FROM customers;
    INSERT INTO PHONES
    SELECT cust_id, 'B' as phn_loc, trunc(dbms_random.value(100,999)) as area_cde,
    trunc(dbms_random.value(1000000,9999999)) as phn_num
    FROM customers;
    --randomly delete ~10% of records to make sure nulls are handled correctly.
    delete from phones
    where MOD(area_cde + phn_num, 10) = 0;
    create table statement (there are legacy reasons for why this is written the way it is):
    CREATE TABLE customers_phone NOLOGGING AS
    SELECT cst.*,
    piv.HOME_PHONE,
    piv.WORK_PHONE
    FROM (SELECT cust_id,
    MAX(decode(phn_loc, 'H', '(' || area_cde || ') ' ||
    substr(phn_num,1,3) || '-' || substr(phn_num,4,4), NULL)) AS HOME_PHONE,
    MAX(decode(phn_loc, 'B', '(' || area_cde || ') ' ||
    substr(phn_num,1,3) || '-' || substr(phn_num,4,4), NULL)) AS WORK_PHONE
    FROM phones phn
    WHERE phn_loc IN ('H', 'B')
    AND cust_id IS NOT NULL
    AND EXISTS (SELECT NULL
    FROM customers
    WHERE cust_id = phn.cust_id)
    GROUP BY cust_id) piv,
    customers cst
    WHERE cst.cust_id = piv.cust_id (+)
    Warning message output:
    "Error starting at line 1 in command:
    CREATE TABLE customers_phone NOLOGGING AS
    SELECT cst.*,
    piv.HOME_PHONE,
    piv.WORK_PHONE
    FROM (SELECT cust_id,
    MAX(decode(phn_loc, 'H', '(' || area_cde || ') ' || substr(phn_num,1,3) || '-' || substr(phn_num,4,4), NULL)) AS HOME_PHONE,
    MAX(decode(phn_loc, 'B', '(' || area_cde || ') ' || substr(phn_num,1,3) || '-' || substr(phn_num,4,4), NULL)) AS WORK_PHONE
    FROM phones phn
    WHERE phn_loc IN ('H', 'B')
    AND cust_id IS NOT NULL
    AND EXISTS (SELECT NULL
    FROM customers
    WHERE cust_id = phn.cust_id)
    GROUP BY cust_id) piv,
    customers cst
    WHERE cst.cust_id = piv.cust_id (+)
    Error report:
    SQL Command: CREATE TABLE
    Failed: Warning: execution completed with warning"
    I am on 10.2.0.3. The CREATE TABLE always completes successfully, but the warning bugs me, and I have had no success tracking it down since there is no associated numberr.
    Anyone have any ideas?

    Hi ,
    The Oracle JDBC driver is returning this warning so I will be logging an issue with them, but for the moment SQL Developer will continue to report the warning as is.
    The reason for the warning is not clear or documented as far as I can tell,
    but I have replicated the issue with a simpler testcase which makes it easier to have a guess about the issue :)
    ----START
    DROP TABLE sourcetable ;
    CREATE TABLE sourcetable(col1 char);
    INSERT INTO sourcetable VALUES('M');
    DROP TABLE customers_phone;
    CREATE TABLE customers_phone AS
    SELECT MAX(decode(col1, 'm','OK' , NULL)) COLALIAS
    FROM sourcetable;
    ----END
    The warning occurs in the above script in SQL Developer , but not in SQL*Plus.
    The warning disappears when we change 'm' to 'M'.
    The warning disappears when we change NULL to 'OK2'
    In all cases the table creates successfully and the appropriate values inserted.
    My gut feeling is ...
    During the definition of customers_phone, Oracle has to work out what the COLALIAS datatype is.
    When it sees NULL as the only alternative (as sourcetable.col1 = 'M' not 'm') it throws up a warning. It then has to rely on the 'OK' value to define the COLALIAS datatype, even though the 'OK' value wont be inserted as sourcetable.col1 = 'M' and not 'm'. So Oracle makes the correct decision to define the COLALIAS as VARCHAR2(2), but the warning is just to say it had to use the alternative value to define the column.
    Why SQL*Plus does not report it and JDBC does, I'm not sure. Either way it doesn't look like a real issue.
    Again, this is just a guess and not a fact.
    Just though an update was in order.
    Regards,
    Dermot.

  • Syntax error in creating table

    Could some one plz help me as to what is wrong in creating below table structure:
    create table test as (select * from schema.tablename where 1=2)
    TABLESPACE PCR_ARCHIVE_DATA_04
    PCTUSED 0
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    NOLOGGING
    COMPRESS
    NOCACHE
    PARALLEL ( DEGREE 6 INSTANCES 1 )
    MONITORING;

    AS SELECT comes after physical attributes, like
    create table test TABLESPACE PCR_ARCHIVE_DATA_04
    PCTUSED 0
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 64K
    MINEXTENTS 1
    MAXEXTENTS UNLIMITED
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    NOLOGGING
    COMPRESS
    NOCACHE
    PARALLEL ( DEGREE 6 INSTANCES 1 )
    MONITORING
    as (select * from schema.tablename where 1=2)Best regards
    Maxim

  • NESTED Tables for Sub-types when creating table for Super-type

    If I create the following types, as an example:
    Person with subtypes: Employee and Customer
    Appointment
    CREATE OR REPLACE TYPE Person_OT AS OBJECT (
    person#                         NUMBER,
    personSurname                    VARCHAR2(50),
    personForenames               VARCHAR2(50),
    personDateOfBirth               DATE,
    personAddress                    Address_OT,
    ) NOT FINAL ;
    CREATE OR REPLACE TYPE Employee UNDER Person_OT (
    empSalary               NUMBER,
    empNoSales          NUMBER,
    makes               Appointment_List_OT
    ) FINAL ;
    CREATE OR REPLACE TYPE Appointment_OT AS OBJECT (
    some attributes
    CREATE OR REPLACE TYPE Appointment_List_OT AS TABLE OF REF Appointment_OT ;
    When creating the table to hold objects of Person type, how can the requisite nested table for representing 'makes' be declared? The below approach is not correct, however the table will not compile without naming the nested tables.
    CREATE TABLE Person_TBL OF Person_OT (
    Person#     PRIMARY KEY)
    NESTED TABLE makes STORE AS Appointment_List_NTBL;
    Advice very much appreciated!

    CREATE TABLE Person_TBL OF Person_OT(
    Person# PRIMARY KEY)
    NESTED TABLE TREAT(SYS_NC_ROWINFO$ AS EMPLOYEE).MAKES STORE AS Appointment_List_NTBL
    Table created.
    SQL> select * from user_nested_tables
      2  /
    TABLE_NAME                     TABLE_TYPE_OWNER
    TABLE_TYPE_NAME                PARENT_TABLE_NAME
    PARENT_TABLE_COLUMN
    STORAGE_SPEC                   RETURN_TYPE          ELEMENT_SUBSTITUTABLE
    APPOINTMENT_LIST_NTBL          SCOTT
    APPOINTMENT_LIST_OT            PERSON_TBL
    TREAT(SYS_NC_ROWINFO$ AS "SCOTT"."EMPLOYEE")."MAKES"
                           DEFAULT                VALUE                         N
    SQL>  SY.

  • How to create table using mysql in LabVIEW

    Hii
               I am using mysql database Toolkit for my project.  In that how to New create a table. Is there any possiblilites to create a table using query...can u send a sample prg ... and inform which toolkit Vi to use....  

    The SQL syntax for creating a table is:
    CREATE TABLE table_name
    column_name1 data_type,
    column_name2 data_type,
    column_name3 data_type,
    )The toolkit has a funciton called DB Tools Create Table. That would be the obvious function to use if you don't want to execute a SQL query to create the table. The tooklit comes with examples. Have you looked at them? There's one called Create Database Table that  would seem to be exactly what you are looking for.

  • Create table by another table query wid contraints

    how can we create table by another table but wid all the constraints of that table means
    create table emp_test as select * from emp
    it will create the replica of emp table but not constraints so how can i creat table along wid constraints

    Mushy wrote:
    i cant do this i have more than 200 tables to create wid the create table statement so any simple method to create table including constrains of that table otherwise i have to make a lot of changes in this codee etcc etcc
    thanks a lot for ur replyYou can automate it. Something to start with:
    SET SERVEROUTPUT ON FORMAT WORD_WRAPPED
    DECLARE
        v_new_def CLOB;
    BEGIN
        FOR v_rec IN (select table_name,dbms_metadata.get_ddl('TABLE',table_name) def from user_tables where table_name in ('EMP','DEPT')) LOOP
          v_new_def := v_rec.def;
          FOR v_list IN (select table_name from user_tables where table_name in ('EMP','DEPT')) LOOP
            v_new_def := replace(
                                 v_new_def,
                                 '"' || USER || '"."' || v_list.table_name || '"',
                                 '"' || USER || '"."' || v_list.table_name || '_TEST"'
          END LOOP;
          v_new_def := replace(
                               v_new_def,
                               '"PK_' || v_rec.table_name || '"',
                               '"PK_' || v_rec.table_name || '_TEST"'
          dbms_output.put_line(v_new_def);
        END LOOP;
    END;
      CREATE TABLE "SCOTT"."DEPT_TEST"
       (    "DEPTNO" NUMBER(2,0),
            "DNAME" VARCHAR2(14),
            "LOC" VARCHAR2(13),
             CONSTRAINT
    "PK_DEPT_TEST" PRIMARY KEY ("DEPTNO")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536
    NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE
    "USERS"  ENABLE
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576
    MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"
      CREATE TABLE "SCOTT"."EMP_TEST"
       (    "EMPNO" NUMBER(4,0),
            "ENAME" VARCHAR2(10),
            "JOB" VARCHAR2(9),
            "MGR" NUMBER(4,0),
            "HIREDATE" DATE,
            "SAL" NUMBER(7,2),
            "COMM" NUMBER(7,2),
            "DEPTNO" NUMBER(2,0),
             CONSTRAINT "PK_EMP_TEST" PRIMARY KEY
    ("EMPNO")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1
    MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"  ENABLE,
             CONSTRAINT
    "FK_DEPTNO" FOREIGN KEY ("DEPTNO")
              REFERENCES "SCOTT"."DEPT_TEST" ("DEPTNO") ENABLE
       ) PCTFREE 10 PCTUSED 40 INITRANS 1
    MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1
    FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERS"
    PL/SQL procedure successfully completed.
    SQL>  SY.

  • ORA-00911 w/create table

    I'm trying to execute an SQL file with the following code:
    create table "t_ap_xml"
    "XML_ID" NUMBER,
    "XML_NAME" VARCHAR2(128),
    "XML_TYPE" VARCHAR(32),
    "XML_CONTENT" "SYS"."XML_TYPE",
    "XML_DESCRIPTION" VARCHAR2(4000)
    ..And i'm receiving the following error:
    ERROR at line 8:
    ORA-00911: invalid character
    It is pointing to the semicolon as the problem. If i remove the semicolon, it seems to work. But if I place that code in a DDL with other create table commands, it gives me a ORA-00922 error at the line with the next create statement. Any ideas? Thanks.

    I guess I should have been a bit more clear..
    I am using SQL*Plus, and GET-ing a text .sql file made in a text editor.
    It seems to work without the semicolon and only creating that single table. However, a problem occurs when trying to use multiple CREATE TABLE statements in the same sql file.
    So for example.. here is an excerpt:
    create table t_ap_xml
    create table another_table
    Generates the following error:
    ORA-00922: missing or invalid option
    ..That error occurs on the line in which the second CREATE TABLE statement was issued.
    Thanks for any help!

  • Special Characters in Create Table......

    How can I use & sign in the column name in Create Table Statement:
    Create Table
    (aa&bb varchar2(10));

    You can create table with column name having "&" in the following way... but I won't recommend that because you'll have problems when you would need to Query the table or perform any DML operation!!
    SQL> Create Table not_good_practise
    2 ("aa&bb" varchar2(10));
    Enter value for bb: &bb
    old 2: ("aa&bb" varchar2(10))
    new 2: ("aa&bb" varchar2(10))
    Table created.
    SQL> desc not_good_practise
    Name Null? Type
    aa&bb VARCHAR2(10)
    SQL> drop table not_good_practise;
    Table dropped.
    Be sure ... why you want to do something like this before you put it in your design.

  • Logical Standy - create table error

    Hi,
    I have a primary database from which i create a new table as:
    create table abc as select * from xyz;
    On the logical standby the table is NOT created and I get lots of PL/SQL errors in the alert_log created via the STDBYLOG session. The table cannot be created and I have to skip it manually.
    should the create table statement work on the logical standby automatically? Has anyone else used this with success.
    Thanks,
    Steve.

    By default, DDL on the primary should be replicated on the logical standby (at least in Oracle 9.2-- haven't looked into earlier versions). There is a section in the Oracle Data Guard Administrator's Guide on how to skip applying DDL to the logical standby http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96653/manage_ls.htm#1017328. Is it possible that the standby system was configured to ignore new tables?
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Table compression and alter table statement

    Friends
    I am trying to add columns to a table which is compressed. Since Oracle treats compressed tables as Object tables, I cannot add columns directly so I tried to uncompress table first and then add columns. This doesnt seems to work.
    What could be issue.
    Thanks
    Vishal V.
    Script to test is here and results are below.
    -- Test1 => add columns to uncompressed table -> Success
    DROP TABLE TAB_COMP;
    CREATE TABLE TAB_COMP(ID NUMBER) NOCOMPRESS;
    ALTER TABLE TAB_COMP ADD (NAME VARCHAR2(10));
    -- Test2 =. try adding columns to compressed tables, uncompress it and then try again -> Fails
    DROP TABLE TAB_COMP;
    CREATE TABLE TAB_COMP(ID NUMBER) COMPRESS;
    ALTER TABLE TAB_COMP ADD (NAME VARCHAR2(10));
    ALTER TABLE TAB_COMP move NOCOMPRESS;
    ALTER TABLE TAB_COMP ADD (NAME VARCHAR2(10));
    SQL> -- Test1 => add columns to uncompressed table -> Success
    SQL> DROP TABLE TAB_COMP;
    Table dropped.
    SQL> CREATE TABLE TAB_COMP(ID NUMBER) NOCOMPRESS;
    Table created.
    SQL> ALTER TABLE TAB_COMP ADD (NAME VARCHAR2(10));
    Table altered.
    SQL>
    SQL> -- Test2 =. try adding columns to compressed tables, uncompress it and then try again -> Fails
    SQL> DROP TABLE TAB_COMP;
    Table dropped.
    SQL> CREATE TABLE TAB_COMP(ID NUMBER) COMPRESS;
    Table created.
    SQL> ALTER TABLE TAB_COMP ADD (NAME VARCHAR2(10));
    ALTER TABLE TAB_COMP ADD (NAME VARCHAR2(10))
    ERROR at line 1:
    ORA-22856: cannot add columns to object tables
    SQL> ALTER TABLE TAB_COMP move NOCOMPRESS;
    Table altered.
    SQL> ALTER TABLE TAB_COMP ADD (NAME VARCHAR2(10));
    ALTER TABLE TAB_COMP ADD (NAME VARCHAR2(10))
    ERROR at line 1:
    ORA-22856: cannot add columns to object tables

    Which version of oracle you are using?
    1* create table test1234(a number) compress
    SQL> /
    Table created.
    Elapsed: 00:00:00.02
    SQL> alter table test1234 add(b varchar2(200));
    Table altered.
    Elapsed: 00:00:00.02

Maybe you are looking for

  • Print Quality Opions MIA!

    I no longer have print quality options since I've upgraded to Leopard. I'm using an HP 930c and it would allow me before to select different qualities such as black and white, draft as well as make presets. I can't seem to find any answers on this. I

  • HT4527 how do you move music from one library to a new library

    I need to move my music from one itues library to a new library. How do I do this without having to re download all my music CDs?

  • Java.lang.Exception: ORA-00020: maximum number of processes (150) exceeded?

    When i run my web-application with the embedded OC4J server, the following error message is prompted: java.lang.Exception: ORA-00020: maximum number of processes (150) exceeded      void MyFolder.objects.MyObject.<init>(oracle.jbo.ApplicationModule,

  • Send and Schedule Tab in OBIEE are not enable.

    Hi expert, My scheduler is working fine with presentation services. But in BI Publisher schedule and send button are not enabled. Do we need to configure anything... Thanks, S

  • Adding transitions after extracting audio

    hello, does anyone know if you can add transitions or even certain transitions after you have extracted audio without affecting the synch of audio and video. in my case i needed to extract the whole audio portion, add clips, and now am trying to add