title: to Create a bat file to run a query
body: <p>I need to create a bat file which include a query to run a package.
  I use plsql developer to develop the package. its username,password and database is user,pswd,db1 respectively.
  The query to run the package is:</p>
  
  <pre><code>SELECT        
     COLUMN1 AS "LAST NAME",
     COLUMN2 AS "FIRST NAME",
     COLUMN3 AS "LOCATION"       
  FROM TABLE(PKG.GET_SUM('09-NOV-2010','12-NOV-2010'))
  </code></pre>
  
  <p>can anyone help me what code shud I write to create a bat file</p>
  
  <p>Thanks in advance</p>
  
  <p>This is my code </p>
  
  <pre><code>connect usr/pswd@db1 
  SET NEWPAGE 0 
  SET SPACE 0 
  SET LINESIZE 80 
  SET PAGESIZE 100 
  COLUMN COLUMN1 HEADING 'LAST NAME' 
  COLUMN COLUMN2 HEADING 'FIRST NAME' 
  COLUMN COLUMN3 HEADING 'LOCATION' 
  spool c:\temp\get_sums.csv 
  SELECT COLUMN1 
      ,COLUMN2 
      ,COLUMN3 
      ,COLUMN4 
      ,COLUMN5 
      , COLUMN6 
      ,COLUMN7,
      COLUMN8 
      ,COLUMN9 
  FROM TABLE(ACTY_SUMM('09-NOV-2010','12-NOV-2010')) 
  / 
  spool off 
  exit;
  </code></pre>
  
  <p>I changed the line size and pagesize. But not able to get the desirable format. I have 12 columns.  I need it in a report format.</p>
  
  <p>Hi I tried to change the Linesize,but still I am not getting the desired format. I want the report in the following format</p>
  
  <pre><code>FirstNAME LASTNAME LOCATION  A  B  C  D  E  F  G  H  I
  NAME1     LNAME1    LOC1     A1 B1 C1 D1 E1 F1 G1 H1 I1
  NAME2     LNAME2    LOC1     A2 B2 C2 D2 E2 F2 G2 H2 I2
                      LOCTOT   
  NAME3     LNAME3    LOC2     A3 B3 C3 D3 E3 F3 G3 H3 I3
                      LOCTOT
  </code></pre>
  
  <p>I need all the column in one row and their corresponding values of each person under each column and after each location there will be location total and at the end there will be grant total. I tried with the linesize,page size and all. still no result. Can anyone help me to get the report in this format</p>
  
  <p>Hi</p>
  
  <p>As of now client is ok with the csv format. But the challenge is I am not getting the heading. This is my code in sql script.</p>
  
  <pre><code>connect usr/pwd@db1
  SET NEWPAGE 0
  SET LINESIZE 100
  SET PAGESIZE 0
  spool c:\temp\q1.csv
  
  COLUMN COLUMN1 HEADING 'LAST NAME'
  COLUMN COLUMN2 HEADING 'FIRST NAME'
  COLUMN COLUMN3 HEADING 'LOCATION'
  COLUMN COLUMN4 HEADING 'A'
  COLUMN COLUMN5 HEADING 'B'
  COLUMN COLUMN6 HEADING 'C'
  COLUMN COLUMN7 HEADING 'D'
  COLUMN COLUMN8 HEADING 'E'
  COLUMN COLUMN9 HEADING 'F'
  COLUMN COLUMN10 HEADING 'G'
  COLUMN COLUMN11 HEADING 'H'
  COLUMN COLUMN12 HEADING 'I'
  SELECT 
      '"'||COLUMN1
      ||'","'|| COLUMN2 
      ||'","'|| COLUMN3 
      ||'","'|| COLUMN4 
      ||'","'|| COLUMN5 
      ||'","'|| COLUMN6 
      ||'","'|| COLUMN7
      ||'","'|| COLUMN8 
      ||'","'|| COLUMN9 
      ||'","'|| COLUMN10
      ||'","'|| COLUMN11
     ||'","'|| COLUMN12||'"'
  FROM
  TABLE(ACTY_SUM('09-NOV-2010','12-NOV-2010')) 
  / 
  
  spool off
  exit;
  </code></pre>
  
  <p>Can you please suggest on this issue</p>