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 the emp_dept
view:
DELETE FROM emp_dept WHERE ename = 'SMITH';
This DELETE
declaration on the emp_dept
view is legal, because it can be translated to a DELETE
operation on the basis of emp
table and because only the emp
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 the FROM
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
Tags: Database
Similar Questions
-
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
...
-
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 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
-
Lost product key of Windows 8, need help to recover.
Original title: lost my key
I have already purchased windows 8 arvato and want to install it. I lost e-mail and paperwork with my key on it. The label on the cover of the disc has a work order number.on it. How the world and find what is my key?
Try to contact the Microsoft Store: http://www.microsoftstore.com/store/msstore/DisplayHomePage
You can be transferred, but they may be able to help.
J W Stuart: http://www.pagestart.com
-
key error 43, I need help I want to install the trial version of adobe first pro, I use a pc windows ultimate
Error 43 https://forums.adobe.com/thread/2070909
Also, is your Windows version required 64-bit?
-http://windows.microsoft.com/en-AU/windows7/find-out-32-or-64-bit
-
need help to remove kkash virsus
Why can't, I need help to remove the worm kkash/Rodolphe that divert my laptop used I would even turn on windows I would think MS essentials would protect me
Hello
Scan of Malware in Safe Mode with network.
http://www.bleepingcomputer.com/tutorials/how-to-start-Windows-in-safe-mode/#Vista
Windows Vista
Using the F8 method:
- Restart your computer.
- When the computer starts, you will see your computer hardware are listed. When you see this information begins to tap the F8 key repeatedly until you are presented with the Boot Options Advanced Windows Vista.
- Select the Safe Mode with networking with the arrow keys.
- Then press enter on your keyboard to start mode without failure of Vista.
- To start Windows, you'll be a typical logon screen. Connect to your computer and Vista goes into safe mode.
- Do whatever tasks you need and when you are done, reboot to return to normal mode.
Once in Safe Mode with network, download and run RKill.
RKill does NOT remove the malware; It stops the Malware process that gives you a chance to remove it with your security programs.
http://www.bleepingcomputer.com/download/rkill/
Then, download, install, update and scan your system with the free version of Malwarebytes AntiMalware in Mode safe mode with networking:
http://www.Malwarebytes.org/products/malwarebytes_free
See you soon.
-
Need help for query flat_file type clobdata oracle table data.
Hi Sir,
I need help to query oracle table flat file data having given clob type.
COLUMN FOR CHAR_DATA FLAT_FILEOracle Version: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product PL/SQL Release 10.2.0.1.0 - Production "CORE 10.2.0.1.0 Production" TNS for 32-bit Windows: Version 10.2.0.1.0 - Production NLSRTL Version 10.2.0.1.0 - Production Source table CREATE TABLE order_details ( QUEUE_SEQNUM NUMBER(10,0) NOT NULL ENABLE, LINE_SEQNUM NUMBER(10,0) NOT NULL ENABLE, CHAR_DATA CLOB, OPTIMISTIC_LOCK_KEY NUMBER(20,0) )
EXPECTED RESULTS:EU,6067AT,AT10,000000402004,NexiumGERDManagementProject,Z435,,ZZ29,NIS-GOLD,AT EU,6067AT,AT10,000000402038,NIS-OEU-ARI-2007/1,Z450,,ZZ29,NIS-OEU-ARI-2007/1,AT EU,6067AT,AT10,000000402039,SymbicortNISinCOPD,Z450,,ZZ29,NIS-REU-DUM-2007/1,AT EU,6067AT,AT10,000000402040,D1443L00044SeroquelXRRuby,Z450,,ZZ29,D1443L00044,AT EU,6067AT,AT10,000000402041,NIS-GEU-DUM-2008/1,Z450,,ZZ29,NIS-GEU-DUM-2008/1,AT EU,6067AT,AT10,000000402042,SonstigeAktivitätenLCM,Z450,,ZZ29,.,AT EU,6067AT,AT10,000000402134,D1680L00002Saxagliptin,Z450,,ZZ29,D1680L00002,AT EU,6067AT,AT10,000000402199,SeroquelWaveNIS,Z450,,ZZ29,NIS-NEU-DUM-2009/1,AT EU,6067AT,AT10,000000402313,SeroquelExtra(D1443L00082),Z450,,ZZ29,D1443L00082,AT EU,6067AT,AT10,000000402517,AtlanticD5130L00006(AZD6140),Z450,,ZZ29,D5130L00006,AT EU,6067AT,AT10,000000554494,ArimidexSt.Gallen(13+2),Z142,,ZZ09,,AT EU,6067AT,AT10,000000554495,ArimidexASCO(5delegates),Z142,,ZZ09,,AT EU,6067AT,AT10,000000554496,ArimidexSanAntonio6delegates,Z142,,ZZ09,,AT EU,6067AT,AT10,000000554497,ArimidexBreastCancerSummit(13+2),Z130,,ZZ09,,AT EU,6067AT,AT10,000000554498,ArimidexEIH(15delegates),Z130,,ZZ09,,AT EU,6067AT,AT10,000000554499,ArimidexNIFA(200delegates),Z135,,ZZ09,,AT EU,6067AT,AT10,000000554500,ArimidexNIFAworkshops(8x25),Z135,,ZZ09,,AT EU,6067AT,AT10,000000554501,ArimidexPraktischeGyn.Fortbildung,Z147,,ZZ09,,AT EU,6067AT,AT10,000000554502,ArimidexAGO,Z147,,ZZ09,,AT EU,6067AT,AT10,000000554503,ArimidexHämato/OnkologieKongress,Z147,,ZZ09,,AT EU,6067AT,AT10,000000554504,ARIMIDEXGYNäKOLOGENKONGRESS,Z147,,ZZ09,,AT EU,6067AT,AT10,000000554505,ArimidexChirurgenkongress,Z147,,ZZ09,,AT
AFFIRM_CODE COMPANY_CODE INTERNAL_ORDER_CODE INTERNAL_ORDER_DESC ENIGMA_ACTIVITY SUB_ACTIVITY_CODE IN_AFF_IND ORDER_TYPE EXTERNAL_ORDER COUNTRY EU 6067AT AT10 000000402004 NEXIUMGERDMANAGEMENTPROJECT Z435 NULL ZZ29 NIS-GOLD AT EU 6068AT AT11 000000402005 NEXIUMGERDMANAGEMENTPROJECT Z435 NULL ZZ29 NIS-GOLD AT
Sorry, my bad. Without database at hand, I'll try 'baby steps' (borrowed from Frank) so you don't confuse it with errors that I might add (happens far too often already, but at least you won't "swallow" as forum members think is one of the main goals of this fighter - help her learn - providing not only the proverbial fish.)
Search the Forum - your problem is one of its best sellers. Watching {message identifier: = 10694602} ("split string into" was the key word used in research) you can try something asselect table_row, level clob_row, regexp_substr(char_data,'[^' || chr(13) || chr(10) || ']+',1,level) the_line from (select to_char(queue_seqnum)||':'||to_char(line_seqnum) table_row, char_data from order_details ) connect by regexp_substr(char_data,'[^' || chr(13) || chr(10) || ']+',1,level) is not null and prior char_data = char_data and prior table_row = table_row and prior sys_guid() is not null
to get all the s the_lineall CLOB and after that the use of the example even to get your columns of each the_line.
Concerning
Etbin
Edited by: Etbin on 3.2.2013 09:01
.. .but I m connected to do things according to the instructions, I can't do something.
Used to happen to me too and I did as told to the but only after explaining any disadvantages, I was aware of in time. The last sentence is usually: "O.K. now be just and Don't come back with that kind of thing when it turns out that this isn't the right thing."
rp0428 post - something to remember. -
Need help request! 2 tables
Using Coldfusion 8 and MySQL. I have 2 tables, one called products (100 points) and another table called Clearance (5 items).
I see all 100 products and need to insert the discounted_price of the 5 elements of the game table in the query below.
(* write it down field discounted_price only exists in the table).
Also, how the returned below list can mark the checkboxes of the 5 elements of the game table.
(* note-productid is used in both tables. I guess you could call it the foreign key between tables).
I am a newbie and not sure how to write queries. Any help would be appreciated. Thanks in advance.
< cfoutput query ="getProducts">
< tr< cfif currentrow mod 2> class = 'weird'< / cfif >>
< td >< div align ="left">< entry type ="checkbox" name ="promo" value ="#">< table >
< td > (#getProducts.modelnumber #) #getProducts.modelnumber #< table >
< td >#getProducts.modeldescription #< table >
< td >#getProducts.category #< table >
< td >#getProducts.subcategory #< table >
< td > < input type ="text" name ="discounted_price" Value ="">< table >
< /tr >
< / cfoutput >
Select p.modelnumber, p.modeldescription, p.category, p.subcategory, C.discounted_price
left join products P C release on C.productid = P.productid
<>
class = 'weird' >checked >#getProducts.modelnumber # (#getProducts.modelnumber #) #getProducts.modeldescription #. #getProducts.category #. #getProducts.subcategory #. I hope this helps...
-
Hey, need help. I get this in my iPhone that 'there is a problem of billing with a previous purchase. Please update your payment method"anyway I can remove my visa card from iTunes?
You must pay your debt first.
-
Need to get a video removed, please help
Good afternoon; I just load a video from my iPhone to my macbook air, and while I have been putting day and cleaning of my library, I deleted by mistake;
I looked for the "Recently deleted" folder but can't find it; is there anyway that I can get it back? need help.
Hi sade666,
The information described below details how locate and restore items that you have recently removed from the Photos app on your Mac.
Deleted items remain in the album deleted recently for the indicated number of days and are then permanently deleted. You can view deleted items recently and add back them to your photo library.
Choose file > view recently deleted.
Select the photos that you want to restore.
Click on recover.
To remove recently immediately deleted items, select them, then click on remove.
If you use Time Machine to back up your computer, you can retrieve the elements after their deleted permanently from your Mac or iCloud.
For more information on the use of Time Machine, see restore a library of Photos from a Time Machine backup.
Photos for OS x: delete pictures and videos
https://support.Apple.com/kb/PH21313See you soon!
-
iCloud want to remove my iphone 5 but I can't not leave me with my e-mail password and need help
iCloud want to remove my iphone 5 but I can't not leave me with my e-mail password and need help
Welcome to the Apple community.
If you don't remember the password, reset it to...
-
Infected with "WINDOWS DEFENDER SYSTEM." Need help to remove it.
Infected with "WINDOWS DEFENDER SYSTEM." Need help to remove it. I have Mcafee and windows Defender, but the two do not detect. It keeps poping up of fake messages and prompts you to buy some fake antispyware.
Hello
Windows Defender system is a fake antivirus, a scam to force you to pay for it, while it has no advantage at all.
Remove Windows System Defender (uninstall Guide)
http://www.bleepingcomputer.com/virus-removal/remove-Windows-system-DefenderDownload malwarebytes and scan with it, run MRT and add Prevx to be sure that he is gone. (If Rootkits run UnHackMe)
Malwarebytes - free
http://www.Malwarebytes.org/Run the malware removal tool from Microsoft
Start - type in the search box-> find MRT top - right on - click RUN AS ADMIN.
You should get this tool and its updates via Windows updates - if necessary, you can download it here.
Download - SAVE - go where go out you there - top - right click RUN AS ADMIN
(Then run MRT as shown above.)Malicious removal tool from Microsoft
http://www.Microsoft.com/downloads/details.aspx?FamilyId=AD724AE0-E72D-4F54-9AB3-75B8EB148356&displaylang=en-----------------------------
also install Prevx to be sure that it is all gone.
Prevx - Home - free - small, fast, exceptional CLOUD protection, working with other security programs. It comes
a scan only, VERY EFFICIENT, if it finds something to come back here or use Google to see how to remove.
http://www.prevx.com/Choice of PCmag editor - Prevx-
http://www.PCMag.com/Article2/0, 2817,2346862,00.asp
--------------------------------------------
Here are some free scanners online help if needed:http://www.eset.com/onlinescan/
http://www.Kaspersky.com/virusscanner
Other tests free online
http://www.Google.com/search?hl=en&source=HP&q=antivirus+free+online+scan&AQ=f&OQ=&AQI=G1--------------------------------------------
Also do to the General corruption of cleaning.
Run DiskCleanup - start - all programs - Accessories - System Tools - Disk Cleanup
Start - type this in the search box-> find COMMAND at the top and RIGHT CLICK – RUN AS ADMIN
Enter this at the command prompt - sfc/scannow
How to analyze the log file entries that the Microsoft Windows Resource Checker (SFC.exe) program
generates in Windows Vista cbs.log
http://support.Microsoft.com/kb/928228Run checkdisk - schedule it to run at the next startup, then apply OK then restart your way.
How to run the check disk at startup in Vista
http://www.Vistax64.com/tutorials/67612-check-disk-Chkdsk.html-----------------------------------------------------------------------
If we find Rootkits use this thread and other suggestions. (Run UnHackMe)
I hope this helps.
Rob - bicycle - Mark Twain said it is good.
-
lost my product key and need help
My computer has a very big problem on Monday, which I was not able to do the system restore. So I call sony for help because it comes from was I brought my computer with vista installed. They were unable to do system restore, they put it back to the factory setting. Now no one at Sony is ready to help. I had to deal with three very 'ROUGH' REPS at sony. The problem is that I can't find my product key and they will not help you in obtaining microsoft vista started for me. I learned that I have to go to someone at microsoft on my problem. Is it possible that you can help me. If I am mistaken I think I register my product with microsoft when I received it. SO, please help me. Thank you.
Sandra
Hi BrookeLynn,
Thanks for posting. If your PC is an OEM which means that Dell, HP, IBM or another company, you will need to contact them to get a replacement disk or key you may need.
I hope this helps! Shawn - Support Engineer - MCP, MCDST
Microsoft Answers Support Engineer
Visit our Microsoft answers feedback Forum and let us know what you think -
Need help with the removal of the media files on my personal computer
I downloaded a media file and try to delete but asking special permission on my own computer and he repeats to me try again. I need help to remove this media file. Thank you very much
You could try renaming the file, including the extension and then delete. Which can sometimes do the trick.
If not, what type of file is and what about size? And logged as administrator?
Maybe you are looking for
-
On March 28, my ipad 2 use osi 9.2.1 air would not allow internet browsing so I updated to 9.3... I always have the same question. Any advice?
-
Do I need Windows Server 2008 CALs to use MultiPoint Server 2011?
Our company is planing to use MultiPoint Server 2011. I found prices info here: http://www.microsoft.com/windows/multipoint/buy.aspx But I do not understand the difference between "MultiPoint 2011 CAL (with Windows Server 2008 CAL) 'and"MultiPoint 20
-
My failure at startup and has not worked since
Original title: Question of an another XP FP3 Kmixer... Help! A few weeks ago my failure at startup. XP Home Edition, SP3. Has not worked since. Here's what I know... The volume has disappeared. If I try to start the Programs/Accessories/Enterta
-
CD player does not recognize blank cd in the drive in win xp.
my cd drive will read a cd but not recognixe a blank cd
-
IM on Vista 64-bit SP2. My volume mixer is to be boring. Before the update to SP2, it was fine. In the Volume mixer, my Applications to display the icon of the program running. Now there is no display name and a generic icon of windows for them. What