This annonymous block is called from a shell script with the simple line of sqlplus user/id@database @test.sql
I am running both perl and sql code on the same server.
I've also found some info on the web and metalink that indicates OCI calls (which dbd::oracle wraps) does have a performance problem in 8i but no info on 9i - maybe this is an OCI issue. running out of clues...
Ah. This makes things a lot clearer. Basically Roy is right.
With your PL/SQL code you are shipping everything to the Oracle server. Oracle runs all the inserts. Finished.
With your perl code you're sending a single insert to the Oracle server. Oracle is doing the insert and telling your Perl program is succeeded. 1500 times. The extra communication overhead with each execute will almost certainly be what is slowing you down.
If the speed of multiple inserts is going to be an issue for your application it will probably be simplest to slap a lump of PL/SQL into a $dbh->do and let Oracle do it server side.