Create multiple view ingres column definition table
I start here in this forum because I don't know where this problem is better managed.I use an Ingres database using heterogeneous services. I create a view on Ingres in an array of Ingres.
so I issue a create in select table * view Ingres to create an oracle table in the oracle system.
It works, but when I look at the definition of the column, they are created with a multiple of 3. for example,.
varchar (5) will become a varchar2 (15)... when I use enterprise manager to view the oracle table.
Yes, Ingres has the column as a varchar, then oracle it translates varchar2. I use Oracle Rel 11Rel 2.
and Ingres is old version 2.0.
The view created on the side of Ingres is correct... but once I create a table in the view that this column
definitions of change. BTW... I tried this without notice and oracle continues to increase the size of 3.
Any ideas as to why this is happening and how to stop it?
Thank you.
I did a search on the NLS_parameters... I use AL32UTF8.
When I'm in SQLPLUS and make a remote table desc...
/ / DESC remote_table@HSLINK > > > > HSLINK is the name of ODBC db link connection.
I get the fields like ID Varchar2 (45)...
When I view it at Ingres, using Visual DBA... it's ID Varchar (15)
Published by: sgonos on July 8, 2010 07:24
main cause is the Oracle database character set. The Oracle database does not know which character set your foreign database uses. In the worst case scenario it may happen, the character abroad datababase contains unicode data and requires 3 bytes. The gateway works in byte mode and therefore the accuracy of the foreign database is triple.
At 11.2 most gateways are used to define the parameter HS_KEEP_REMOTE_COLUMN_SIZE, which prevents the precision of the column increase.
Tags: Database
Similar Questions
-
How to create a view with columns from multiple lines
I posted this in the SQL/PSL forum, but I hope that experts from the database in this group can give me ideas also, the necessity is also BI reports.
I have a table, for example, project_milestones, that has these columns in order:
PROJ_ID, milestone_name, actual_end_date
with data:
PROJ_ID, milestone_name, actual_end_date
===== ================ ==============
1001, key approval, 2009-10-02
1001, final synopsis, 2009-10-07
1001, approved final Protocol, 2009-10-15
1001, FPFV, 2010-01-10
1001, LPFV, 2010-03-12
...
1002, key approval, 2008-12-02
1002, final synopsis, 2009-01-07
1002, approved final Protocol, 2009-01-12
1002, FPFV, 2009-03-30
1002, LPFV, 2009-10-04
...
There are about 10 steps in each project.
I need to create a view for dish these data at the project level, looks like this:
PROJ_ID, key_element_date, final_synopsis_date, final_protocol_approved_date, FPFV_date, LPFV_date, key_element_to_final_synopsis_days, final_synopsis_final_protocol_days...
How can I do this?
Thank youuser9175541 wrote:
I posted this in the SQL/PSL forum, but I hope that experts from the database in this group can give me ideas also, the necessity is also BI reports.I have a table, for example, project_milestones, that has these columns in order:
PROJ_ID, milestone_name, actual_end_date
with data:
PROJ_ID, milestone_name, actual_end_date
===== ================ ==============
1001, key approval, 2009-10-02
1001, final synopsis, 2009-10-07
1001, approved final Protocol, 2009-10-15
1001, FPFV, 2010-01-10
1001, LPFV, 2010-03-12
...
1002, key approval, 2008-12-02
1002, final synopsis, 2009-01-07
1002, approved final Protocol, 2009-01-12
1002, FPFV, 2009-03-30
1002, LPFV, 2009-10-04
...
There are about 10 steps in each project.
I need to create a view for dish these data at the project level, looks like this:PROJ_ID, key_element_date, final_synopsis_date, final_protocol_approved_date, FPFV_date, LPFV_date, key_element_to_final_synopsis_days, final_synopsis_final_protocol_days...
How can I do this?
Thank you
Create a PivotTable and put "milestone_name" in the columns, under the labels section.
Put 'actual_end_date' in the section of measures and to change the rule of the aggregation of 'Max '.
The rest of the attributes keep in the lines section. -
How to create a view in the DB table for some servers
Hello
We need create a country table which will contain data for countries.
I want to create it in such a way that it will be common for all servers - but as a point of view. not the real table, only the data and views do not change.
How can I do?
Thanks in advanceAre you sure you want to say 'tablespace '? A tablespace is a collection of data files. It has nothing to do with the privileges of the object, object namespaces, etc. I'm guessing that you mean that you have two schemas, OBITUARIESCS and ADVERTISEMENTCS. A schema is a collection of objects of database belonged to a particular user. A single table can exist in spaces of multiple tables (assuming it is partitioned). Different schemas can have an infinite number of tables with the same name in the same table. The database schema is the namespace for objects such as tables.
Assuming that you have two schemas in your database, you can create a table of COUNTRIES in the OBITUARIESCS schema. You can then grant SELECT access on the table to another user, ADVERTISEMENTCS, i.e.
GRANT SELECT ON country TO advertisementcs
You can then ask questions (but not change) the COUNTRY code of the property of ADVERTISEMENTCS table
SELECT * FROM advertisementcs.country
If you want to be able to remove the prefix in the schema, you can create a synonym. In the ADVERTISEMENTCS schema
CREATE SYNONYM country FOR advertisementcs.country
and then when the code of the property of ADVERTISEMENTCS wants to query the countries table, it can just
SELECT * FROM country
Justin
-
Syntax to create the view with 2 inline tables
Hello
If I run this SQL, I can compile a view without error:
CREATE OR REPLACE FORCE VIEW APPS.XX_TEST ( period_name , ytd ) AS with tbl_data AS ( SELECT '1314-03:OCT' period_name, -100 YTD FROM DUAL UNION ALL SELECT '1314-03:OCT' period_name, -1250 YTD FROM DUAL UNION ALL SELECT '1314-03:OCT' period_name, 10922 YTD FROM DUAL UNION ALL SELECT '1314-02:SEP' period_name, -100 YTD FROM DUAL UNION ALL SELECT '1314-01:AUG' period_name, 0 YTD FROM DUAL UNION ALL SELECT '1314-00:OBL' period_name, 0 YTD FROM DUAL UNION ALL SELECT '1213-14:CBL' period_name, -350 YTD FROM DUAL UNION ALL SELECT '1213-13:ADJ' period_name, -350 YTD FROM DUAL UNION ALL SELECT '1213-12:JUL' period_name, -100 YTD FROM DUAL ) SELECT period_name , ytd FROM tbl_data;
I need to create a view that includes the 2 tables inline (sorry if this is the incorrect terminology), using this SQL:
CREATE OR REPLACE FORCE VIEW APPS.XX_TEST2 ( period_name , ytd ) AS with tbl_data AS ( SELECT '1314-03:OCT' period_name, -100 YTD FROM DUAL UNION ALL SELECT '1314-03:OCT' period_name, -1250 YTD FROM DUAL UNION ALL SELECT '1314-03:OCT' period_name, 10922 YTD FROM DUAL UNION ALL SELECT '1314-02:SEP' period_name, -100 YTD FROM DUAL UNION ALL SELECT '1314-01:AUG' period_name, 0 YTD FROM DUAL UNION ALL SELECT '1314-00:OBL' period_name, 0 YTD FROM DUAL UNION ALL SELECT '1213-14:CBL' period_name, -350 YTD FROM DUAL UNION ALL SELECT '1213-13:ADJ' period_name, -350 YTD FROM DUAL UNION ALL SELECT '1213-12:JUL' period_name, -100 YTD FROM DUAL ), got_analytics AS ( SELECT period_name, ytd, ROW_NUMBER () OVER (ORDER BY period_name) AS a_num, ROW_NUMBER () OVER (ORDER BY period_name DESC) AS d_num, FIRST_VALUE (ytd) OVER (ORDER BY period_name) - FIRST_VALUE (ytd) OVER (ORDER BY period_name DESC) AS dif FROM tbl_data ) SELECT * FROM got_analytics;
I get this message:
ORA-24344: success with compilation error
There are no other errors but to provide additional information. I am using TOAD.
I was wondering if it is not possible to create a view in this way, or if I'm missing something?
I had a peek here:
ORA-24344: success with Compilation error
I'm using TOAD, trying to SHOW the ERRORS immediately after the code above only returned 'No Errors'.
I also looked here:
ORA-24344: success with compilation error
Ran the same code SQL/Plus, but "Show Errors" or "see the err" also returned "No. Errors."
Any advice would be much appreciated.
Thank you very much.
Hello
Try this
CREATE OR REPLACE FORCE VIEW APPS.XX_TEST2 ( period_name , ytd , a_num -- because you select * you need all rows , d_num , dif ) AS ...
concerning
Kay -
create materialized view log on the table without a primary key
Hi all
I don't want to refresh the mview when validation is performed on the base table.CREATE TABLE client_months ( SUBJ_CODE NUMBER(4), SERV_CODE NUMBER(4), DEBIT_CODE NUMBER(4), PERIOD_NUM NUMBER(2), PERIOD_NAME VARCHAR2(40 CHAR), FIRST_MON_DAY DATE, LAST_MON_DAY DATE, VALUE_MON_DAY DATE, MONTHES NUMBER(4,2), GARDENING_WEIGHT NUMBER(5,4), REASON_CODE NUMBER(5), STAMP_ACTION VARCHAR2(1 CHAR), STAMP_CDATE DATE DEFAULT SYSDATE, STAMP_DATE DATE, STAMP_USER VARCHAR2(15 CHAR), REGION_CODE NUMBER(9) ) table created. CREATE UNIQUE INDEX client_months_UK ON client_months (SUBJ_CODE, SERV_CODE, DEBIT_CODE, PERIOD_NUM, REGION_CODE) index created. CREATE MATERIALIZED VIEW LOG ON client_months with rowid; CREATE MATERIALIZED VIEW client_months_mv BUILD immediate REFRESH FAST ON COMMIT AS SELECT * FROM client_months; ORA-12014: table 'CLIENT_MONTHS' does not contain a primary key constraint
And I don't want to change the base table by adding a primary key.
is it possible to create the mview journal using the unique index? or another solution?
Please help
Thanks in advance
NaamaNaamas wrote:
No,
I already read this post!Then you read wrong:
SQL> CREATE TABLE client_months 2 ( 3 SUBJ_CODE NUMBER(4), 4 SERV_CODE NUMBER(4), 5 DEBIT_CODE NUMBER(4), 6 PERIOD_NUM NUMBER(2), 7 PERIOD_NAME VARCHAR2(40 CHAR), 8 FIRST_MON_DAY DATE, 9 LAST_MON_DAY DATE, 10 VALUE_MON_DAY DATE, 11 MONTHES NUMBER(4,2), 12 GARDENING_WEIGHT NUMBER(5,4), 13 REASON_CODE NUMBER(5), 14 STAMP_ACTION VARCHAR2(1 CHAR), 15 STAMP_CDATE DATE DEFAULT SYSDATE, 16 STAMP_DATE DATE, 17 STAMP_USER VARCHAR2(15 CHAR), 18 REGION_CODE NUMBER(9) 19 ) 20 / Table created. SQL> CREATE UNIQUE INDEX client_months_UK ON client_months 2 (SUBJ_CODE, SERV_CODE, DEBIT_CODE, PERIOD_NUM, REGION_CODE) 3 / Index created. SQL> CREATE MATERIALIZED VIEW LOG ON client_months with rowid 2 / Materialized view log created. SQL> CREATE MATERIALIZED VIEW client_months_mv 2 BUILD immediate 3 REFRESH FAST WITH ROWID ON COMMIT -- pay attention to WITH ROWID 4 AS 5 SELECT * FROM client_months 6 / Materialized view created. SQL>
SY.
-
Submitting a form by creating multiple lines in the DB table
Hi all
I created a new Apex application and have created a table with columns - USER_ID, ADDRESS, TELEPHONE, CREATEDON etc.
I want to read the USER_ID of the user and complete this field on the form and fill in the CREATEDON field with the date system. These two fields are hidden on the form.
Now, when the user fills his address and phone on the form and click on send, 3 identical rows are inserted into the DB table. The values of user and date system are set correctly.
To set the UserID field, I inserted a $APP_USER. in the default value of the form section. I am not able to understand why the Apex is to insert several lines even when you click the submit button once.
Help, please.
The problem is solved now. I noticed that add default values for the form fields added process duplicate. That's why the form has been processed three times. Remove the additional process solved the problem.
-
need a script to create multiple tables as the other columns in tables
I need script to create multiple tables as the other columns of tables respectively.
lets consider I want to create tables from table1... table99 like tablex1... .tablex99 columns (without data) respectively (i.e table1 as tablex1, table99 as tablex99).declare cursor c is select object_name from all_objects where object_type='TABLE'; begin for i in c loop execute immediate 'create table '||i.object_name||'_x as select * from '||i.object_name||' where 1=2'; end loop; end; use can use this and put your user names accordingly. If you get any error please post the error.
-
Create table works, create materialized view only - long column names?
Hello.
I have no probs creating a table as well: -.
CREATE TABLE blah
(
DEVICE_ID
)
in select
"Device_ID" AS DEVICE_ID
"of"sum" Device"@ed_link_3
where "Device_ID" < 5;
But when I try to create a materialized view:
Blah1 CREATE MATERIALIZED VIEW
(
DEVICE_ID
)
< various materialized view parms >
in select
"Device_ID" AS DEVICE_ID
"of"sum" Device"@ed_link_3
where "Device_ID" < 5;
It fails with errors: -.
ORA-04052: error occurred when searching to the top of the remote object Aggregate.Device@ED_LINK_3
ORA-01948: length of the name of the identifier (31) exceeds maximum (30)
Is there a way to get around this?
Is the problem with the columns of the remote table of device, which I do NOT need to import to have column names that are longer than 30 characters?
For now, I want only the Device_ID column which is a simple 9 characters long.
Oh, and the remote database is MySQL.
I'm uncomfortable with the < parms of materialized view > as they work fine when I choose a different remote table with only short column names.
Thank you.To my knowledge, you have the option
(a) create view (with shortened column names or only with desired columns if they are already less than 30 char limit) side of mysql
(b) use dbms_passthrough to force the analysis to be done on mysql (as in the example provided by SY here use dbms_passthrough to create a view )
However, I prefer to stick to one), because with dbms_passtrhough, you retrieve row by row.Best regards
Maxim
-
Column definition for a specific column in a view
Is it possible to query the metadata for the definition of a column in a view? I can see the full DDL for USER_VIEWS view. TEXT and I can see the USER_TAB_COLUMNS column to give the type of data etc. However, what I'm looking for is the DDL that defines a specific column.
So, taking into account:
create table (PERSON)
SSN VARCHAR2 (12),
FIRST NAME VARCHAR2 (25).
VARCHAR2 (25) LAST_NAME,.
STREET VARCHAR2 (40),
CITY VARCHAR2 (30),
STATE VARCHAR2 (30),
ZIP VARCHAR2 (15).
COUNTRY VARCHAR2 (35))
create view PERSON_VW as
Select SSN,
FIRST NAME,
LAST_NAME,
FIRST_NAME. ' ' || LAST_NAME FULL_NAME
of the PERSON
I expect that the query may look like:
Select the DDL from metadata where table_name = 'PERSON_VW' and column_name = "FULL_NAME".
and the result would be: "PERSON. FIRST_NAME. ' ' || NO ONE. LAST_NAME '.
or select the DDL from metadata where table_name = 'PERSON_VW' and column_name = 'first name '.
and the result would be: "PERSON. FIRST NAME. "
Thank you!>
What I really want to know, is that the definition of the customer includes all columns that are not the same basis, if the column names are the same.
>
As already said Oracle does not store the column definitions separately only the base query and an alias column metadata.If you select the column of TEXT of ALL_VIEWS, it will give all of the query.
And the DBMS_METADATA also includes the query as well as aliases for columns
select dbms_metadata.get_sxml('VIEW', 'PERSON_VW', 'SCOTT') FROM DUAL
SCOTT PERSON_VW SSN FIRST_NAME LAST_NAME FULL_NAME select SSN, FIRST_NAME, LAST_NAME, FIRST_NAME || ' ' || LAST_NAME FULL_NAME from PERSON Even by comparing the hash value of two-point plan view does still not detect some differences.
For example, your point of view and a modified to generate the same hash value of plan even thought the resulting column is longer in the second definition of the view
1. create a view
2 create a slightly modified view
3 run each view - SELECT * VW
4. compare the hash of Plan values.First point of view is yours
create or replace view PERSON_VW as select SSN, FIRST_NAME, LAST_NAME, FIRST_NAME || ' ' || LAST_NAME FULL_NAME from PERSON
second point of view is slightly different and includes ten slots instead of one in the concatenated field
create or replace view PERSON_VW1 as select SSN, FIRST_NAME, LAST_NAME, FIRST_NAME || ' ' || LAST_NAME FULL_NAME from PERSON
The SELECT * VW used in two different sql * more sessions show the same hash value of the plan.
So don't know anyway to compare the way you want because oracle does not store the definitions of column separately.
-
Create Materialized View ORA-01723: columns of length zero are not allowed
I am trying to create a materialized view that derives from a column of a function and I get: ORA-01723: columns null are not allowed.
I use 10 gr 2 with the following definition (simple version):
CREATE MATERIALIZED VIEW ACES
SELECT
function_name (column_name) alias_de_colonne
FROM table_name;
I even tried to cast it as below:
CREATE MATERIALIZED VIEW ACES
SELECT
Cast (function_name (column_name) AS VARCHAR2 (200)) alias_de_colonne
FROM table_name;
My function has an exception to return a value, even if no value are.
I looked everywhere for the solution. Someone at - there a way around this problem? I really need my function to calculate the column because it has business rules that I can't join in my definition of the materialized view. My only hope around this is to insert values into a table and then create a materialized table view, I don't want to do that if someone has a solution around this.
Any help would be greatly appreciated.
Thank you
Kyle
Published by: Kyle Miller on April 19, 2011 08:28Have you tried to create a table with the correct structure and then by creating the view materialized, based on the predefined table as described here...
http://www.oaktable.NET/content/ultra-fast-MV-alteration-using-prebuilt-table-option
?
See you soon
Ben
-
create the view of several tables of days
Hello
I'll have existing oracle db with the daily stat data, tables strangely named data_mon, data_tue, data_wed... For my batch that I intend to use the view with multiple day data, let say for the last 5 days.
Do not know how better to implement my sql with these suffixes _mon statement to make it more or less dynamic.
I create also ever seen from several tables, then, probably, that I can do something that will add daily updated data and remove data from 5 days?
You will appreciate comments on the details and the whole concept. I have prev sql server experience.
Thank you
Tuser12943718 wrote:
Hello
I'll have existing oracle db with the daily stat data, tables strangely named data_mon, data_tue, data_wed... For my batch that I intend to use the view with multiple day data, let say for the last 5 days.
Do not know how better to implement my sql with these suffixes _mon statement to make it more or less dynamic.
I create also ever seen from several tables, then, probably, that I can do something that will add daily updated data and remove data from 5 days?You will appreciate comments on the details and the whole concept. I have prev sql server experience.
Thank you
TChange the data model if you have 1 table for a day.
You have just a DATA table and a column to indicate the day of the application.
Then you don't need a view, do not need anything dynamic, do not need to break your head against a wall for a simple query... etc.
-
Create a view with a column change journal
Hello
I have the following table:
create table test1)
number of site_number
date of change_date,
number of area_ha);
insert into test1 values (1, TO_DATE('1/1/2007','DD/MM/RRRR'), 20);
insert into test1 values (1, TO_DATE('1/1/2008','DD/MM/RRRR'), 30);
insert into test1 values (1, TO_DATE('1/1/2009','DD/MM/RRRR'), 25);
insert into test1 values (2, TO_DATE('1/1/2007','DD/MM/RRRR'), 50);
insert into test1 values (2, TO_DATE('1/1/2008','DD/MM/RRRR'), 60);
insert into test1 values (2, TO_DATE('1/1/2009','DD/MM/RRRR'), 60);
insert into test1 values (3, TO_DATE('1/1/2007','DD/MM/RRRR'), 20);
insert into test1 values (3, TO_DATE('1/1/2008','DD/MM/RRRR'), 25);
insert into test1 values (3, TO_DATE('1/1/2009','DD/MM/RRRR'), 30);
What I want to do is to have a view based on the table above which includes a column of change (change_log below) based on the anterior surface (area_ha) for each specific site_number. For example in the first line site_number 1 has increased the area of 20 hectares on the 01/01/2007 to 30 hectares on the next change_date for this site that 01/01/2008. How this could be done?
SITE_NUMBER CHANGE_DATE AREA_HA CHANGE_LOG 1 01/01/2007 20 NO CHANGE 1 01/01/2008 30 ADDED SPACE 1 01/01/2009 25 DELETED DOMAIN 2 01/01/2007 50 NO CHANGE 2 01/01/2008 60 ADDED SPACE 2 01/01/2009 60 NO CHANGE 3 01/01/2007 20 NO CHANGE 3 01/01/2008 25 ADDED SPACE 3 01/01/2009 30 ADDED SPACE I am using oracle 11g R2
Select site_number,
change_date,
area_ha,
sign of case (area_ha - lag(area_ha,1,area_ha) over (partition by order of change_date site_number))
When 1 "AREA ADDED.
When-1 then "ZONE DELETED."
Another 'NO CHANGE'
end change_log
of test1
order of site_number,
change_date
/
SITE_NUMBER CHANGE_DA AREA_HA CHANGE_LOG
----------- --------- ---------- ------------
1 1 JANUARY 07 20 NO CHANGE
1 1 JANUARY 08-30 ADDED SPACE
1 1 JANUARY 09 25 DELETED AREA
2 1 JANUARY 07 50 NO. CHANGE
2 1 JANUARY 08 60 ADDED SECTOR
2 1 JANUARY 09 60 NO. CHANGE
3 1ST JANUARY 07 20 NO. CHANGE
3 AREA 1 JANUARY 08 25 ADDED
3 1ST JANUARY 09 30 ADDED AREA9 selected lines.
SQL >
SY.
-
Hi all
I am beginner in Oracle.
I have a two-column table that I use to create a view documents/statement once it meets the qualification.
The table has fields. 1 number and 2. Group. If there is more than 3 records found on this table with the same NUMBER and the GROUP he should create this table view.
Thank you
Pramod Devkate
The training is therefore two lines for a ticket and the agent. When the third row is added, create a line in the summary table. Later a fourth line is added to the table of training for this ticket and the agent, but we do not update the line in the summary table. We only touch the summary table when the third row is added to the training table, then it is only updated by the application. Very well
INSERT INTO summary (ticket, agent, total_travel, total_mtts)
Select ticket agent, sum (travel), sum (mtts)
training
where (ticket, agent) not in
(select the ticket agent summary)
Group ticket, agent
having count (*) > 2.
This inserts in the table only notes and agent ID that do not exist already.
-
How to create multiple hierarchies from the same physical table
Hi all
I have a physical table to join with a fact table: there are 3 different hierarchies, which share the last 2 levels inside the dimension table. It's the logic diagram of hierarchies:
Dimension services
-Business
-Sector
-Type
-Operator
-Product
Partner of dimension
-Partner
-Operator
-Product
Contractor of dimension
-Contractor
-Operator
-Product
All columns are in the same table physical source. I tried to create 3 table logic source from the same physical table, everyone with all the columns and create a hierarchy for each dimension table, but it gives me nQSError: 15011.
Any suggestion? Maybe the physical table alias can help for the creation of tables of different sizes?
Thanks in advance,
ConcerningHello
It is a basic rule that you cannot create multiple hierarchies in a single dimension table, so what you do is create three tables of alias and slip into MDB layer in 3 different sizes and on top these tables create 3 different dimension hierarchies.
Check if useful/correct
Thank you.
-
What SYS (or tables) store the value of a spec /not/ NULL columns? (It doesn't seem to be COL$)
NOTE: This is NOT a trick question - although it seems to be.
Test configuration:
Test configuration:BANNER Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production PL/SQL Release 11.2.0.1.0 - Production CORE 11.2.0.1.0 Production TNS for Linux: Version 11.2.0.1.0 - Production NLSRTL Version 11.2.0.1.0 - Production
1. a table is created by SCOTT in the SCOTT schema with a NULLABLE column.
2. a primary key constraint is added using only the NULLABLE column
3. Requests for information on USER_TAB_COLS, ALL_TAB_COLS, DBA_TAB_COLS and SYS. COL$ see NOT NULL for the column NULLABLE
as necessary for a primary key constraint. Views derive their data from the column of $ NULL the sys. Table of $ COL
using
and the table of $ COL shows a numerical value of '0' before you add the primary key and a value of "1" later.'DECODE (SIGN (c.null$), -1, 'D', 0, 'Y', 'N'),
4. a query on the DDL metadata table shows the specification for column NULLABLE of origin involved.
Question - where this original specification NULLABLE is stored?
This question is based on a question asked by another user in this thread
Columns becoming nullable after a fall of primary key?
I created the following specially for that matter test case
The DOF shows that Oracle keeps the original spec NULLABLE for the column and uses it to generate the DDL orginal, even if there is a primary key on the table and the system views (and COL$) show the column non NULLABLE.-- scott ensures table does not exist DROP TABLE tbl_test CASCADE CONSTRAINTS; -- scott creates a table CREATE TABLE tbl_test ( col_1 NUMBER, col_2 NUMBER NOT NULL); -- scott queries to check the the column nullable status SELECT table_name, column_name, nullable FROM user_tab_cols WHERE table_name = 'TBL_TEST'; -- TABLE_NAME | COLUMN_NAME | NULLABLE -- TBL_TEST | COL_1 | Y -- TBL_TEST | COL_2 | N -- Scott addes a primary key constraint using only the nullable column ALTER TABLE tbl_test ADD CONSTRAINT tbl_test_pk PRIMARY KEY(col_1); -- scott queries to check the the column nullable status SELECT table_name, column_name, nullable FROM user_tab_cols WHERE table_name = 'TBL_TEST'; TABLE_NAME,COLUMN_NAME,NULLABLE TBL_TEST,COL_1,N TBL_TEST,COL_2,N -- scott queries to get the table DDL select dbms_metadata.get_ddl('TABLE', 'TBL_TEST', 'SCOTT') FROM DUAL; DBMS_METADATA.GET_DDL('TABLE','TBL_TEST','SCOTT') CREATE TABLE "SCOTT"."TBL_TEST" ( "COL_1" NUMBER, <------ where is this NULLABLE spec stored? "COL_2" NUMBER NOT NULL ENABLE, CONSTRAINT "TBL_TEST_PK" PRIMARY KEY ("COL_1") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOCOMPRESS LOGGING TABLESPACE "USERS" ENABLE ) SEGMENT CREATION DEFERRED PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING TABLESPACE "USERS"
So where is the original information NULLABLE actually stored?rp0428 wrote:
What SYS (or tables) store the value of a spec /not/ NULL columns? (It doesn't seem to be COL$)I think that it becomes a bit messy depending on order of activity:
You can see Col. .null$ is set to a non-zero when the desrcibe command displays the column as not null, but it can happen for two reasons:
(a) user sets the column as not null - in which case you get a line in cdef$ with type # = 7
(b) the user adds a primary key to table - in which case you get a line in cdef$ with type # = 2If you declare null AND add a primary key, you get two lines - that's why it is possible for Oracle to determine if he should remove the flag not null when you remove the primary key and also allows dbms_metadata show the create statement of table without a NOT NULL even when describe it the watch with a NOT NULL - dbms_metadata can respond to the presence of the type # = 2 and absence of the type # = 7.
Concerning
Jonathan LewisBy the way: by a strange coincidence, it seems to me answering the previous post, three days before it was asked: http://jonathanlewis.wordpress.com/2012/04/19/drop-constraint/#comment-46140 (on the doubts, this isn't - it answers a different question on the removal of constraints).
Published by: Jonathan Lewis April 23, 2012 11:07
Maybe you are looking for
-
I can't open google, yahoo, facebook and other sites.
I can't open google.com , facebook.com, twitter.com, TomsHardware.com, microsoft.comand live.com (so far these sites that I know cannot be opened in firefox), it just says: server not found. But I can open the other sites (same google.co.id is OK, bu
-
HP 260 G4: enter the administrative password
Hi can you help me that my laptop is hp G4 produced 260: NOZ78EA #ACQ the problem, is that it continues to ask for an administrator password or power on password so I don't find it and after that I have try typing the password 3times these numbers co
-
Satellite A80-116: OS Win is not able to open
all of a sudden my laptop cannot be started.When I turn it on, windows XP cannot open.I tried all the options like start it in safe mode, or start with what I was doing last but nothing happens. Is really the only way to use the PRODUCT RECOVERY DVD-
-
Library of photos on external hard drive: not possible repair
Hello world Today, when I tried to open my library of Photos, Photos crashed. After I have reopened, Photos asked that the library must be repaired. I started who, but after 2%, Photos crashed with "an unexpected error has occurred." A restart does n
-
Where can I find a description of the red/green LED at the top of the phome left of the slot of the ear?