Results 1 to 5 of 5

Thread: oracle

  1. #1
    Join Date
    Feb 2009
    Posts
    36

    Question Unanswered: oracle

    hii
    can anyone tell me,how to create a trigger that check all records present in a particular table and allow saving the data only when the record(identified by a primary key) does not exist and if the record exist then show a message-record already exist,cnt save.
    Last edited by ANGEL_G; 02-20-09 at 06:35.

  2. #2
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    Why do you need a trigger for that. If you have a primary key, Oracle won't allow you to create another row with the same key anyway.

    A trigger will never "show a a message", it is a server-side thing. Where should this message be displayed?

    And please use a more descriptive subject when posting. The subject "Oracle" for a forum regarding Oracle hardly makes sense

  3. #3
    Join Date
    Feb 2009
    Posts
    36

    Pl/sql

    Thnks For Replying
    Actually The Problem Is::::: Id Is Actually A Forigen Key In One Of My Table.it Is Accepting Mutilple Entries Of A Single Id,which I Dnt Want..for Example Id Is 'tro1',it Is Making Mutliple Entries In The Table Each Time When I Press Save Button.
    But I Want To Do Only One Entry For 'tro1',the Next Time Is Try To Make Same Attempt,it Should Show A Message U Cnt Insert The Record As It Exist Already.

  4. #4
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    I thougth a long time whether I should answer this or not.
    But I finally decided if I don't, you wouldn't know why.

    Please try to write a bit more clearly, using line breaks and proper upper/lowercase and do not abbreviate words.
    For people who do not speak English as a native language this "IM Talk" is hardly understandable

    Writing with correct capitialization is simply a matter of courtesy, especially because you are asking volunteers to help you for free.

    The above paragraphs in your way of writing would look like this:

    I Thought A Long Time.. Whether I Shud Ans This Or Not.... But ::: I Finally Decided,If I Dont U Won't Know Why.... Pls:::::: Try To Wrt A Bit More Clrly Using Line And Breaks Proper Upper/LowerCase... And Do Not abbrv Wrds... 4 Ppl Who Do No Speak English As A Native Lng This IM Talk Is Hardly Understable... Writing With Correct Capitalization Is Smpl A Matter Of Courtesy... ::: Esp Bicos.. U R Asking Volunteers For Free Hlp... The abv Parars.. In UR Way Of Wrtng... Wud Luk Like This
    Now judge for yourself which of the two versions is easier to read and understand.

    It took me a substantial amount of time to understand your "gibberish".

    Now to your question:

    As far as I can read from your scrambled text, putting a unique index on the column ID should solve your problem.

  5. #5
    Join Date
    Feb 2009
    Posts
    36
    Thanks For Your Kind Reply.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •