RE: PL/SQL - FORALL statement

"David, Romeo B. (Govt)" <[email protected]> Thu, 16 Jan 2003 08:46:26 -0500
Newsgroups gmane.comp.db.oracle.devel
Message-ID <LYRIS-1796914-835363-2003.01.16-13.47.30--gcdod-oracle#[email protected]>
I think you are using the FORALL statement the wrong way. These are the
rules in using FORALL:
1. The body of the FORALL statement must be a single DML statement - such as
INSERT,UPDATE, or
   DELETE.
2. The DML statement must reference collection elements, indexed by the
index-row variable (your v_Count) in the FORALL statement. The scope of the
index-variable is the FORALL statement only; you may not reference it
outside  of that statement. 
3. Do not declare a variable for index-row (v_Count). It is declare
implicitly as PLS_INTEGER by  the PL/SQL engine.
4. The lower and upper bounds must specify a valid range of consecutive
index numbers for the collection(s) referenced in the SQL statement.
5. The collection subscript referenced in the DML statement cannot be an
expression. For example, v_count+10. 

Why don't you post your whole code and we can see what is the best way to do
it.

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, January 14, 2003 7:23 PM
To: Oracle
Subject: [oracle] PL/SQL - FORALL statement


Hi All!
 
I am trying to send all my dynamic sqls for execution in SQL engine from 
my PLSQL stored procedure but get error "PLS-00103: Encountered the 
symbol "EXECUTE" when expecting one of the following:
 
   . ( * @ % & - + / at mod rem select update <an exponent (**)>
   delete insert ||" 
 
the code I use in the stored proc is as:
 
FORALL v_Count IN pDPSQL.first..pDPSQL.last

EXECUTE IMMEDIATE pDPSQL(v_Count);

 

Please help or suggest a better way of sending all sqls in one block to 
sql engine for execution.

Thank you.

Regards,

 

Sam R
---
Change your mail options at http://p2p.wrox.com/manager.asp or 
to unsubscribe send a blank email to %%email.unsub%%.


---
Change your mail options at http://p2p.wrox.com/manager.asp or 
to unsubscribe send a blank email to [email protected].