Unable to call the Procedure inside Trigger

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Learner2017
    New Member
    • Sep 2017
    • 1

    Unable to call the Procedure inside Trigger

    I'm just a beginner in PL/SQL. I'm trying to call the TESTPROC procedure inside my TRIGGER. Here is my code:

    CREATE TABLE FORTESTING
    (
    TestName VARCHAR(50) ,
    );

    CREATE OR REPLACE TRIGGER TESTTRIG
    BEFORE INSERT ON FORTESTING
    FOR EACH ROW
    BEGIN
    CALL TESTPROC();
    END;
    /

    CREATE OR REPLACE PROCEDURE TESTPROC (name VARCHAR2)
    AS
    v_name FORTESTING.Test Name%TYPE;

    BEGIN
    IF v_name := name THEN
    DBMS_OUTPUT.PUT _LINE('Test Name ' || name || ' EXIST' );
    END IF;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    DBMS_OUTPUT.PUT _LINE ('Test Name ' || name || ' NOT FOUND');
    END;
    /

    After checking the Trigger, i got the below error:
    Error(2,10): PLS-00103: Encountered the symbol "TESTPROC" when expecting one of the following: := . ( @ % ; The symbol ":=" was substituted for "TESTPROC" to continue.

    Can anyone tell me if my codes are correct and how to fix this error?

    Thank you.
Working...