title: perl execute sql file (DBI oracle)
body: <p>I have the following problem, i have a SQL file to execute with DBI CPAN module Perl
  I saw two solution on this website to solve my problem.</p>
  
  <ol>
  <li><p><a href="https://stackoverflow.com/questions/4217306/execute-sql-file-in-perl">Read SQL file line by line</a></p></li>
  <li><p><a href="https://stackoverflow.com/questions/6714170/how-to-pass-in-sql-query-input-file-to-a-perl-dbi-sub-routine">Read SQL file in one instruction</a></p></li>
  </ol>
  
  <p>So, which one is better, and what the real difference between each solution ?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>It's for a library. I need to retrieve output <strong>and</strong> the return code. </p>
  
  <p>Kind of files passed might be as following:</p>
  
  <pre><code>    set serveroutput on;
      set pagesize 20000;
      spool "&amp;1."
      DECLARE
          -- Récupération des arguments
          -- &amp;2: FLX_REF, &amp;3: SVR_ID, &amp;4: ACQ_STT, &amp;5: ACQ_LOG, &amp;6: FLX_COD_DOC, &amp;7: ACQ_NEL, &amp;8: ACQ_TYP    
          VAR_FLX_REF VARCHAR2(100):=&amp;2;
          VAR_SVR_ID NUMBER(10):=&amp;3;
          VAR_ACQ_STT NUMBER(4):=&amp;4;
          VAR_ACQ_LOG VARCHAR2(255):=&amp;5;
          VAR_FLX_COD_DOC VARCHAR2(30):=&amp;6;
          VAR_ACQ_NEL NUMBER(10):=&amp;7;
          VAR_ACQ_TYP NUMBER:=&amp;8;
      BEGIN
          INSERT INTO ACQUISITION_CFT 
              (ACQ_ID, FLX_REF, SVR_ID, ACQ_DATE, ACQ_STT, ACQ_LOG, FLX_COD_DOC, ACQ_NEL, ACQ_TYP) 
          VALUES 
              (TRACKING.SEQ_ACQUISITION_CFT.NEXTVAL, ''VAR_FLX_REF'', 
                  ''VAR_SVR_ID'', sysdate, VAR_ACQ_STT, ''VAR_ACQ_LOG'',
                  ''VAR_FLX_COD_DOC'', VAR_ACQ_NEL, VAR_ACQ_TYP);
      END;
  
      /
      exit;
  </code></pre>
  
  <p>I have another question to ask, again with DBI Oracle module.
  May i use the same code for SQL file and for Control file ? </p>
  
  <p>(Example of SQL Control file)</p>
  
  <pre><code>    LOAD DATA
      APPEND INTO TABLE DOSSIER
      FIELDS TERMINATED BY ';'
      (
      DSR_IDT,
      DSR_CNL,
      DSR_PRQ,
      DSR_CEN,
      DSR_FEN,
      DSR_AN1,
      DSR_AN2,
      DSR_AN3,
      DSR_AN4,
      DSR_AN5,
      DSR_AN6,
      DSR_PI1,
      DSR_PI2,
      DSR_PI3,
      DSR_PI4,
      DSR_NP1,
      DSR_NP2,
      DSR_NP3,
      DSR_NP4,
      DSR_NFL,
      DSR_NPG,
      DSR_LTP,
      DSR_FLF,
      DSR_CLR,
      DSR_MIM,
      DSR_TIM,
      DSR_NDC,
      DSR_EMS NULLIF DSR_EMS=BLANKS "sysdate",
      JOB_IDT,
      DSR_STT,
      DSR_DAQ "CASE WHEN :DSR_DAQ IS NOT NULL THEN SYSDATE ELSE NULL END"
  
      )
  </code></pre>