Skip to Main Content

Breadcrumb

Question and Answer

Chris Saxon

Thanks for the question, Gulshan.

Asked: October 28, 2016 - 10:56 am UTC

Last updated: October 28, 2016 - 3:07 pm UTC

Version: 11

Viewed 1000+ times

You Asked


I have made stored procedure and executing through trigger.So my requirements is like that if we create a new issue first statement should execute and if we return the same issue number then 2 nd statement should execute.
I have make like this but in if statement is giving wrong.









NNAME VARCHAR2(50);

subj VARCHAR2(200);
bdy varchar2(2000);
mailto VARCHAR2(200);
err_level number;
BEGIN

SELECT NICKNAME INTO NNAME FROM AXUSERS WHERE USERNAME=:NEW.USERNAME;
select email INTO mailto from axusers where username=:new.assign_tousr;
if (:new.issue_no) then
PRO_EMAILFORMAT ('New Issue Creation','<ISSNO>= '||:new.issue_no || ',' || '<ISSUEDESC>= '||:new.issue_desc || ' , '||'<USERNICKNAME>= '|| nname || ' , ' || '<ISSSTATUS>= '||:NEW.ISSUE_STATUS || ' , ' ||'<ASSIGNTO>= '||:NEW.ASSIGN_TO,'E',mailto, NULL);
else
PRO_EMAILFORMAT ('Issue Return','<ISSNO>= '||:old.issue_no || ',' || '<NICKNAME>= '|| nname || ' , '||'<ASSIGNTO>= '||:NEW.ASSIGN_TO || ' , ' || '<RETURNREMARKS>= '||:new.return_remarks,'E',mailto, NULL);
end if;


end;


and Chris said...

Are you attempting to send an email in a trigger?

If so, make sure you do it by submitting a job!

https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:7267435205059

Beyond that I don't really understand what you're trying to do. But:

if (:new.issue_no) then


Is invalid syntax. You need to compare :new.issue_no to something.

Is this answer out of date? If it is, please let us know via a Comment

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library