Using a select in the select list of a FOR loop
This is what i am trying :
abc is a list of values
FORALL i in abc.First..abc.last
INSERT INTO table1 (SELECT a.1,b.1,b.2-(SELECT NVL(SUM(x.1) FROM x WHERE ...),c.1
If i execute the SQL part alone , it works.. But in a package , gives
compile errors.. "PLS-00103 : Encountered the symbol "SELECT" ...."
What version of oracle u are using?
Probably u have to use dynamic sql for execute ur insert statment.
we use 8i.
Could you please elaborate if possible?
The select in the select list list uses values from the select list for joining and not the value in the FORALL list!
Thanx for the reply..
well that scalar subquery probabky is not supported in PL/SQL until 9i, in 8i they use seperate engines for SQL and PL/SQL so things that works in SQL doesnt mean they would work in PL/SQL and the way to achieve your goal is use dynamic SQL ad shestakov suggested
Click Here to Expand Forum to Full Width