Advertisement

08.27.2007 at 04:22PM PDT, ID: 22790389
[x]
Attachment Details

PL SQL trigger

Asked by jaxrpc in Oracle 10.x, PL / SQL

Tags: trigger, sql

Hi, i have created a trigger that check for a value if it has duplicate values...it should abort a the operation that caused the tirigger. but it dont seem to work.

CREATE TRIGGER tg_pbasketInsert
    BEFORE INSERT ON pbasket
    FOR EACH ROW
   
    DECLARE
   
    cnt number;

    BEGIN
       
       SELECT count(ccard) into cnt from pbasket where ccard = :new.ccard;
      
       if cnt > 0 then
        RAISE_APPLICATION_ERROR(-10000, 'Credit Card already in use!');
       end if;

      EXCEPTION
      WHEN OTHERS THEN
            DBMS_OUTPUT.PUT_LINE(SQLERRM);
    END tg_pbasketInsert;
.
run;Start Free Trial
[+][-]08.27.2007 at 06:42PM PDT, ID: 19779815

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.27.2007 at 07:05PM PDT, ID: 19779904

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.27.2007 at 11:47PM PDT, ID: 19780793

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.28.2007 at 06:14AM PDT, ID: 19782612

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Oracle 10.x, PL / SQL
Tags: trigger, sql
Sign Up Now!
Solution Provided By: joebednarz
Participating Experts: 5
Solution Grade: B
 
 
[+][-]08.28.2007 at 06:51AM PDT, ID: 19782951

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_1_20070628