गतिशील स्ट्रिंग को 'सिंगल कोट्स' में संलग्न करना होगा
OPEN OUT_CUR FOR
'SELECT * FROM MYTABLE WHERE ID '|| DYN_QUERY;
EXECUTE IMMEDIATE
यदि आप BULK COLLECT
. का उपयोग करते हैं, तो बहु पंक्ति परिणाम की अनुमति देता है
उदाहरण:
DECLARE
TYPE myarray IS TABLE OF VARCHAR2(100);
v_array myarray;
BEGIN
EXECUTE IMMEDIATE 'select ''x'' from dual union all select ''y'' from dual'
BULK COLLECT INTO v_array;
--Or you could use the alternative quoting mechanism to avoid doubling quotation marks.
--EXECUTE IMMEDIATE q'[select 'x' from dual union all select 'y' from dual]'
-- BULK COLLECT INTO v_array;
FOR i IN 1..v_array.count
LOOP
DBMS_OUTPUT.PUT_LINE(v_array(i));
END LOOP;
END;
EXECUTE IMMEDIATE
बाइंड वैरिएबल . का उपयोग करना;
String := 'SELECT * FROM EMP WHERE name = :name AND age = :age AND :name <> ''Mahesh''';
EXECUTE IMMEDIATE String USING 'Mahi',21,'Mahi';
<OR>
EXECUTE IMMEDIATE String USING proc_variable1,proc_variable2,proc_variable1;