Andrei Maieras
Andrei Maieras

Reputation: 706

PL-SQL Bulk Collect after execute immediate statement

I'm trying to execute bellow statement but I think the sintax is not right. Is it possible to use bulk collect after execute immediate??

EXECUTE IMMEDIATE
        'select unique cvc.object_id ' ||
        'from ems.ibo_sm_cvc_rfs cvc,' || 
        'ems.ibo_alcatel_mse_locale poi,' ||
        'ems.ibo_nbn_csa csa,' ||
        'ems.ibo_sm_ean_service_sites_rfs sites,' ||
        'EMS.ibo_sm_ean_service_site_rfs site ' ||
        'where poi.object_name = :1' 
         USING pis_poi_for_cleanup
         BULK COLLECT INTO pona_identified_cvcs;

The error I'm getting is generic:

Encountered the symbol "BULK" when expecting one of the following: ...

Upvotes: 1

Views: 949

Answers (1)

Leonardo Heis
Leonardo Heis

Reputation: 109

Rewriting the original answer, move the USING clause after the BULK COLLECT statement:

BEGIN
   EXECUTE IMMEDIATE 'select unique cvc.object_id ' ||
        'from ems.ibo_sm_cvc_rfs cvc,' || 
        'ems.ibo_alcatel_mse_locale poi,' ||
        'ems.ibo_nbn_csa csa,' ||
        'ems.ibo_sm_ean_service_sites_rfs sites,' ||
        'EMS.ibo_sm_ean_service_site_rfs site ' ||
        'where poi.object_name = :1'
        BULK COLLECT INTO pona_identified_cvcs
        USING pis_poi_for_cleanup;
END;
/

You could extend this code reviewing this link.

Hope this help!!!

Upvotes: 3

Related Questions