How Oracle determines an as key preserved table or not?
I tried to join employees and departments in the HR schema. Normally, the departments is not preserved key in the join operation. But I fixed in the view so that each service has exactly one employee, dept_no to become the key for the join. But still, he said, "cannot change the table not preserved key." Any tips? the type of join (left or right or inside or outside) does affect the mechanism on how Oracle determine which are preserved to key and which are not? Thank you.Hello
I would say yes, maybe can depend on join to condition paritially between tables 99% of the time. Because if you see the documentation it says
"It is not necessary the keys of a table to be selected to be key preserved. It is sufficient if the keys have been selected, then they would also be key (s) of the result of the join. "
'A table is kept if all keys in the table can also be a key to the result of the join key' - to turn the key role of role by providing the unique character.
-Pavan Kumar N
Tags: Database
Similar Questions
-
Key preserved table removal: need help.
Note When I followed the example of oradoc (in bold large print below):
DELETE the instructions
You can delete a view in join provided there is one and the same table in the join key. The key-preserved table can be repeated in the
FROM
article.The following
DELETE
statement works on theemp_dept
view:DELETE FROM emp_dept WHERE ename = 'SMITH';
This
DELETE
declaration on theemp_dept
view is legal, because it can be translated to aDELETE
operation on the basis ofemp
table and because only theemp
table is the table of key-preserved only in the join.In the following view, a
DELETE
operation is permitted, because even though there are two tables stored in the key, they are from the same table. In other words, the key-preserved table is repeated. In this case, the delete statement works on the first table of theFROM
list (e1
, in this example):CREATE VIEW emp_emp
SELECT e1.ename, e2.empno, e2.deptno
E1, e2 emp EMP
WHERE e1.empno = e2.empno;
I tried the above and it worked very well. Here's my version of how I tried
CREATE VIEW emp_emp
SELECT e1.last_name, e2.employee_id, e2.department_id
Of e1, e2 used employees2
WHERE e1.employee_id = e2.employee_id; / * (table employees in the HR diagram) * /.
delete from emp_emp where employee_id between 100 and 190;
then I tried my own and not much luck. Notice in the example I use the employees of HR diagram below table
In any case here it is:
CREATE VIEW Emp_test AS
SELECT the name of e1.last_name, e1.employee_id, e2.department_id
OF Employees2 e1, e2 Employees2
WHERE e1.employee_id = e2.employee_id;
delete from emp_test where employee_id = 100;
Note there is a preserved here, my employees2 table underlying table key.
Error: ORA-01752: cannot delete the view without exactly a key preserved table
01752 00000 - "impossible to remove from the view without exactly one key-preserved table.
* Cause: The deleted table had
-No table preserved key,
-several tables preserved key, or
-the key preserved table was a display not merged.
* Action: Redefine the view or remove it from the underlying base table.
In this case, it is simply repeated and as the doc said:
DELETE the instructions
You can delete a view in join provided there is one and the same table in the join key. The key-preserved table can be repeated in the
FROM
article.http://docs.Oracle.com/database/121/admin/views.htm#ADMIN11782
What Miss me in my script...? I haven't tried a few variations, no luck, I can't understand what is wrong.
In the doc if you ctrl + f, the word 'repeat' it will find repeated preserved much easier key topics (this is the only time the word repetition is used)
Textbooks are wrong, besides - you can delete a view in join even with several DIFFERENT tables preserved key in the view definition.
Build a script - followed by the exit.
create table emp2 in select * from emp;
ALTER table emp2 add constraint e2_pk key (empno) primary;
Select count (*) from emp2;
create or replace view emp_emp as
Select e1.ename, e2.empno, e2.deptno
-of emp e1, e2 emp2
of e1, e2 emp emp2
where e1.empno = e2.empno
;
delete from emp_emp where empno = 7900;
delete from emp_emp where empno between 7400 and 7600;
Select count (*) from emp;
Select count (*) from emp2;
-----
Table created.
Modified table.
COUNT (*)
----------
14
1 selected line.
Created view.
1 line removal.
3 deleted rows.
COUNT (*)
----------
14
1 selected line.
COUNT (*)
----------
10
1 selected line.
The script has two options for the FROM clause and (as the manual says in fact) the FIRST table in the from clause is the one whose lines are deleted.
I thought that I had written something on this several years ago, but if I can't find the article.
Concerning
Jonathan Lewis
-
System tablespace allocation how oracle determines the size of the measure
Hello
It may be a silly question, but the I must request and obtain a few knowdge
Assume that the allocation_type tablespace is system so how oracle determines the initial measurement and size max measure?Osama has provided useful links to the information you need. I'll just add with locally managed tablespace that the maximum number of spans is always unlimited even if you specify a value in the storage of declaration of establishment clause. Oracle does not take into account the value you provide and will with unlimited. I consider this unfortunate since in most cases, I know how large tables can reach and if the table extends beyond that point a developer made a mistake.
HTH - Mark D Powell.
-
I try to understand the key preserved table I use following script and using the table schemas HR employee
SQL > create table t2 in select * from hr.employees;
SQL > create table t4 in select * from hr.employees;
Table created.
SQL > create view v2 as
2 Select a.first_name, b.last_name
t4 3 a, t2 b
4 where a.employee_id = b.employee_id;
Created view.
now isn't this view key preserved as I use the primary key of these tables in the join I thought there would be one in a relationship
now when I do this
SQL > update v2
2 set name = 'vinod '.
3 where name = 'Feeney;
Set name = 'vinod '.
*
ERROR on line 2:
ORA-01779: cannot modify a column that is mapped to a table not preserved key
can you please tell me why I get this errorcreate table as select... does not inherit the primary key.
The t2 and t4 is not a primary key.
This is why you are getting the error.----------
Sybrand Bakker
Senior Oracle DBA -
How to determine if DBMS_STATS or ANALYZE TABLE used
Dear all,
Please please describe how to determine if DBMS_STATS or ANALYZE TABLE has been used on an Oracle 10 g 2 server.
Thank you!Try looking at GLOBAL_STATS in user/all/dba_tables.
When I ANALYSIS it shows up under the No.
When I dbms_stats.gather_table_stats, it appears that YES.
You could probably invoke dbms_stats.gather_table_stats with good arguments to get a number in the overall stats, but this technique can be good enough for you. -
I create a page "Form on a Table with Report" (APEX 5). Table I has 3 columns: cat_key, item_value, item_description. The cat_key is a foreign key in a table with columns cat_key, cat_value. I created the report and everything works fine. The page of the report shows my domain cat_key in number, so I want it instead to display the cat_value. I change the field cat_key to a text based on LOV, select my LOV and now when I view the page of report I get the "'ORA-01445: cannot select ROWID from where sample, a join without key preserved table view ' error." The report uses the ROWID as a link to the edit page field.
If I use the same tables and even shared LOV in a report page interactive, it works fine.
What I am doing wrong?
This is a limitation of the IR Apex will rewrite your query to a query that includes the lookup table and the columns. So now you have actually created a query on an inline view, which causes the error. You can see the query apex created when running in debug mode. APEX will join the table of choice with your primary table. For example from one of my IR:
Select 'ID '...
"MSL". "" HIS_COUNTRIES "=> my primary table
) ) b,
(select rv_meaning d, rv_low_value r
of msl_ref_codes_table
where rv_domain = "JOHN".
) L1 = > query My LOV Lookup
...
So, if possible, base your reports and forms on the real primary key, no rowid.
You can also write the IR query with the search yourself:
Select T1.rowid...
of primary_table T1
look_table L1
...
-
How to determine what product key is related to computer?
Hi guys, I have 2 computers with Windows Vista Ultimate, I re-install and reactivate windows on 1 computer, given that the card mother. out crapped. I don't tie not so how can I know which key fits which computer on the product keys from computers? Thank you
http://www.Belarc.com/free_download.html
http://www.magicaljellybean.com/KeyFinder/
If your Vista operating system is still active and running, use one of the programs above to find your product key on the other.
See you soon.
Mick Murphy - Microsoft partner
-
How to determine if ASA is blocking port or not?
Hello world
I support the ASA according to the customer. I'm new to the world of the SAA.
Users especially to check whether or not ASA allows specfic port.
I don't know how I can check that.
Is it possible that I can determine if ASA is blocking port or not?
If ASA is blocking port what steps I must take to allow ASA allow specific port?
concerning
Mahesh
Hello
You can use the command packet--draw to get the results you're after... that is to say if a 10.1.1.10 client attempts to access google dns, you can use the following syntax:
plotter of entrance inside the 10.1.1.10 udp packets 53 8.8.8.8 53 detailed (I may have the syntax a bit but you can tab your way through this).
Thank you
Sent by Cisco Support technique iPad App
-
How to determine the size of a table partition
Hello
Can anyone share please sql code that can be used to list the size of a partition table? I would appreciate it a lot.
Thank you
Scott
Version Oracle 11.2.0.1Select
Sum(bytes/1024/1024)
Of
dba_segments
where
nom_segment = "MYTABLE";Select
owner,
nom_segment,
nom_partition,
segment_type,
bytes / 1024/1024 "MB".
Of
dba_segments
where
nom_segment in ('SEG1', 'SEG2","SEG3");Select
owner,
nom_segment,
nom_partition, segment_type, bytes/1024/1024 "MB"
Of
dba_segments
where
segment_type = "PARTITION TABLE"; -
How can I display if given blank table is not present
Hi all
I have a problem here.
I need to display an empty array if there is no data. by default, it shows right column name box.
now, I need to add a blank under the column name.
If you have any advice, please let me know.
Kind regards
dityoI sent you a reply to the email I received from you. Please take a look.
If you think you have been helped, please give points and close the thread.
Thank you
Bipuser -
How to check the Windows key is original and unique user only
Hello
If I will buy another retailer windows operating system. so, how to check the windows key is original or not?
How to check the windows key is single user or three key user? How to learn about the windows key?
Hello
Find the key data is any tool?
In my State, one of the retailer sold out of the window in two different users. the key is the same. But I did not how many users should be used the key to this series?
That's why i, m here asking you friends
Then you have been sold an illegal license key, as a license key is never sold on its own, more a license key is never awarded to two different clients.
-
How to determine the strict reference to the table of waveform
Hello
I want to change the properties of a waveform by programming. I used to get all references maps of waveform a function of range in my script VI VI. Then I typecasted references to more specific class (strict-single track) after this trial I was able set properties such as data history. Everything works fine but if I add a graphic that is multiplot, that this approach does not work.
The problem is that in the table of references, there is reference to a graph in multiplot waveform, and this reference is not possible typcast to the more specific category (strict-single parcel).
My question is: how to determine if the reference in the table is matching the proper waveform (single or multiplot) charts.
In the VI attached is a code that demonstrates my problem.
Thanks a lot for the replies
Jan
Thank you for advice. VI point 2 from your answer, I created and it works. The solution is attached.
If I understand it correctly. I need to know the type of chart to come.
My first idea was to create a VI in Drop that initializes all the graphics of VI on chart type independently.
But this solution is fine because I will only use graphics-single plot and multiplot(two elements).
Thank you
Jan
-
How to find the primary key columns in the tables in MS Access using SQL queries
How to find the primary key columns in the tables in MS Access using SQL queries
Hello
This is the forum for Windows Vista programs related issues.
For better assistance, please try instead the Forums in SQL Server .
Thank you! Vincenzo Di Russo - Microsoft MVP Windows Internet Explorer, Windows Desktop Experience & security - since 2003. ~ ~ ~ My MVP profile: https://mvp.support.microsoft.com/profile/Vincenzo
-
How to disable the product key Windows Server 2008 R2 on Oracle Virtual Box?
Original title: disable the windows server 2008 r2 key
I have oracle VM and activated windows server 2008 r2 on a virtual machine. I just VMware workstation God 9 and I would like to reactivate in a VMware virtual machine. How can I disable the key so that it can be reactivated?
Click Start, type: CMD
Right-click on CMD
Click on run as administrator
At the command prompt, type: slmgr.vbs - upkPress enter, this will uninstall the product key of the computer and to the evaluation mode, you are now free to use it on another computer. If you experience problems, try to activate by phone:
Activate Windows 7 manually:
1. click on start and in the search for box type: slui.exe 42. press enter on your keyboard
3. Select your country.
4. Select the telephone activation option and brace yourself for a real person. -
How to understand the implementation of the plan in oracle I mean if I see two implementation plans for a single sql_id plans 2 How to determine the best execution plan? Links and answers are much appreciated. Thank you
How to understand the implementation of the plan in oracle I mean if I see two implementation plans for a single sql_id plans 2 How to determine the best execution plan? Links and answers are much appreciated. Thank you
After two execution plans that have the same sql_id, so we can see what you're talking about.
See "Oracle Explain Explain Plan optimizer" by Maria Colgan of the Oracle optimizer group
Examine the various aspects of a selectivity to parallel execution plan
performance and understand what information you should be brilliant
the plan can be overwhelming even for the most experienced DBA. This document
offers a detailed explanation on each of the aspects of the execution plan and a
Overview of what caused the CBO to make the decision, he did.
Maybe you are looking for
-
Just bought this. Link to my laptop but the link for the Windows software on the instruction sheet and on the site of Toshiba UK goes to a page in the Japanese site which will not. Can someone please tell me the link in English?
-
Tengo problemas com windows media pleyer
Tengo problemas con windows media pleyer sale me error cuando quiero descargar musica
-
Mass Effect has stopped working
I installed Mass Effect 1 as well as the 1.02 patch, but when I try to play the game, it does not work and gives me a message that Mass Effect stopped working with the details below: Signature of the problem:Problem event name: APPCRASHApplication na
-
When I click the button remove the device safely and eject Media, then click on eject USB storage device, I get a pop up window that says that it can not be deleted because it is used. For the life of me I can't understand what could be still in use
-
What version of Flight Simulator is compatible with my Toshiba laptop?
I bought Flight Simulator X for my son operate on Windows XP on my Toshiba laptop. After loading the DVD software - I got an error message that says Flight Simulator x is not compatible with my system - I need to reload IX of Flight Simulator. How