How to force uniqueness on 2 tables?
Hello
I have an e-mail1 column in both tables A and B.
and I will not allow to insert the e-mail twice in both tables, the email must exists in table A or table B not both.
Is there an easy way to implement this feature?
Best regards
Salim
Something like that I guess
SQL> create table a (id integer, email varchar2(100)); Table created. SQL> alter table a add constraint a_uk unique(email); Table altered. SQL> create table b (id integer, email varchar2(100)); Table created. SQL> alter table b add constraint b_uk unique(email); Table altered. SQL> create materialized view log on a with rowid including new values; Materialized view log created. SQL> create materialized view log on b with rowid including new values; Materialized view log created. SQL> alter materialized view log on b add (email); Materialized view log altered. SQL> alter materialized view log on a add (email); Materialized view log altered. SQL> create materialized view mv build deferred refresh fast on commit 2 as 3 select count(*) cnt 4 from a join b 5 on a.email = b.email; Materialized view created. SQL> alter materialized view mv add constraint mv_chk check (cnt = 0); Materialized view altered. SQL> exec dbms_mview.refresh('MV','C') PL/SQL procedure successfully completed. SQL> insert into a values (1, '[email protected]'); 1 row created. SQL> insert into b values (1, '[email protected]'); 1 row created. SQL> commit; commit * ERROR at line 1: ORA-12008: error in materialized view refresh path ORA-02290: check constraint (V195588.MV_CHK) violated SQL> rollback; Rollback complete. SQL> insert into a values (1, '[email protected]'); 1 row created. SQL> insert into b values (1, '[email protected]'); 1 row created. SQL> commit; Commit complete. SQL> select * from a; ID ---------- EMAIL ------------------------------------------------------ 1 [email protected] SQL> select * from b; ID ---------- EMAIL ------------------------------------------------------ 1 [email protected] SQL> select * from mv; CNT ---------- 0 SQL>
Tags: Database
Similar Questions
-
How can I write in a table cell (row, column appear) in a databae?
How can I write in a table cell (row, column appear) in a database using LabVIEW Database Toolkit? I use Ms Access. Suppose I have three columns in a table, I write 1 row of the 1st column, then 1st rank of the 3rd column. The problem I have is after writing the 1st column of 1st row, the reference goes to the second row, and if I write in the 3rd column, he goes to the 2nd row 3rd column. Any suggestion?
When you perform a SQL INSERT command, you create a new line. If you want to change an existing line, you must use the UPDATE command (i.e. UPDATE tablename SET column = value WHERE some_column = some_value). The some_column could be the unique ID of each line, date and time, etc.
I don't know what is the function to use in the Toolbox to execute a SQL command, since I do not use the Toolbox. Also, I don't understand why you don't do a single INSERT. It would be much faster.
-
How to join this per_rating_levels this table with query table.
Dear all,
Guide how 2 join me per_rating_levels this table with query because, I want 2 see the per_rating_levels.name against all employees.
When I join this table with query it shows several recording/cortion against this record.
Query:
SELECT
PAPF.full_name employee_name,
papf1.full_name supervisor_name,
WOMEN'S WEAR. Employee_number,
hr_general.decode_job (PAAF.job_id) job_name,
Department of hr_general.decode_organization (PAAF.organization_id),
PC.Name, PCE.Comments EmployeeComments,
(by selecting pce1.comments in per_competence_elements pce1
where
PCE.assessment_id = pce1.assessment_id
AND pce.competence_id = pce1.competence_id
AND pce1.object_id = pce.object_id) ManagerComments;
--(sélectionnez rtl.name dans rtl où les pc.) RATING_SCALE_ID = rtl. Name RATING_SCALE_ID)
OF per_all_people_f women's wear.
per_all_people_f papf1,
per_all_assignments_f ADP,
PA per_appraisals,
pat per_appraisal_templates,
per_assessments not,
per_competence_elements pce,
per_competences pc
WHERE papf.person_id = paaf.person_id
AND paaf.supervisor_id = papf1.person_id
AND paaf.primary_flag = 'Y '.
AND pa.appraisee_person_id = papf.person_id
AND pa.appraisal_template_id = pat.appraisal_template_id
AND pa.appraisal_id = pas.appraisal_id
AND pat.assessment_type_id = pas.assessment_type_id
AND pas.assessment_id = pce.assessment_id
AND pce.object_id = papf.person_id
AND pce.competence_id = pc.competence_id
AND trunc (sysdate) BETWEEN papf.effective_start_date AND papf.effective_end_date
AND trunc (sysdate) BETWEEN papf1.effective_start_date AND papf1.effective_end_date
AND trunc (sysdate) BETWEEN paaf.effective_start_date AND paaf.effective_end_date
- AND papf.employee_number =: p_employee_number
- AND pa.appraisal_date =: p_appraisal_date
- AND papf.business_group_id =: p_bg_id
order of papf.employee_number
Concerninguser10941925 wrote:
Dear all,Guide how 2 join me per_rating_levels this table with query because, I want 2 see the per_rating_levels.name against all employees.
When I join this table with query it shows several recording/cortion against this record.'2' in your question means "to"? If so please do not use text instant message in this forum.
Now I suppose that PRE_RATING_LEVELS is a table in your application. And you are trying to include this table in an existing query. But in doing so, you have found the Cartesian product, correct?
In fact, how do you think someone a public forum without any knowledge of your table and data structure could help you?
Lets see, here's your query. I formatted.
select papf.full_name employee_name , papf1.full_name supervisor_name , papf.employee_number employee_number , hr_general.decode_job(paaf.job_id) job_name , hr_general.decode_organization(paaf.organization_id) department , pc.name name , pce.comments employeecomments , ( select pce1.comments from per_competence_elements pce1 where pce.assessment_id = pce1.assessment_id and pce.competence_id = pce1.competence_id and pce1.object_id = pce.object_id ) managercomments from per_all_people_f papf , per_all_people_f papf1 , per_all_assignments_f paaf , per_appraisals pa , per_appraisal_templates pat , per_assessments pas , per_competence_elements pce , per_competences pc where papf.person_id = paaf.person_id and paaf.supervisor_id = papf1.person_id and paaf.primary_flag = 'Y' and pa.appraisee_person_id = papf.person_id and pa.appraisal_template_id = pat.appraisal_template_id and pa.appraisal_id = pas.appraisal_id and pat.assessment_type_id = pas.assessment_type_id and pas.assessment_id = pce.assessment_id and pce.object_id = papf.person_id and pce.competence_id = pc.competence_id and trunc(sysdate) between papf.effective_start_date and papf.effective_end_date and trunc(sysdate) between papf1.effective_start_date and papf1.effective_end_date and trunc(sysdate) between paaf.effective_start_date and paaf.effective_end_date order by papf.employee_number
Now, you want to add the PRE_RATING_LEVELS in the list so that you can use the column NAME.
First thing you need to do is to determine the relationship between PRE_RATING_LEVELS and other tables. A relationship can be
1. one on one
2 one-to-many
3. - to-severalSo when you tried to join, your state of health has resulted in 2nd or 3rd type of relationship. If you arrive with someone who knows the business and the data and find the table that could uniquely identify a line of PRE_RATING_LEVELS.
-
JS: How to remove duplicates in a table?
JS: How to remove duplicates in a table?
I guess there's a simple solution...
Hey!
Maybe something like this:
Array.prototype.unique = function (){ var r = new Array(); o:for(var i = 0, n = this.length; i < n; i++){ for(var x = 0, y = r.length; x < y; x++){ if(r[x]==this[i]) continue o;} r[r.length] = this[i];} return r; }
Use:
var myArray = ["a","b","c","c","a","d","b","b"]; alert(myArray.unique());
Hope that helps.
--
tomaxxi
-
How to create unique variables for... in loop? (AS2)
Hello
I have a function onEnterFrame controlling all the movie clips in a table. The movement of each of these clips is controlled by a few variables - speed, acceleration, etc - that are changed on every enterFrame. I can't understand how to create unique variables for each element of the array. Now my variables are the same for all elements, and therefore the proposals of each video clip are the same.
I used this code to add my video clips in the table:
for (i = 0; i < starNumber; i ++) {}
duplicateMovieClip (star, "star" + I, i);
starArray.push (this ["star" + String (i)]);
}I do a similar thing to create unique variables for each? Or is there something I need to do my loop (myClip in myArray) which is contained in my onEnterFrame function?
I can post my code if that would help (65 lines).
Creating unique variables is easy way out. Here's the modified code using unique variables that should solve your problem:
var i: Number;
var starArray:Array = [];
var starArray_X:Array = [];
var starArray_Y:Array = [];
var mc:String;
var scale: number;
var speedXMod:Number;
var speedYMod:Number;
var starNumber:Number = 10;
var minSize:Number = 15;
var maxSize:Number = 80;
var speed: number = 0.2;
var minSpeed:Number = 0;
var maxSpeed:Number = 1;
for (i = 0; i< starnumber;="">
duplicateMovieClip (star, "star" + I, i);
starArray.push (this ["star" + String (i)]);
}
(MC starArray) {}
starArray [mc] ._x = (Math.Random () * Stage.width);
starArray [mc] ._y = (Math.Random () * Stage.height);
scale = (minSize + (Math.Random () * (maxSize - minSize)));
._xscale starArray [mc] = scale;
starArray [mc] ._yscale = scale;
var startSpeedX:Number = ((Math.pow (-1, (Math.round (Math.random ())) * (minSpeed + (Math.Random () * (maxSpeed - minSpeed)));)))
var startSpeedY:Number = ((Math.pow (-1, (Math.round (Math.random ())) * (minSpeed + (Math.Random () * (maxSpeed - minSpeed)));)))
[mc] starArray_X = startSpeedX;
[mc] starArray_Y = startSpeedY;
onEnterFrame = function() {}
(MC starArray) {}
speedXMod = ((Math.random () * acceleration)-(0,5 * accélération));
speedYMod = ((Math.random () * acceleration)-(0,5 * accélération));
If (((Math.abs (starArray_X [mc] + speedXMod)) < maxspeed)="" &&="" ((math.abs(stararray_x[mc]="" +="" speedxmod))=""> minSpeed)) {}
[mc] starArray_X += speedXMod;
} else {}
[mc] starArray_X = speedXMod;
}
If (((Math.abs (starArray_Y [mc] + speedYMod)) < maxspeed)="" &&="" ((math.abs(stararray_y[mc]+="" speedymod))=""> minSpeed)) {}
[mc] starArray_Y += speedYMod;
} else {}
[mc] starArray_Y = speedYMod;
}
If (((starArray [mc]._x + starArray_X[mc]) > 0) & ((starArray [mc]._x + starArray_X[mc])))<>
starArray [mc] ._x += starArray_X [mc];
} else {}
starArray_X [mc] * = - 1;
starArray [mc] ._x += starArray_X [mc];
}
If (((starArray [mc]._y + starArray_Y[mc]) > 0) & ((starArray [mc]._y + starArray_Y[mc])))<>
starArray [mc] ._y += starArray_Y [mc];
} else {}
starArray_Y [mc] * = - 1;
starArray [mc] ._y += starArray_Y [mc];
}
}
}
}
-
How to find the user Apex table
Hello
Please let me know, how to find the user apex table. I need validate the unique user based on the same, for which I use below function.
DECLARE
VAL A BOOLEAN;
BEGIN
VAL: = APEX_UTIL.IS_USERNAME_UNIQUE (p_username =
(: P6_USERNAME);
END;
However, in this case, he always comes back "FALSE," saying new user exists.
Kindly help me in fixing this problem.There is a view called apex_workspace_apex_users.
Details under Home > utilities > Application Express views
André
-
How to force firefox to use internal device fonts not Web page fonts.
How to force firefox to use internal device fonts not Web page fonts.
You can set browser.display.use_document_fonts to 0 in: config. Note that this will remove the style of sites and may result in websites being unreadable.
-
I know how to force the Spotlight for re - index a drive or a folder.
But how then do I mail? I drag this file to the window?
Thank you.
Try re-indexing of mailboxes mailbox. This can take some time if you have a lot of mail.
Reindex messages For El Capitan, try looking in V3.
Reindex messages (2) See post by Linc Davis
-
How to save the data in table 1 d to Excel in continuous
Mr President.
How to save the data in table 1 d to Excel at all times, so that all the data of the first scan must be placed first thought and all the data from the second analysis must be placed on the second Board and continue on the street...
Sy@m...
Hi Sy@m
Here is a vi that might give you a few ideas to try:
-
How to add items to a table 1 d with each iteration?
Hello
I have a 3 loop iteration For which gives a table of 5 elements after his execution. At each iteration of the loop, how can I add each item to its previous value to form a final picture of the cumulative sum of the parts? For example:
Array of values for 1st iteration: [A, B, C, D, E]
Array of values for 2nd iteration: [F, G, H, I, J]
Array of values for the 3rd iteration: [K, L, M, N, O]
How can I make the Final table being a cumulative amount of IE: [(A + F + K), (L + B + G), (C + H + M) (D + I + N) (E + J + O)]?
Your help will be apreciated, thanks!
The Add function is polymorphic. So, if you give 1 2 tables you will get a table that corresponds to the sum of each item. With a loop, you must use a node registry or feedback shift to keep track of the sum of the currents.
For example:
-
How to force the old games in a window instead of full screen__
How to force the old games in a window instead of full screen
to lighten my load of vid card and switch between windows without minimize
This is for vistaSome games have a function of window mode and others are not.
as:
If you put at the end of the section 'target' shortcut in the Sims 2, the command w as follows:
| "X:\programs\games\sims 2\bin\Sims2.exe" w |
The Sims 2 will run in windowed mode those that run you it!
but not all games have the option!
then go to Google and look for some info there ;)
-
How do force you a T410 to recognize wifi networks?
How do force you a T410 to recognize wifi networks?
I have a t410 that my company has released me. Works fine at the office on a wired network. But I can't take anywhere and use wifi. The only network he displays when you click the network icon in the status bar is Verizon Wireless (which is not the same configuration in our laptops).
When you click on network and sharing Center, and then manage wireless networks, all networks wifi, I need to use are here. But it won't recognize them. They are all configured properly.
BTW, with my Macbook Air adjacent to the T410 and connects to my wifi network instantly. Network plug from your cell phone, both are set up the same.
Our it guy says I should remove and reconfigure each network. It does not help.
Any suggestions?
After the validation I continued searching this forum for an answer to my problem. I found an old post on the t410 turn off random wireless connectivity. It does this without any notice. The hotfix that is described in this post is not applicable to the version (current?) of Thinkvantage on my new Lenovo.
Here's the message I think solved the problem:
-----------------------------------------------------------------------------------------------
-
How to add data to the table using Manager POST for restful Apex application
Hi all
I managed to create a service application web Manager restful using GET for the Restful service module. I am able to get the data in row on the presentation of a table row id in the application. But I can't find an appropriate example, how the new data in the table can be posted or deleted. I created a POST handler for a URI scheme and look forward on how to proceed. Any help would be really appreciated.
Source for the POST Manager:
Start
insert into ALL_BOOKS values(:id,:book);
end;
Also created 2 parameters id and the book.
Hi jerry2134,
jerry2134 wrote:
I managed to create a service application web Manager restful using GET for the Restful service module. I am able to get the data in row on the presentation of a table row id in the application. But I can't find an appropriate example, how the new data in the table can be posted or deleted. I created a POST handler for a URI scheme and look forward on how to proceed. Any help would be really appreciated.
Source for the POST Manager:
Start
insert into ALL_BOOKS values(:id,:book);
end;
Also created 2 parameters id and the book.
Check out the following tutorials OBE, that explains the creation of GET and POST RESTful Web Services and how to use them in the APEX.
- Creation and use of RESTful Web application services Express 4.2
- Creation and use of RESTful Web application services Express 5.0
Also what yo mean "looking forward on how to proceed? Do you want to or created for use/consume in your Oracle APEX application hosted RESTful web services?
If Yes, in your Application, you must create a RESTful Web Service reference -> shared components. Then, create a form/report based on Web Service reference.
Kind regards
Kiran
-
How to force mobile phone breaking - point?
Hello
On other software, there are ways to make the browser flip mobile available as soon as it DETECTS a phone.
On the page layout, I created
www.lookin360.co.UK
the provision of mobile phone is here, but because my phone samsung has a resolution MUCH greater than 500 pixels across, the phone displays the menu Burger (for mobile), but the page is wider than 500 pixels.
How to force the phones available to 500 pixels is displayed automatically and to fill the phone screen with this broad provision of 500 pixels?
Is it possible on muse, how?
Thank you
Select this option.
freddyphoesh wrote:
Hello
On other software, there are ways to make the browser flip mobile available as soon as it DETECTS a phone.
On the page layout, I created
www.lookin360.co.UK
the provision of mobile phone is here, but because my phone samsung has a resolution MUCH greater than 500 pixels across, the phone displays the menu Burger (for mobile), but the page is wider than 500 pixels.
How to force the phones available to 500 pixels is displayed automatically and to fill the phone screen with this broad provision of 500 pixels?
Is it possible on muse, how?
Thank you
Select this option.
Here's the thing... not all phones allow a browser detect and you can't change that.
You can set a backup for some phone page or all sites, but your design is heavy handed with the CSS and a large number of phones | a desktop browser will not play nice.
Just to be clear, you can design a version 'phone' and link to your desktop... that gives the user the power to choose the version they want to use but forced upgrade page is not a good idea.
example = rural - Bank Internet banking
-
Hey Geeks,
I met a problem when starting my 12 c RAC database.
To mount it fine, but when I try to open, he throws me an error.
System Global area 1.5400E + 10 bytes
Bytes of size 4737560 fixed
2952791528 variable size bytes
1.2415E + 10 bytes database buffers
Redo buffers 26857472 bytes
Mounted database.
SQL > alter database open;
change the database open
*
ERROR on line 1:
ORA-01092: ORACLE instance is complete. Disconnection forced
ORA-00942: table or view does not exist
Process ID: 11338068
Session ID: 1429: No.3
Here is the output of the trace file...
ORACLE_HOME = / oracle_home/app/orahome
Name of the system: AIX
Name of the node: INS1
Version: 1
Version: 7
Machine: 00C8CCA74C00
Instance name: INST1
Redo thread mounted by this instance: 1
Oracle process number: 7
The Unix process PID: 20381876, image: oracle@ins1 (TNS V1 - V3)
2014-11-27 22:49:20.892
SESSION ID: (197.5) 2014-11-27 22:49:20.892
CUSTOMER ID :() 2014-11-27 22:49:20.892
NAME OF THE SERVICE :() 2014-11-27 22:49:20.892
NAME of the MODULE: (sqlplus@ins1 (TNS V1 - V3)) 22:49:20.892 2014-11-27
ACTION NAME :() 2014-11-27 22:49:20.892
2014-11-27 22:49:20.889716: start the recovery of field = 0, valid = 0, flags = 0 x 4
2014-11-27 22:49:24.580
Awarded with 32 slaves of recovery success
With the help of 3 buffers overflow by slave of recovery
2014-11-27 22:49:24.740
1 post of thread: logseq 15, block 2, CHN 3510749
cache-bass rba: logseq 15, block 3
RBA on disk: logseq 15, block 72, RCS 3510824
Start the recovery at logseq 15, block 3, Yvert 0
2014-11-27 22:49:24.981
Started the resilvering redo thread 1 seq 15 blocks 72-73
2014-11-27 22:49:24.994
Finished resilvering redo thread 1 seq 15
2014-11-27 22:49:24.994
Started writing zeroblks thread 1 seq 15 blocks 74-81
2014-11-27 22:49:24.994
Completed written zeroblks thread 1 seq 15
= Redo read statistics for thread 1 =.
Total physical reads (from disk and memory): 4096 KB
-Redo read_disk - statistics
Read rate (ASYNC): 35KO in 0,25 s = > 0.14 Mb / s
Long: 0 Ko, moves: 0/104 (0%)
Longer LWN: 2 k, moves: 0/33 (0%), moved: 0 MB
Redo last scn: 0x0000.0035922b (3510827)
----------------------------------------------
-Recovery Hash Table statistics
Hash table buckets = 262144
More long string hash = 1
Hash string average = 25/25 = 1.0
Max compares by lookup = 1
AVG compares by lookup = 151/176 = 0.9
----------------------------------------------
2014-11-27 22:49:25.007
KCRA: start the debt for 25 blocks of data collection
2014-11-27 22:49:25.039
KCRA: treated blocks = 25/25, has claimed = 25, eliminated = 0
2014-11-27 22:49:25.054
Online Redo Log recovery: thread 1 mem Group 6 Seq 15 reading 0
2014-11-27 22:49:25.060
Ask again filled with 0.02 MB
2014-11-27 22:49:25.235
Control of completed recovery point
-Recovery Hash Table statistics
Hash table buckets = 262144
More long string hash = 1
Hash string average = 25/25 = 1.0
Max compares by lookup = 1
AVG compares by lookup = 176/176 = 1.0
----------------------------------------------
Recovery thread nab 1 seq 15 to 74 with 8 zeroblks sets
2014-11-27 22:49:26.000
2014-11-27 22:49:26.000433: validate the domain 0
2014-11-27 22:49:26.001348: valid domain 0, flags = 0x0
2014-11-27 22:49:28.315
County ofsmtab$: 0 entries
2014-11-27 22:49:28.732
ORA-00942: table or view does not exist
ORA-00942: table or view does not exist
2014-11-27 22:49:28.738
USER (ospid: 20381876): put an end to litigation because of the 942 error
In my case, the problem solved by running the following...
GRANT SELECT on SYS. The USER$ in XDB.
GRANT SELECT on SYS. The USER$ in CTXSYS.
GRANT SELECT on SYS. The USER$ to DVSYS;
GRANT SELECT on SYS. The USER$ to LBACSYS.
GRANT SELECT on SYS. The USER$ to APEX_040200;
GRANT SELECT on SYS. The USER$ to DV_SECANALYST;See the screenshot above.
Maybe you are looking for
-
Windows Mail just started to duplicate my incoming e-mail messages (perhaps too outgoing). I couldn't find a solution in respect of the aid. Any ideas?
-
OfficeJet Pro 6835: Printer reset the date and time and other actions not initiated
My printer (Officejet Pro 6835) turns on randomly and want to reset/confirm the date and time settings. Sometimes even lights up and wants to resume a scan or fax that was never launched. I want to stop this behavior.
-
I think I should have downloaded a preliminary 10 widows file - need help
This has probably been asked & answered several times, but I'm not... With so much confusion to Windows 10 debacle, I've heard that the update process can have "snuck" a 10 preliminary Windows or files in the updates of Windows 7. There was a widesp
-
HP Driver PSC2210 for Windows 7
During the upgrade process to Windows 7 from Vista, I received a message that my HP2210 would probably have problems and advised to uninstall the current software, I did. The upgrade went smoothly. However, not only has Windows Update never install
-
Configuration of encryption on CUCM 8.6 and unity 8.6
Hi team voice, i´d like to know what I need (hardware) to the configuration of encrypting the voice on my CUCM 8.6 and 8.6 of connection of the unit too. I have two MCS 7816 (CUCM) and MCS 7825 (Unity). Thank you Thiago