Prevent Duplicate Entries through Validation after submit apex 4.1

Hi There
I'm having issues with the following, i'm creating a validation after submit, if the column FFILE already has the same data then do no insert the submission. I've also thought doing a constraint for the column with a check key, but not sure how to write constraint expression in pl/sql as text.
so for the validation creation i have
SQL
type: Exists
Validation Expression
select 1 from PLDB2 where FFILE = :P2_FFILE
FFILE is the column, P2_File is the number field on a form page for users to submit along with other data.
If i want to check more than one column with the entries, how would i write the expression?
Thank you kindly,
Below is my table
CREATE TABLE "PLDB2"
(     "ID" NUMBER,
     "BANK" VARCHAR2(30),
     "END_DATE" DATE,
     "FFILE" NUMBER,
     "CLERK" VARCHAR2(30),
     "MORTGAGE_FILE_NUMBER" VARCHAR2(500),
     "MORTGAGOR" VARCHAR2(30),
     "PROPERTY_ADDRESS" VARCHAR2(500),
     "OCCUPANCY" VARCHAR2(30),
     "INSURER" VARCHAR2(10),
     "COMMISSION" VARCHAR2(5),
     "START_DATE" DATE,
     "PM_COST" VARCHAR2(500),
     "LISTING_CLERK" VARCHAR2(50),
     "NUMBER_OF_DAYS" NUMBER,
     "CLOSING" DATE,
     "FCOMMENT" VARCHAR2(500),
     "ESCALATED_FILES" VARCHAR2(30),
     "CURRENT_FILES" VARCHAR2(30),
     "MORTGAGOR_OCCUPANCYAWAITING_E" VARCHAR2(30),
     "LISTED_FILES" VARCHAR2(30),
     "CHECK_LIST_RECIEVED" DATE,
     "CREATED_ON_PKW" DATE,
     "SPECIAL_CODED_FILE" NVARCHAR2(500),
     "FILES_WITH_ISSUES" NVARCHAR2(500),
     "APPRAISED_VALUE" NUMBER,
     "SALE_PRICE" NUMBER,
     "MORTGAGE_BALANCE" NUMBER,
     "PM_CONTACT" VARCHAR2(500),
     "NPMCOST" NUMBER,
     "SOLD" NVARCHAR2(500),
     "TRANSFER" NVARCHAR2(500),
     CONSTRAINT "PLDB2_PK" PRIMARY KEY ("ID") ENABLE
CREATE OR REPLACE TRIGGER "PLDB2_T1"
BEFORE
insert or update on "PLDB2"
for each row
declare
v_number_of_days number;
begin
IF :NEW.END_DATE IS NULL THEN
v_number_of_days :=NULL;
ELSE
v_number_of_days := to_date(:NEW.START_DATE,'DD/MM/YYYY') - to_date(:NEW.END_DATE,'DD/MM/YYYY');
END IF;
:NEW.NUMBER_OF_DAYS := v_number_of_days;
end;
ALTER TRIGGER "PLDB2_T1" ENABLE;
CREATE OR REPLACE TRIGGER "bi_PLDB2"
before insert on "PLDB2"
for each row
begin
if :new."ID" is null then
select "PLDB2_SEQ".nextval into :new."ID" from dual;
end if;
end;
ALTER TRIGGER "bi_PLDB2" ENABLE;

Hi,
I'm having issues with the following, i'm creating a validation after submit, if the column FFILE already has the same data then do no insert the submission. I've also thought doing a constraint for the column with a check key, but not sure how to write constraint expression in pl/sql as text.so for the validation creation i have
SQL
type: Exists
Validation Expression
select 1 from PLDB2 where FFILE = :P2_FFILE
FFILE is the column, P2_File is the number field on a form page for users to submit along with other data.
If i want to check more than one column with the entries, how would i write the expression?>
select 1 from PLDB2 where FFILE IN (:P2_FFILE,:P2_FFILE_1,...,:P2_FFILE_n)Is that what you are looking for?
Cheers,

Similar Messages

  • Need advice on preventing duplicate entries in People table

    Hi,
    In my database, I have a "People" table where I store basic information about people e.g. PersonId, FirstName, LastName, Gender, etc.
    There will be lots of entries made into this table and I want to prevent duplicate entries as much as humanly possible. I'd appreciate some pointers on what I should do to minimize duplicates.
    My primary concerns are:
    Duplicate entries for the same person using the person's full name vs. given name e.g. Mike Smith and Michael Smith
    Making sure that two separate individuals with identical names do get entered into the table and get their unique PersonId's.
    Not even sure how I can even possibly know if two individuals with identical names are two different people without having additional information but I wanted to ask the question anyway.
    Thanks, Sam

    Thank you all very much for your responses.
    There are three separate issues/points here.
    It is clear that it is impossible to prevent duplicates using only a person's first, middle and last names. Once I rely on an additional piece of information, then things get "easier" though nothing is bullet proof. I felt that this was self evident but
    wanted to ask the question anyway.
    Second issue is "potential" duplicates where there are some variations in the name e.g. Mike vs Michael. I'd like a bit more advice on this. I assume I need to create a table to define variations of a name to catch potential duplicates.
    The third point is what Celko brought up -- rather nicely too :-) I understand both his and Erland's points on this as typical relational DB designs usually create people/user tables based upon their context e.g. Employees, Customers, etc.
    I fundamentally disagree with this approach -- though it is currently the norm in most commercial DB designs. The reason for that is that it actually creates duplicates and my point is to prevent them. I'm going for more of an object based approach in the DB
    design where a person is a person regardless of the different roles he/she may play and I see no reason in repeating some of the information about the person e.g. repeating first, last name, gender, etc in both customer and employee tables.
    I strongly believe that all the information that are directly related to a person should be kept in the People table and referenced in different business contexts as necessary.
    For example, I assign every person a PersonId in the People table. I then use the PersonId as part of the primary key in the Customers or Employees table as well. Obviously, PersonId is also a foreign key in Customers and Employees tables. This prevents the
    need for a separate CustomerId and allows me to centralize all the personal data in the People table.
    In my opinion this has three advantages:
    Prevent duplication of data
    Allow global edits e.g. if the last name of a female employee changes, it is automatically updated for her within the context of "Customer" role she may play in the application.
    Last but not least, data enrichment where a person may enter additional data about himself/herself in different contexts. For example, in the employee context, we may have the person's spouse information through "Emergency Contacts" which may come handy
    within the context of customer for this person.
    Having everyone in the People table gives me these three advantages.
    Thanks, Sam

  • How to prevent duplicate entry in Details block

    Dear All
    I am using Forms 10g.
    I have a detail block.
    There is a column called Ip_Address.
    There i want to prevent duplicate entry .
    How can i do this ?

    hey i have a requirement that to restrict duplicate entry in both block(both multi record).the blocks are DEPT(MATER)
    EMP(DETAIL)
    the associated fieds in master block DEPT.DEPT_NO,in detail EMP.EMP_ID .
    I have done' Kevin D Clarke’s calculated item ' both in master and detail block
    its working fine for master block but in case of detail block its only respond to the current session(i.e. if the new value is inserted or save it will restrict another record to be inserted of that last record's value),it does not restrict duplicate value enter ,checking with other existing records(which are saved in earlier session,though after query it is shown on the form)
    can anyone guide me why its not working

  • Duplicate entries for contacts after BB update 10.2.1.2102

    Hi,
    This is in regards to my boss's blackberry q10.
    I recently updated the OS to 10.2.1.2102 (done via phone update not via BB link).
    After the update, i noticed that all contacts had a duplicate entry with only one of them containing the proper details while the other was blank. I have uploaded the pics through the dropbox link below.
    pictures for BB Q10 
    If i delete the blank contact, it solves the problem but I have to do it individually for each contact.
    Is there a better way of doing this? Would really appreciate your help here.
    Thanks,
    Brennan

    If you open the blank one and go to the bottom and hit "Link" does it show what contact list the blank one is in?
    Also, where was the source of the contacts to begin with? Did they come from an Exchange mailbox? Another email account? Wired sync from Link?
    1. Please thank those who help you by clicking the "Like" button at the bottom of the post that helped you.
    2. If your issue has been solved, please resolve it by marking the post "Solution?" which solved it for you!

  • Prevent duplicate entry

    I would like to make sure there are no duplicate data entries in my Oracle 9i table (called MainTable) which has an Id field that is the primary key, ValData with a varchar data type, Fid and Fid2 are number data types.
    Id   ValData   Fid   Fid2
    1    abc       34    2
    2    efg       23    34
    3    zeo       25    43Sometimes someone can enter a duplicate ValData, Fid and Fid2 and it will end up like this:
    Id   ValData   Fid   Fid2
    1    abc       34    2
    2    efg       23    34
    3    zeo       25    43
    4    zeo       25    43What constraints or restrictions can I place on the MainTable where it will never allow a duplicate entry into the table?
    I would like to do this somehow in the database. If someone tries to enter a duplicate I should get a error message or something to indicate an attempt to enter duplicate data.
    Please advise if this is possible?

    We told you above - next level of support is onsite but not sure your zipcode is similar to mine.
    First you have to clarify if the three fields must be uniq as a combination or if valdata alone cannot be duplicated. In other words:
    id valdata fid fid2
    1 abc 34 2
    2 abc 23 34
    is this legal?
    Depending on the answer you apply the appropriate solution. If answer is yes, you apply this:
    alter table <table name> add constraint uniq_combination unique (valdata, fid, fid2);
    if answer is that it is illegal because you want to prevent valdata alone to assume duplicate values, then:
    alter table <table name> add constraint uniq_valdata unique (valdata);
    See Guido's comment above concerning the handling of the DB generated error.
    enrico

  • Blackberry Travel 3.1.1.2 - Duplicate entries in Calendar after system restore

    I love the Blackberry Travel app, it is an absolute must for me and I auto sync it to my calendar as a default setting. I have the Z10, and Blackberry Travel 3.1.1.2 software.
    Every time I install a new OS, and resync my calendar from Outlook using  Link, after I reinstall and log back into Blackberry Travel, it will create duplicates of my upcoming trip entries in my calendar.
    These are entries that were created by Blackberry Travel previously and were synced with Outlook prior to the system wipe and then restored using an Outlook sync.
    It would be great if Outlook would check for calendar conflicts for preexisting entries that are exactly the same before adding a new trip to the calendar.
    I also noted that if I have a trip (with a name October Travel) with a departure date of October 6 (for example) and arrival date of October 13, although the return flight is correctly placed in the calendar on the 13th, the entire trip is marked from October 6-12 (missing the last day in the calendar).
    Please check on these issues, otherwise super app!

    Yea, I've noticed the same on the duplicate entry issue, and just delete the duplicate.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Prevent Duplicate Record with Validation

    Hello,
    Can someone suggest to me how I can check a form such that it does not have a duplicate record, when a user either saves or creates the record?
    In particular, I am looking at 2 fields in a record as the criterai for determine duplicity:
    select PEOPLE_ID, DEPT_ID
    from AN_PEOPLEDEPT
    where PEOPLE_ID = :P12_PEOPLE_ID and
    DEPT_ID = :P12_DEPT_ID
    It would be nice to know how to make this work with only one validation in a page definition.
    Thank you for your comments.
    Regards,
    Colin.

    1. Create a validation.
    2. Choose "Page Level"
    3. Choose "SQL"
    4. Choose "Exists"
    5. Give it a name and choose "Inline in notification"
    6. Enter your query, simaler to the one I posted before but using your table name and your items
    That's it. Essentially, you can create validations that display the error next to the item (won't work for you as it's just one item), display the error on an error page forcing the user to go back a page to edit the form (not ideal), or in the Notification area at the top of the page (as determined by your page template). The latter is the one your want. The validation will query your table based on the values of your two items. If there is a row that matches the values of the 2 items, then it will show the form again with an error message at the top. Just try following the steps I detailed above. After you create a validation or two, this should make sense.
    Please listen to my advice about adding a unique index on the table as well. An ORA-XXXX error is ugly which is why I'm glad you're doing it with an HTML DB validation too, but the unique index will insure that you NEVER have dupes in your table. I can't stress this enough. Think about the check engine light on a modern car. It gives you a "pretty" reminder that something is wrong (low oil, too hot), but will typically shut the engine down before any real damage is done. We want the friendly reminder so we can get it to a mechanic, but the real safe-guard is under the covers and prevents any real damage from occuring, even if people ignore the warning light (no "wife ignoring the low oil light" jokes here please).
    Tyler

  • How can I restore corrupt form history and prevent duplicate entries?

    After having used 3.6.2, I recently upgraded to the latest version because I was getting tired of sites not working properly. For the most part, the transition has gone smoothly, but I lost all of my form history. It's not a huge deal, but having it was incredibly convenient for me. Instead of continuing to make all new form history entries, is it possible to use the old ones again? I have the original formhistory.sqlite file, but whenever I try to use it, it gets renamed to formhistory.sqlite.corrupt and Firefox creates a new file. Is the original too old and incompatible or is there something I can do?
    Also, I'm having a bit of an issue with Firefox regularly creating duplicate form history entries. For instance, when opening the list for a Username text field, "ZombieToast" will be listed twice. I delete the duplicates when I come across them, but they keep sprouting up and I don't know why.

    hello, the duplicate form entries are a bug in firefox 23 and will be fixed in the upcoming version.
    please also [https://www.mozilla.org/en-US/plugincheck/ update your plugins] (some of them are out-dated & have security vulnerabilities that are actively exploited on the web).

  • Blocking of duplicate entry

    We would like to block duplicate entries from being posted into our database especially the BP ref no field in the AP invoice.
    I have read through a post which shows the procedure of doing this through an approval procedure. However, is there another way to prevent duplicate entries like this from adding into the database such that it blocks the user if he has duplicated this field rather than sending an apprval procedure? One way of doing this is by creating an SBO_SP_TransactionNotification which blocks the transaction from adding. Would someone be having a sample code for this?
    Thanks & Regards,
    Asif

    Hi
    You can use this stored procedure in sp_transaction_notification. Please test this in test environment before you proceed.
    /** block duplicate Vendor Invoice number **/
    if (@object_type = '20' or @object_type = '18')
    and (@transaction_type= 'A' or @transaction_type= 'U')
    begin
    declare @venno as varchar(100)
    if @object_type = '20'
    begin
    select @venno = NumAtCard
    from opdn
    where docentry =@list_of_cols_val_tab_del
    if 1 != (select count(docentry) from opdn with(nolock) where NumAtCard = @venno)
    begin
    select @error = 1
    select @error_message = 'Duplicate vendor ref no in PO Receipts. ! '
    end
    end
    else
    if @object_type = '18'
    begin
    select @venno = NumAtCard
    from opch
    where docentry =@list_of_cols_val_tab_del
    if 1 != (select count(docentry) from opch with(nolock) where NumAtCard = @venno)
    begin
    select @error = 2
    select @error_message = 'Duplicate vendor ref no in AP Invoices. ! '
    end
    end
    end

  • Duplicate Entries in APEX Report

    Hello everyone,
    I'm generating an APEX report that selects records and the user assigned to them. The records are all unique in the main table, but I have to link 4 different tables together to get all the information I need. In one of the tables, there are many different entries referencing the same CallID. This is causing my report to display all of those entries, even though they are duplicates on the report. Is there a way to make that column in the table unique, or prevent the entries from appearing multiple times?
    I've tried using the Group By statement, but I get this error "ORA-00979: not a GROUP BY expression".
    Thanks.

    Hi,
    It would depend on what data you actually want to end up with. If the information in each record on the final table is unique apart from the CallID value, then you will end up with "duplicates" of the data in the other three tables. If you think of a simplified version of this, you have a parent/child relationship between the tables - looking at things from the child table's point of view, several child records may have the same parent. Therefore, if you create a report that includes ALL details from ALL tables, then you will see the parent's information displayed for each child.
    So, if you only want to see one parent's information regardless of the number of child records you have, you either have to combine the child records into a single value or use the Apex report's "Break Formatting" functionality (shown at the bottom of the report's Report Attributes tab). Using the GROUP BY within the SQL statement would normally require you to use an aggregation function to return a single value from the child table - for example, MAX(), MIN(), SUM(), COUNT() etc. If you didn't want to aggregate data, you could use DISTINCT instead (as in SELECT DISTINCT fieldlist FROM tables) but this will only remove duplicate records where ALL values in ALL columns matched.
    So, it does depend on the data itself and how you want to display it.
    Andy

  • How to prevent duplicate submit

    I am looking for a solution to prevent duplicate submit on the click of submit button or browser refresh. In Struts its quite easy to implement using toekn feature.
    Is there some feature in JSF which I can use to prevent duplicate submit?
    Please share your thought.

    Redirect after POST.

  • APD - Duplicate Entries After Consecutive Joins

    Hello All,
    I am working with BI 7.0
    I am fairly new to BI and APD and I ran into an issue where I would get duplicate entries after a join. What the APD does is: read data from Infoprovider and filter, then I get the medium text description for the characteristic, cost center, from the master data and inner join it to the table. I checked the data here and its fine. Next, I get the medium text description for the characteristic, cost element, from the master data and inner join this to the table. This second join is where the duplicate issue occurs. Also, are there workarounds beside an ABAP routine to delete duplicate entries, or other ways to bring in the medium text description of an infoobject?
    Thanks
    Edited by: Justin Mabitad on Jul 14, 2009 11:34 AM

    I added aggregations after each filter

  • How to populate/persist right-side of Shuttle in apex 3.1.2 after submit

    In the new Shuttle I can only specify one LOV (select empname, empid from emp where empid not in (1,3,4)) but I also want to populate the right-side of the shuttle to show values which the non-members (select empname, empid from emp where empid in (2,5)) so that the user can make selections which persist after submit.

    Rashid,
    The method that worked for me was to:
    1) Create the LOV to populate the Left side of the shuttle (unselected).
    2) Define the Source property to populate the Right side (selected). In my case, I used a PL/SQL Function Body type, but any would work.
    I set the Source Used to Always, so that my user always started with the same default selection, but if you set it to "Only set when session value is null", that should do what you're asking for.
    Good luck (and thanks for the points by marking my answer helpful or correct),
    Stew

  • Validating  duplicate entries in form level

    Hi I want to validate records whether its duplicate here i am inserting to a table and want to check whether its existing in another table and if not i need to enter the data.I return the following code but its returning error.I already removed the duplicate rows but still getting same error.I need to validate the duplicate entries.If i enter any refno its showing following error.
    frm 40735 When Validate Item Trigger raised unhandled exception Ora -01422
    declare
         refno number(10);
    begin
         select ref_no into refno from      Emp_ref_arch;
         if refno = :EMP.REF_NO then
              message ('Duplicate Entry Pls enter again');
              else
              go_item(:EMP.Edet);
         end if;
    end;
    rgds
    jyothi
    Edited by: user11243021 on Aug 16, 2009 11:48 PM

    jyothi,
    If you are using select into statements to check whether the data exists or not, then you have to use cursor because, when there is no data, it will return error. And you didn't specified the where condition also.
    So try this.
    DECLARE
         Num_RefNo NUMBER(10);
         CURSOR Cur_Check IS SELECT REF_NO FROM EMP_REF_ARCH WHERE <your condition>;
    BEGIN
         OPEN Cur_Check;
         FETCH Cur_Check INTO Num_RefNo;
         CLOSE Cur_Check;
         IF NVL(Num_RefNo, 0) = :EMP.REF_NO THEN
              MESSAGE ('Duplicate Entry Pls enter again');
         ELSE
              GO_ITEM(:EMP.EDET);
         END IF;
    END;Regards,
    Manu.
    If this answer is helpful or correct, please mark it. Thanks.

  • Validating Duplicate Entries In itab

    Hi All
       How to approach for restricting duplicate entries in the Database?
    The scene is that I've to enter some data in a table control . and while saving, I've to check whether the same entry already exists in the database or not.
    How to approach for this? Awaiting your valuable response.
    Thanks in advance
    Pradipta

    Hai Mishra
    DELETE ADJACENT DUPLICATES FROM itab.
    Additions
    1. ... COMPARING f1 f2 ...
    2. ... COMPARING ALL FIELDS
    Effect
    Deletes neighboring, duplicate entries from the internal table itab . If there are n duplicate entries, the first entry is retained and the other n - 1 entries are deleted.
    Two lines are considered to be duplicated if their default keys match.
    The return code value is set as follows:
    SY-SUBRC = 0 At least one duplicate exists, at least one entry deleted.
    SY_SUBRC = 4 No duplicates exist, no entry deleted.
    Addition 1
    ... COMPARING f1 f2 ...
    Effect
    Two lines of the internal table itab are considered to be duplicates if the specified fields f1 , f2 , .... match.
    Addition 2
    ... COMPARING ALL FIELDS
    Effect
    Two lines are considered to be duplicates if all fields of the table entries match.
    Notes
    The DELETE ADJACENT DUPLICATES statement is especially useful if the internal table itab is sorted by fields (whether in ascending or descending order) which were compared during duplicate determination. In this case, the deletion of neighbouring duplicates is the same as the deletion of all duplicates.
    If a comparison criterion is only known at runtime, it can be specified dynamically as the content of a field name by using COMPARING ... (name) ... . If name is blank at runtime, the comparison criterion is ignored. If name contains an invalid component name, a runtime error occurs.
    Comparison criteria - statistically or dynamically specified - can be further restriced by specifying the offset and/or length.
    Note
    Performance
    Deleting a line from an internal table incurs index maintenance costs which depend on the index of the line to be deleted. The runtime depends on the line width of the table.
    For example, deleting a line in the middle of an internal table with 200 entries requires about 10 msn (standardized microseconds).
    Deleting a range of entries with " DELETE itab FROM idx1 TO idx2. " deleting a set of entries with " DELETE itab WHERE ... " only incur index maintenance costs once. Compared with a LOOP , which deletes line-by-line, this is much faster.
    To delete neighboring, duplicate entries from an internal table, use the variant " DELETE ADJACENT DUPLICATES FROM itab. " instead of LOOP constructions.
    Thanks & regards
    Sreeni

Maybe you are looking for