I created a variable className and I assigned values to it. I have another procedure in oracle that sends emails to me. How do I pass this value into header and body of my email?
VARIABLE className varchar2(30)
:classname := 0;
BEGIN
FOR i IN
(
SELECT CLASS_INSTANCE_COUNT , CLASS_NAME
FROM MODEL_CLASS_COUNTS
WHERE TRUNC(COUNT_DATETIME) = TRUNC(SYSDATE)
)
LOOP
IF i.CLASS_INSTANCE_COUNT = 0
THEN
:className := i.CLASS_NAME;
EMAIL('[email protected]', 'email header: &className is 0', 'body: count for &className is 0');
END IF;
END LOOP;
END;
/
:classnameand a SQLPlus substitution variable&className. Is there a reason that you're using either rather than using local PL/SQL variables in your anonymous PL/SQL block (assuming you even want to bother with a local variable)? Do you want SQL*Plus to prompt the user for a value (in which case you'd want the substitution variable)? Or do you just want the value to come from the loop?