If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > FORALL statement

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-10-03, 03:11
sama sama is offline
Registered User
 
Join Date: Sep 2003
Location: Zimbabwe
Posts: 2
FORALL statement

Suppose the following is my procedure:

PROCEDURE RETIRE_THEM_NOW IS
BULK_ERRORS EXCEPTION;
PRAGMA EXCEPTION_INIT(BULK_ERRORS,-24381);
TYPE employees_t IS TABLE OF EMPLOYEES%ROWTYPE
INDEX BY PLS_INTEGER;
retirees employees_t;

BEGIN
FOR rec IN(SELECT *
FROM EMPLOYEES
WHERE HIRE_DATE < ADD_MONTHS(SYSDATE, -1 * 8 * 40))
LOOP
retirees(SQL%ROWCOUNT) := rec;
END LOOP;

FORALL indx IN retirees.FIRST .. retirees.LAST
SAVE EXCEPTIONS
INSERT INTO EMPLOYEES
VALUES retirees(indx);

EXCEPTION
WHEN BULK_ERRORS THEN
FOR J IN 1 .. SQL%BULK_EXCEPTIONS.COUNT
LOOP
DBMS_OUTPUT.PUT_LINE('Error from element #'||
TO_CHAR(SQL%BULK_EXCEPTIONS(J).ERROR_INDEX)|| ': ' ||
SQLERRM(SQL%BULK_EXCEPTIONS(J).ERROR_CODE));
END LOOP;
END;

However when I try to execute this procedure I get the error:

ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error
ORA-06512: at "HR.RETIRE_THEM_NOW", line 16
ORA-06512: at line 1


Can anyone help on where I am getting it wrong?
Reply With Quote
  #2 (permalink)  
Old 09-10-03, 10:50
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
Exclamation

From the PL/SQL Manual: http://download-west.oracle.com/docs...olls.htm#28178


input collections of composite values cannot be decomposed and bound to database columns.




__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On