Change column by key in maintenance table
Hello to all
i wanna add a column that automatic change by another column in the table for example:
when i insert country key "US" then in the NAME column will be "USA".
if anyone have any idea of how to do this i will very happy.
thanks.
Hi,
TA SE11-Utilities-Table maint. generator
from here : environment-modification-events
here event 05
-> pls write coding in a customer include
regards Andreas
Similar Messages
-
Best way to change partition key on existing table
Hi,
Using Oracle 11.20.3 on AIX.
We have a table about 800 million rows and 120gb in size.
Want to try copies oif this table to evalaute different partitiong strategies.
What is the quickest way to do this?
Would have liked say datapump table 1 tro disk and datapumo import the data to new table but do the tables need to be of the same format.
Thanks>
Using Oracle 11.20.3 on AIX.
We have a table about 800 million rows and 120gb in size.
Want to try copies oif this table to evalaute different partitiong strategies.
What is the quickest way to do this?
Would have liked say datapump table 1 tro disk and datapumo import the data to new table but do the tables need to be of the same format.
>
First your subject asks a different question that the text you posted: Best way to change partition key on existing table. The answer to that question is YOU CAN'T. All data has to be moved to change the partition key since each partition/subpartition is in its own segment. You either create a new table or use DBMS_REDEFINITION to redefine the table online.
Why do you want to export all data to a file first? That just adds to the time and cost of doing the op.
What problem are you trying to use partitioning to solve? Performance? Data maintenance? For performance the appropriate partitioning key and whether to use subpartitions depends on the types of queries and the query predicates you typically use as well as the columns that may be suitable for partition keys.
For maintenance a common method is to partition on a date by year/month/day so you can more easily load new daily/weekly/monthly data into its own partition or drop old data that no longer needs to be kept online.
You should use a small subset of the data when testing your partitionings strategies.
Can you do the partitioning offline in an outage window? If not then using the DBMS_REDEFINITION is your only option.
Without knowing what you are trying to accomplish only general advice can be given. You even mentioned that you might want to use a different set of columns than the curren table has.
A standard heap table uses ONE segment for its data (ignoring possible LOB segments). A partitioned/subpartitioned table uses ONE segment for each partition/subpartition. This means that ALL data must be moved to partition the table (unless you are only creating one partition).
This means that every partitioning scheme that uses a different partition key requires ALL data to be moved again for that test.
Provide some information about what problem you are trying to solve.
>
Is this quicker than datapump?
>
Yes - exporting the data simplying moves it all an additional time. Ok to export if you need a backup before you start.
>
Found artcle which talks about using merge option on datapump import to convert partitioned table to non-partitioned table.
>
How would that apply to you? That isn't what you said you wanted to do. -
Foreign keys to same table / Who columns in User table???
Hi All,
We are designing a database for our client and we are using common columns in all tables like CreatedBy and UpdatedBy which are foreign keys to USER table. My question is can we use these two columns in USER table and have the foreign key constraints to the same tables?
USER table script will look like following..
CREATE TABLE XX_USER
User_ID VARCHAR2(10)
, CreatedBy NUMBER(10)
, UpdatedBy NUMBER(10)
, User_Name VARCHAR2(100) NOT NULL
, Designation VARCHAR2(100) NOT NULL
, CONSTRAINT USER_ISACTIVE_CHECK CHECK (Is_Active in ('Y', 'N'))
, CONSTRAINT USER_KEY PRIMARY KEY (User_ID),
, CONSTRAINT USER_CREATED_BY FOREIGN KEY (CREATED_BY)
REFERENCES XX_USER (USER_ID)
, CONSTRAINT USER_UPDATED_BY FOREIGN KEY (UPDATED_BY)
REFERENCES XX_USER (USER_ID)
);I think what I am doing (the above script) is not correct. Could someone please suggest me how can solve this issue?
Thanks in advance,
Oraebsuser8644385 wrote:
We are designing a database for our client and we are using common columns in all tables like CreatedBy and UpdatedBy which are foreign keys to USER table. My question is can we use these two columns in USER table and have the foreign key constraints to the same tables?You can. After fixing synatx errors:
SQL> CREATE TABLE XX_USER
2 (
3 User_ID VARCHAR2(10)
4 , CreatedBy NUMBER(10)
5 , UpdatedBy NUMBER(10)
6 , User_Name VARCHAR2(100) NOT NULL
7 , Designation VARCHAR2(100) NOT NULL
8 , Is_Active VARCHAR2(1)
9 , CONSTRAINT USER_ISACTIVE_CHECK CHECK (Is_Active in ('Y', 'N'))
10 , CONSTRAINT USER_KEY PRIMARY KEY (User_ID)
11 , CONSTRAINT USER_CREATED_BY FOREIGN KEY (CreatedBy)
12 REFERENCES XX_USER(USER_ID)
13 , CONSTRAINT USER_UPDATED_BY FOREIGN KEY (UpdatedBy)
14 REFERENCES XX_USER(USER_ID)
15 )
16 /
Table created.
SQL> Now USER_ID is a string while CreatedBy/UpdatedBy is a number. Even though it is allowed, it limits USER_ID to numeric strings and causes implicit conversions while validating. So I would change CreatedBy/UpdatedBy data type to VARCHAR2(10).
SY. -
HELP! Is there a way to change column information in iTunes such as name of artist, genre etc, other than deleting them one at a time? Such as the way you delete an entire group of songs by holding down control keys or selecting the Select All command. Thanks.
If you select all the songs you want to change, Be it one song or an akbum, or an Artist, Or Genre, or playlist. Then Right mouse click and Get Info. You then get a slightly different from normal Get Info box as this is the One for Multiple items.
In there have a look at the tags and see if the one you want to changes is in there. There are a few tabs so if for example you wanted to change the Media Type from Home Movie to Movie go to the Options tab and select Movie and OK and it will change the whole selection. -
How can I change column name in ALV table in WebDynpro ABAP?
Hi Everyone,
I have created an ALV table in WebDynpro ABAP. I have created a context node and added the required attributes there - for the ALV display.
Now I want to change one columnn name of the ALV table.... Currently it is showing the description of the data element, which I don't want to show. I cannot create a new DE only for this purpose.
Please let me know how can I change the name of the column.
RegardsHi,
This may help you to define your own column text in the ALV Table of webdynpro.
see the below code.
Here 'STATUS_ICON' is the column of the the output display of the ALV Table of webdynpro.
"change the label of the report.
DATA: lr_weeknum TYPE REF TO cl_salv_wd_column.
CALL METHOD l_value->if_salv_wd_column_settings~get_column
EXPORTING
id = 'STATUS_ICON'
RECEIVING
value = lr_weeknum.
SET THE LABEL OF THE COLUMN
DATA: hr_weeknum TYPE REF TO cl_salv_wd_column_header.
CALL METHOD lr_weeknum->get_header
RECEIVING
value = hr_weeknum.
CALL METHOD lr_weeknum->set_resizable
EXPORTING
value = abap_false.
hr_weeknum->set_prop_ddic_binding_field(
property = if_salv_wd_c_ddic_binding=>bind_prop_text
value = if_salv_wd_c_ddic_binding=>ddic_bind_none ).
set the text of the column
CALL METHOD hr_weeknum->set_text
EXPORTING
value = 'C Form'.
regarads,
balu -
Changing column positions of a table
Hi
Please lemme know how do we change column postions in a table
Table A ( x number ,
y varchar2(10),
z number)
How do i make it
A (x number ,
z number ,
y varchar2(10))
ThanksIn general, you don't because the order of columns in a table is irrelevent.
If you want to present columns in a particular order, you can create a view on top of the table and make that view available to end users.
If you're really determined, you could do an online table redefinition (depending on the Oracle version and edition, neither of which you mentioned). Or do a
RENAME TABLE a TO a_old;
CREATE TABLE a
AS
SELECT x, z, y
FROM a_old;
<<Create appropriate indexes, constraints, etc>>
DROP TABLE a_oldThis is basically what online table redefinition is doing. Obviously, if you have a lot of data, this is going to be slow and expensive.
Justin -
Changing Configuration Table to user maintenance table
Hi SDN team,
I recall that there was an OSS note that described the procedure to change a table in configuration to a user maintenance table. We have a scenario where the purchasing group table is maintained via IMG and the business process wants to maintain this as a master data table. Can anyone either walk me through the process of setting this up or point me to the OSS note that references this functionality?
Thank you.
NguyenCommunicate your approach and dont forget the newbie who may join your company in future !!!
if one is not aware that you maintain customizing tables in production, and does customizing as usual in developement system and transports the changes, then he may create a lot problems.
It happened to me personally. I was not aware that purchasing groups had to be maintained in production system as I joined a new company. (But still the request for a new purchasing group is send to IT) . so I just took the free next number in dev-system and transported to production. And here I overwrote an entry that was only present in production......... -
In SQL Server Transactional replication what all changes I can do on subscriber table
In SQL Server Transactional replication what changes I can do on subscriber table
ThanksHi Ajay.G,
According to your description, if you want to do some updates at the Subscriber, you need to note the following things.
•If TIMESTAMP or IDENTITY columns are used, and they are replicated as their base data types, values in these columns should not be updated at the Subscriber.
•Subscribers cannot update or insert text, ntext or image values . Instead, you could partition the text and image columns into a separate table and modify the two tables within a transaction.To update large objects at a Subscriber, use the
data types varchar(max), nvarchar(max), varbinary(max) instead of text, ntext, and image data types, respectively.
•Updates to unique keys (including primary keys) that generate duplicates and then they are not allowed and will be rejected because of a uniqueness violation.
•If the Subscriber database is partitioned horizontally and there are rows in the partition that exist at the Subscriber but not at the Publisher, the Subscriber cannot update the pre-existing rows.
For more information, see: Updatable Subscriptions for Transactional Replication
Regards,
Sofiya Li
Sofiya Li
TechNet Community Support -
A question about foreign key to multiple tables
Hello everybody,
I have a question about creating foreign key and I would appreciate if you could kindly give me a hand. Here are my tables:
CREATE TABLE TEAM1(team_id VARCHAR2(20), project_id VARCHAR2(20));
ALTER TABLE TEAM1 ADD CONSTRAINT PK_TEAM1 PRIMARY KEY(team_id);
CREATE TABLE TEAM2(team_id VARCHAR2(20), project_id VARCHAR2(20));
ALTER TABLE TEAM2 ADD CONSTRAINT PK_TEAM2 PRIMARY KEY(team_id);although the structure of both the tables is exactly the same, the values (in particular team_id) in both tables are different.
Also I have another table named AGENT
CREATE TABLE AGENT(agent_id VARCHAR2(20), team_id VARCHAR2(20));
ALTER TABLE AGENT ADD CONSTRAINT PK_AGENT PRIMARY KEY(agent_id)Now the problem is that the column team_id in AGENT table is actually a foreign key, but the value can be in either TEAM1 or TEAM2. As far as I know a foreign key points only to one table.
How can I deal with this problem? Whenever there is an INSERT or UPDATE I have to make sure that the value of the column "team_id" in the table "AGENT" is a valid value either in "TEAM1" or "TEAM2"
Thanks in advance,
Kind Regards,
DariyooshDo you have the ability to change the data model? If so a more appropriate structure may be something like this:
CREATE TABLE TEAM(team_id VARCHAR2(20), team_name VARCHAR2(20));
ALTER TABLE TEAM ADD CONSTRAINT PK_TEAM PRIMARY KEY(team_id);
ALTER TABLE TEAM ADD CONSTRAINT UK_TEAM UNIQUE (team_name);
CREATE TABLE TEAM_PROJECT(team_id VARCHAR2(20), project_id VARCHAR2(20));
ALTER TABLE TEAM ADD CONSTRAINT PK_TEAM_PROJECT PRIMARY KEY(team_id, project_id);
ALTER TABLE AGENT ADD CONSTRAINT FK_TEAM_PROJECT1 FOREIGN KEY (team_id) REFERENCES TEAM(team_id);
CREATE TABLE AGENT(agent_id VARCHAR2(20), team_id VARCHAR2(20));
ALTER TABLE AGENT ADD CONSTRAINT PK_AGENT PRIMARY KEY(agent_id);
ALTER TABLE AGENT ADD CONSTRAINT FK_TEAM FOREIGN KEY (team_id) REFERENCES TEAM(team_id);Edited by: Centinul on Jun 25, 2010 10:50 AM -
We are at the end of completing a project and we ran into a last minute bug. We are using two primary keys on a table to form a unique key. The problem we have is the program hangs up and gives us the following error,
ORA-20001: Error in DML: p_rowid=CUA, p_alt_rowid=SIT_ID, p_rowid2=, p_alt_rowid2=. ORA-01422: exact fetch returns more than requested number of rows,
probably meaning we only have one key setup in the DML
processing when our table has two.
we created a process with the Primary key set up in the DML but how does the secondary key column value work and is that what it's used for,because we tryed with no success. Is there a way around this problem without having to change our table by inserting only one primary key.
Thanks in advance.
GarryI am facing a similar problem , I used the two primary keys for navigating to the form page (forms with reports) so that the form page may display distinct records.
Its not posing any error but its not showing the value of other columns associated with that record.
Only the columns contained in the page item in the form page , that's are used as primary keys or that have been specified in the navigation part of the report page, are being shown ,
Like for example I have got 5 columns
a,b,c,d,e out of which a and b are my primary keys .
I am using these to fetch values in the form page of forms with reports.
We can specify three keys at the most , in my case I am having two , if in place of the third key I specify some column then in the form page it displays the correct record details of the three columns specified( 2 keys and one simple column), and it doesn't displays the value of other columns.
Please help me out of this . -
Update primary key thats also a foreign key in another table
Hi Developers,
I need to update the primary key for a record but it's also the foreign key in another table.
Example,
Table 1 Details
Name : Parent_Table
Columns : ID, Name, Age
Primary Key : ID
Table 2 Details
Name : Child_Table
Columns : ID, Parent_ID, Name, Age
Primary Key : ID
Foreign Key : Parent_ID (Primary Key in Parent_Table)
Parent_Table
ID Name Age
1001 Sam 26
1002 George 25
Child_Table
ID Parent_ID Name Age
1010 1001 Sam 26
1020 1002 George 25
Now I want to update ID (1001) in Parent_table as 2001 and also, I want to update Parent_ID (1001) in Child_Table as 2001.
How we will write the java code to update these columns.
Thanks in advance.dcminter wrote:
If you're looking at changing the primary keys in your data then there's probably something wrong with your data structure.Depends how you feel about business primary keys versus surrogates. Personally I prefer the latter so I'm with you in theory. In practice, however, a DB that uses a business PK may well find that it's a legitimate use case to change the key value (but then that's why I like surrogates in the first place!)Primary keys should not have meaning. -
Hi all,
I have one role play dimension with some null key in fact table, I liked know if it's a good practice?
thanksDepends on what you actually mean..
When one dimension column contains NULL in your fact table, then it's normally a bad practice. Create a entry in your dimension table to represent this state.
The problem is that NULL is a state, which means does missing or inapplicable information. This means that the row in the fact table is semantically meaningless. Cause your fact table is no longer additive over this dimension. -
How to create a foreign key for the table from two different tables?
Hi All,
I have a three table like below. In the below table SAMPLE_CONS_CHECK and SAMPLE_CONS2_CHECK will be having the primary key for NAME column. The same SAMPLE_CONS3_CHECK table also having the primary key for NAME column and forieign key for SAMPLE_CONS_CHECK and SAMPLE_CONS2_CHECK tables. See the below code 2
code 1:
CREATE TABLE SAMPLE_CONS_CHECK
(NAME VARCHAR2(10),
SERIES VARCHAR2(5)
CREATE TABLE SAMPLE_CONS2_CHECK
(NAME VARCHAR2(5),
MODEL NUMBER
CREATE TABLE SAMPLE_CONS3_CHECK
(NAME VARCHAR2(5),
MODEL_NO NUMBER
)code 2
alter table SAMPLE_CONS_CHECK
add constraint SAMPLE_CONS_CHECK_pk primary key (NAME)
alter table SAMPLE_CONS2_CHECK
add constraint SAMPLE_CONS2_CHECK_pk primary key (NAME)
alter table SAMPLE_CONS3_CHECK
add constraint SAMPLE_CONS3_CHECK_pk primary key (NAME)
ALTER TABLE SAMPLE_CONS3_CHECK ADD
CONSTRAINT SAMPLE_CONS3_CHECK_FK1 FOREIGN KEY
NAME
) REFERENCES SAMPLE_CONS_CHECK
NAME
) ON DELETE CASCADE;
ALTER TABLE SAMPLE_CONS3_CHECK ADD
CONSTRAINT SAMPLE_CONS3_CHECK_FK2 FOREIGN KEY
NAME
) REFERENCES SAMPLE_CONS2_CHECK
NAME
) ON DELETE CASCADE;From the above schenario i am able to insert the data to SAMPLE_CONS3_CHECK table. But the parent data is already available in the parent table. The problem is here two different constarints from two different tables. While inserting, it is checking from both the tables whether the parent is exist or not.
How can i solve this problem? Can anyone halp me about this?
Thanks
Edited by: orasuriya on Aug 8, 2009 2:02 AMActually the design is completely incorrect.
What you say is
I have
'foo', 'foo series'
'foo','foo model'
'foo',666
By virtue of table3 referring to both table1 and table2.
This means you actually need to have 1 (one) table:
'foo','foo series','foo model', 666
And the 'problem' disappears.
Sybrand Bakker
Senior Oracle DBA -
Change Column Heading in ALV Report
Hi,
I have developed a ALV Report, showing correct output.
Problem is that Column Heading is not showing correct...means it is showing as per field name. But We want to change as per our understand. i.e. One column heading is like Unrestricted Stock but we want Unrestricted Stock...(BILF is an indicator)..
We have write in the code..
FORM build_fieldcat10.
CLEAR fieldcat_ln.
ADD 1 TO col_pos.
fieldcat_ln-ref_tabname = 'MARD'.
fieldcat_ln-fieldname = 'LABST'.
fieldcat_ln-seltext_m = 'BILF Unrest.Stock'.
fieldcat_ln-key = space.
fieldcat_ln-do_sum = space.
fieldcat_ln-col_pos = col_pos.
fieldcat_ln-no_out = space.
fieldcat_ln-qfieldname = space.
fieldcat_ln-hotspot = space.
APPEND fieldcat_ln TO fieldcat.
ENDFORM. " BUILD_FIELDCAT1
But after change the selection text...not showing correct text..How can i change Column heading???
Please help me..Thanks a lot dear..
My problem resolved by using SCRTEXT_L. -
Is it possible to create many primary key for a table?
hello sir/mam.
i am selva, i am new to abap,
is it possible to create many primary key for a table?
please guide me.Hi Selva,
Many Primary Keys = Composite Key.
i.e some set of columns will enable you to identify a unique row from a set of rows in the table.
This can be achieved by checking the primary key check box in se11.
Hope it helps.
Regards,
Maheswaran.B
Message was edited by: Maheswaran B
Maybe you are looking for
-
Add XML tag to the XML output File
Experts, My Scenario is JDBC to File For the resultant xml file i have to append a line <?Test Line?> after <?xml version="1.0" encoding="UTF-8" ?> while passing it to legacy system ? From SDN I found that a XSLT Mapping(as second mapping in the Inte
-
Loaded up my PC this morning and then started iTunes as per normal but itunes loaded as if It was the first time I have used it, nothing at all (I have 15,200 songs along with all my iphone data ). I use iTunes every day, last time was yesterday afte
-
Hello Friends, Orders were closed out in previous period so we cannot reverse billing and accounting document anymore. These were all third party items which are billed to the customer and the customer has paid. so how do I reverse everything and re-
-
Terminal/Unix Command to Mount External USB Drive?
I am having a probelm with the directory on an external HDD. The "device" is showing up in the utility software (DRIVE GENIUS/DISK UTILITY) but not the "volume," so it can't affect any repairs except INTIALIZE. So, I'm presuming the drive is physical
-
Store the out put of smartform in a directory which is created on app..Serv
Dear All, I want to store the out put of smartform in a directory which is created on application server.so that the user in future can directly print the output with out again executing the smartform..... regards, Sudheer.G