execute immediate
vpolasaDec 5 2007 — edited Dec 6 2007I'm trying to add/subtract two numbers with the help of an operand which I pass it dynamically. This is the errror I got while trying to execute..
ORA-00923: FROM keyword not found where expected
DECLARE
sortOrd_in NUMBER;
v_operand VARCHAR2(1);
v_result NUMBER;
stmt VARCHAR2(4000);
BEGIN
sortOrd_in := 3;
v_operand := '+';
stmt := ('SELECT '||sortOrd_in||':1'||24||' FROM DUAL');
EXECUTE IMMEDIATE stmt INTO v_result USING v_operand;
dbms_output.put_line (v_result);
END;
I guess the error is in the stmt. But I'm unable to figure it out the exact syntax. What would be the correct syntax. Thanks and Regards.