Update Key and Primary Key
Hi
When I am trying to define Update Key which is the other name for Alternate Key, then the primary key symbol (key) which is defined just beside my primary key column ( customer id) gets dissappeared and the new key symbol comes up besides the update key columns("marital status,salary and address")
Now why this happens and how to tackle.
In my project Customer id is a primary key which is responsible for insert of new records if not already presnt in the target table and the three other fields "marital status,salary and address" columns are responsible for update but these are not primary or composite keys.
Can anyone tell me the difference in terms of how oracle update mechanism work in both the case.Not sure what you're asking.
Have you done an explain plan for each statement?
Similar Messages
-
Difference between Unique key and Primary key(other than normal difference)
Hello,
1).Can any one tell me any other difference between Unique key and Primary key other than it having NULLs.
2). What is the difference the words 'DISTINCT' and 'UNIQUE' in a sql query.
Thanks in advance.Hi
If you don't believe me than see the documentation in
OTN.
Ott Karesz
http://www.trendo-kft.hu
SQL> create table scott.tbl_clob
2 (sss CLOB)
3 /
Tabelle wurde angelegt.
SQL> insert into scott.tbl_clob values('wrwrwrw')
2 /
1 Zeile wurde erstellt.
SQL> insert into scott.tbl_clob values('wrwrwrw')
2 /
1 Zeile wurde erstellt.
SQL> select distinct sss from scott.tbl_clob
2 /
select distinct sss from scott.tbl_clob
FEHLER in Zeile 1:
ORA-00932: nicht übereinstimmende Datentypen
SQL> select unique sss from scott.tbl_clob
2 /
select unique sss from scott.tbl_clob
FEHLER in Zeile 1:
ORA-00932: nicht übereinstimmende Datentypen
SQL> select distinct to_char(sss) from scott.tbl_clob
2 /
TO_CHAR(SSS)
wrwrwrw
SQL> select unique to_char(sss) from scott.tbl_clob
2 /
TO_CHAR(SSS)
wrwrwrw
SQL> -
Diff b/w surragate keys and primary keys
Can any one of u pls explain the difference between primary key and surragate keys,pls explain me with simple example
Hi rajesh,
surrogate key: For every master data record, system create a SID (Surrogate ID). If that particular master data record is used in infocube, system store the SID corresponding to that master data in dimension table and the dimension id of the dimension table is stored in infocube Fact 'F' table.
Primary key: while creating a table we will select unique field and create as primary key..for eg empid acts as a unique key (primary key) for emp table. through this primary key we can identify the table to get the data from the table.
i hope this helps u.
regards
anil -
Null in Composite Primary Key and "Primary keys must not contain null"
Hello all.
I'm a newbie concerning to JPA/EJB3, but I was wondering if toplinks doesn't support composite primary keys with null in some field (something perfectly right in any RDBMS).
I used JDeveloper (I'm using Oracle 10g database and JDeveloper 10.1.3.2.) wizards to generate JPA classes and I checked out generated files (with annotations), so they should be right (by the way, other O-R mappings for my model are working right, but this one).
I'm getting the next error:
Exception Description: The primary key read from the row [DatabaseRecord(
TSUBGRUPOSLDI.CD_GRUP => 01
TSUBGRUPOSLDI.CD_SUBGRUP => null
TSUBGRUPOSLDI.CG_POBL => 058
TSUBGRUPOSLDI.CG_PROV => 28
TSUBGRUPOSLDI.DSCR => Sanidad)] during the execution of the query was detected to be null. Primary keys must not contain null.
Compound primary key is (CD_GRUP, CD_SUBGRUP). No foreign keys, no joins (only a NamedQuery: "select o from ..."). It's the simplest case!
I checked out that everything runs ok if there's no "null" value in CD_SUBGRUP.
After some research (this and other forums) I'm beginning to believe that it's not supported, but not sure.
Am I doing sth wrong? If not, what is the reason to not support this? Will it be supported in the future?
Thanks in advance.Null is a special value and in many databases is not comparable to another null value (hence the isNull operator) and may pose problems when used to uniquely identify an Entity. TopLink does not support null values within a composite PK. As the nullable column is most likely not designated as a PK within your database table (many databases do not allow this) I recommend updating the Entity PKs to match that of the database.
--Gordon -
Display the foreign keys and primary keys in hirarchy qeury please ?
Any sql query to get the following columns:
I should display all the master table names,it's primary key field and its foregin key field,the name of the foreignkey'table.
This should be displayed in hirarchy i.e. it should start from the top level table like upside down tree.
can we query the database like this
thanx in advance
prasanth a.s.hi there,
Please can any body help in this query!
Thanxs in advance
prasanth a.s. -
column with unique constraint + not null constraint = primary key! (to some extent) Is it correct?
I invite your ideashttp://www.techonthenet.com/oracle/unique.php
http://www.allapplabs.com/interview_questions/db_interview_questions.htm#q13
Difference between Unique key and Primary key(other than normal difference) -
Primary Key and Chronological Key for Time Dimension
Could someone please shed light whether it's better to use normal PK or Calendar Date (which is a chronological key on the most detailed level). I tried both and haven't noticed any difference. But my understanding is that I still need to have the PK key on the most detailed level in time hierarchy.
ThanksMatt,
the PK of the Time Dimension is a regular sequence numeric key. I have it defined as a logical PK for the dimension. However, I guess I was talking about hierarchy key. I tested it either way and the query time is the same. So I guess it doesn't really matter.
--------Year
Year (chronological key and primary key)
------------------Quarter
Quarter (key)
Quarter+Year (primary key, chronological key)
---------------------------------Day Detail
PK (key)
Date (primary key , chronological key)
I hope it makes sense. -
Update Record Wizard, tng_Recordset and Primary Key
Hi - trying to make an image gallery that allows the user to add captions to each image displayed in a loop without having to send the user to a different form/detail page.
My question is - can the tng_recordset generated by the Update Record Wizard be modified to use a field of another recordset on the same page as it's primary key?
I.e. (on the Update Record behaviour) - Primary Key = Entered Value = {imagegalleries.galleryimages}
this doesn't work, but it's where I'd like to be...
The recordset 'imagegalleries' has been filtered using a URL variable that was defined as the gallery being edited.
Hope this makes sense - have been trying for days on this.
Dan-------
I just get a blank page
this means you´re having a PHP syntax error somewhere, and I´d recommend to always activate PHP error reporting at least on your local development server to have PHP indicate the reason why things aren´t working.
However, when using such native PHP syntax within this context, you´ll usually need to add some more stuff around the variable -- means:
$upd_boomcms_galleries_files->setPrimaryKey("bcms_galleryimage_id", "NUMERIC_TYPE", "VALUE", "".$row_galleryimagelist['bcms_galleryimage_id']."");
works better now ?
Cheers,
Günter Schenk
Adobe Community Expert, Dreamweaver -
Diff b/w primary key and unique key?
what is the diff b/w primary key and unique key?
Hi,
With respect to functionality both are same.
But in ABAP we only have Primary key for the Database tables declared in the Data Dictionary.
Unique is generally is the term used with declaring key's for internal tables.
Both primary and Unique keys can identify one record of a table.
Regards,
Sesh -
Difference between primary key and primary index
Dear All,
Hi... .Could you pls tell me the difference between primary key and primary index.
Thanks...Hi,
Primary Key : It is one which makes an entry of the field unique.No two distinct rows in a table can have the same value (or combination of values) in those columns.
Eg: first entry is 111, if you again enter value 111 , it doesnot allow 111 again. similarly for the strings or characters or numc etc. Remember that for char or numc or string 'NAME' is not equal to 'name'.
Primary Index: this is related to the performance .A database index is a data structure that improves the speed of operations in a table. Indices can be created using one or more columns, providing the basis for both rapid random lookups and efficient ordering of access to records. The disk space required to store the index is typically less than the storage of the table (since indices usually contain only the key-fields according to which the table is to be arranged, and excludes all the other details in the table), yielding the possibility to store indices into memory from tables that would not fit into it. In a relational database an index is a copy of part of a table. Some databases extend the power of indexing by allowing indices to be created on functions or expressions. For example, an index could be created on upper(last_name), which would only store the uppercase versions of the last_name field in the index.
In a database , we may have a large number of records. At the time of retrieving data from the database based on a condition , it is a burden to the db server. so whenever we create a primary key , a primary index is automatically created by the system.
If you want to maintain indices on other fields which are frequently used in where condition then you can create secondary indices.
Reward points if helpful.
Thanks,
Sirisha.. -
Difference between PRIMARY KEY and UNIQUE KEY with NOT NULL
What is the difference between PRIMARY KEY and UNIQUE KEY with NOT NULL constraint?
Message was edited by:
Nilesh HoleAnswer for the master!!!
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:8743855576462
Thanks,
Karthick -
Mapping in OWB with primary key and foreign key relationship
Hi all,
I am new to this datawarehousing field. I have just started my career. I have to now create a mapping in owb where a table has a field which is a primary key of another table in the same staging area. If you guys could help me out with the a method it can be created that would be very helpful to me.
I thought of 2 ideas,
1. If I can use a look up, but then I am not sure if i can use a lookup for primary key, foreign key relationship. If I can use also, I do not know how to use that.
2. What if I can directly take that the first table and link the primary key of that table to the second table which uses that primary key of the first table as one of its fields.
I do not know how feasible these methods are. Please guys help me out.
Thanks in advance.I have a similar case where table a and table b having relation but table a got inserted with data and table b is empty so there no values for foriegn key column in table b to realte with table a.
Now i want to load table b foriegn key with primary key column values of table a.
how can we do this in owb
thanks
kumar -
Dynamic SQL Joining between tables and Primary keys being configured within master tables
Team , Thanks for your help in advance !
I'm looking out to code a dynamic SQL which should refer Master tables for table names and Primary keys and then Join for insertion into target tables .
EG:
INSERT INTO HUB.dbo.lp_order
SELECT *
FROM del.dbo.lp_order t1
where not exists ( select *
from hub.dbo.lp_order tw
where t1.order_id = t2.order_id )
SET @rows = @@ROWCOUNT
PRINT 'Table: lp_order; Inserted Records: '+ Cast(@rows AS VARCHAR)
-- Please note Databse names are going to remain the same but table names and join conditions on keys
-- should vary for each table(s) being configured in master tables
Sample of Master configuration tables with table info and PK Info :
Table Info
Table_info_ID Table_Name
1 lp_order
7 lp__transition_record
Table_PK_Info
Table_PK_Info_ID Table_info_ID PK_Column_Name
2 1 order_id
8 7 transition_record_id
There can be more than one join condition for each table
Thanks you !
Rajkumar YeluguHi Rajkumar,
It is glad to hear that you figured the question out by yourself.
There's a flaw with your while loop in your sample code, just in case you hadn't noticed that, please see below.
--In this case, it goes to infinite loop
DECLARE @T TABLE(ID INT)
INSERT INTO @T VALUES(1),(3),(2)
DECLARE @ID INT
SELECT @ID = MIN(ID) FROM @T
WHILE @ID IS NOT NULL
PRINT @ID
SELECT @ID =ID FROM @T WHERE ID > @ID
So a cursor would be the appropriate option in your case, please reference below.
DECLARE @Table_Info TABLE
Table_info_ID INT,
Table_Name VARCHAR(99)
INSERT INTO @Table_Info VALUES(1,'lp_order'),(7,'lp__transition_record');
DECLARE @Table_PK_Info TABLE
Table_PK_Info_ID INT,
Table_info_ID INT,
PK_Column_Name VARCHAR(99)
INSERT INTO @Table_PK_Info VALUES(2,1,'order_id'),(8,7,'transition_record_id'),(3,1,'order_id2')
DECLARE @SQL NVarchar(MAX),
@ID INT,
@Table_Name VARCHAR(20),
@whereCondition VARCHAR(99)
DECLARE cur_Tabel_Info CURSOR
FOR SELECT Table_info_ID,Table_Name FROM @Table_Info
OPEN cur_Tabel_Info
FETCH NEXT FROM cur_Tabel_Info
INTO @ID, @Table_Name
WHILE @@FETCH_STATUS = 0
BEGIN
SELECT @whereCondition =ISNULL(@whereCondition+' AND ','') +'t1.'+PK_Column_Name+'='+'t2.'+PK_Column_Name FROM @Table_PK_Info WHERE Table_info_ID=@ID
SET @SQL = 'INSERT INTO hub.dbo.'+@Table_Name+'
SELECT * FROM del.dbo.'+@Table_Name+' AS T1
WHERE NOT EXISTS (
SELECT *
FROM hub.dbo.'+@Table_Name+' AS T2
WHERE '+@whereCondition+')'
SELECT @SQL
--EXEC(@SQL)
SET @whereCondition = NULL
FETCH NEXT FROM cur_Tabel_Info
INTO @ID, @Table_Name
END
Supposing you had noticed and fixed the flaw, your answer sharing is always welcome.
If you have any question, feel free to let me know.
Eric Zhang
TechNet Community Support -
Primary Key and Foreign Key Constraints
Hi All,
I would like to know PRIMARY KEY and FOREIGN KEY constraints on existing oracle tables. Could any one suggest me how to find out.
Thanks,
REDYou can query DBA_CONSTRAINTS to get a list of all the constraints on table A and/or table B. The documentation I linked to gives a full list of the data you can see in DBA_CONSTRAINTS, but it includes things like the referenced table name and referenced constraint name for a foreign key constraint. If A is a parent of B or B is a parent of A, you could match up the parent's primary key constraint to the child's foreign key constraint.
More generally, though, if you don't know that one of the tables is a parent of the other, figuring out how to join the two tables is probably not something that can be done using just the Oracle data dictionary. You would probably need an understanding of the data model being used to figure out what intermediate table(s) needed to be joined in order to relate rows in A to rows in B.
Justin -
Table and Primary Key Case Sensitive in Automated Row Fetch
Why are the table and primary key fields case sensitive in the Automated Row Fetch process? I'm debugging an error in this process and I'm not sure what the case should be.
Russ - It's a defect of sorts. Use upper case in the process definition. I don't think these processes will work with tables or columns whose names are not known to the database as upper-case values, i.e., defined using double-quoted non-upper case.
Scott
Maybe you are looking for
-
VoiceMail button no longer works
I have an iPhone 4 and the voicemail button worked up until August 27 when all of a sudden it no longer dialed my voicemail when i tapped it. Another problem is I don't get notified of new voicemails, This is a major problem when Im expecting work ca
-
Upgrade from iPhoto '06: What precisely does it do to my existing library?
Hi everyone, Considering iPhoto '08, one question that comes to mind is what an upgrade would do to the original library, how it would change it. In particular, now that iPhoto '08 is non-destructive, it means there is only one original and zero [thr
-
On iphone, calendar won't delete an event
on iphone, calendar won't delete an event
-
Facebook and Twitter status buttons in notification center?
Hi Apple community, I was messing around on my ipad mini with iOS 7 today and noticed that I cannot update my Facebook and Twitter status from notification center. Does anyone know how to turn this feature back on or if it was done away with iOS 7 al
-
I just upgraded to 10.6.3 and now my address book won't work (4.1.2) how to I upgrade it?