how to solve this errors

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sandip sen majumder
    New Member
    • Jul 2010
    • 7

    how to solve this errors

    Code:
    CREATE OR REPLACE TRIGGER TEMP_CUST
           AFTER INSERT ON TEMP_CUSTOMER REFERENCING
           NEW AS NEW OLD AS OLD FOR EACH ROW
    DECLARE
        v_count               NUMBER(5)  := 0;
        v_cust_id             NUMBER(10) := 0;
    BEGIN
        SELECT COUNT(*) INTO v_count FROM vfone.MOBILE WHERE MOBILE.mobile_no = :new.mobile_no;
        -- When Mobile No is NOT found in Mobile Table means New Customer
    
        IF v_count = 0 THEN
           SELECT MAX(NVL(CUSTOMER_ID,0) + 1) INTO v_cust_id FROM crimes.MOBILE where mobile.mobile_no= :new.mobile_no;
        -- CUSTOMER_ID, SP_CUST_ID, PLAN, NAME, ADDRESS_1, ADDRESS_2, CITY, PIN, CUST_DATE
           INSERT INTO crimes.CUSTOMER
                  VALUES(v_cust_id, :NEW.sp_cust_id, :NEW.PLAN, :NEW.NAME, :NEW.address_1,:NEW.address_2, :NEW.city, :NEW.pin, :NEW.cust_date, :NEW.mobile_no);
           INSERT INTO crimes.MOBILE VALUES (:NEW.mobile_no, NVL(v_cust_id,0), '');
        END IF;
    
        IF v_count > 0 THEN        -- Update Customer Data into Customer Table
           UPDATE crimes.CUSTOMER SET
              SP_CUST_ID = :NEW.sp_cust_id,
              PLAN = :NEW.PLAN,
              NAME = :NEW.NAME,
              ADDRESS_1 = :NEW.address_1,
              ADDRESS_2 = :NEW.address_2,
              CITY = :NEW.city,
              PIN = :NEW.pin,
              CUST_DATE = :NEW.cust_date
              where crimes.CUSTOMER.customer_id = :new.customer_id;
        END IF;
    END;
    /
    and the errors is
    Code:
    SQL> show errors;
    Errors for TRIGGER TEMP_CUST:
    
    LINE/COL ERROR
    -------- ------------------------------------------------
    5/77     PLS-00049: bad bind variable 'NEW.MOBILE_NO'
    9/107    PLS-00049: bad bind variable 'NEW.MOBILE_NO'
    14/41    PLS-00049: bad bind variable 'NEW.MOBILE_NO'
    can any one correct this problem.
    Last edited by debasisdas; Aug 4 '10, 08:20 AM. Reason: Formatted using code tags.
  • amitpatel66
    Recognized Expert Top Contributor
    • Mar 2007
    • 2358

    #2
    Can you describe your mobile table. I think the column name mobile_no is incorrect.

    Comment

    • sandip sen majumder
      New Member
      • Jul 2010
      • 7

      #3
      ya thanks...
      i have solve it after i posted it to this site.In my temp_customer table there the mobile_no column was missing.
      so i altered that table and it started working.
      anz thanks for ur kind reply sandip

      Comment

      Working...