but i'm getting few errors.

There is an error in the sql CREATE table statement in your OP, a trailing comma.
Try something like this

#!perl use strict; use warnings; # configuration my $sqlplus = 'sqlplus';#'D:/oracle/product/11.2.0/client_1/BIN/sqlplu +s.exe'; my $dir = 'C:/Users/namburuk/Desktop/CostSettlement_DBScripts/'; my $sqlfile = 'MI_SCR_0001_FS_sample.sql'; my $logon = 'user/password@ServiceName'; #open IN,'<',$dir.$sqlfile or die "$!"; my $sql = join '',<DATA> ; # use IN #close IN; # add exit to sql to return from command line open OUT,'>','~temp.sql' or die "$!"; print OUT $sql."\nexit;\n"; close OUT; # run sqlplus.exe in silent mode system($sqlplus,'-S',$logon,'@~temp.sql') == 0 or die "Couldn't launch $sqlplus: $!"; __DATA__ SELECT CURRENT_TIMESTAMP FROM DUAL; CREATE TABLE TRN_SAAA ( TRN_ST NUMBER (30) NOT NULL, TRN_SE NUMBER (30) NOT NULL, CHKD VARCHAR2 (1) DEFAULT 'N' NOT NULL ); INSERT INTO TRN_SAAA VALUES (1,1,'A'); INSERT INTO TRN_SAAA VALUES (2,1,'B'); INSERT INTO TRN_SAAA VALUES (3,1,'C'); SELECT * FROM TRN_SAAA;
poj

In reply to Re^3: Run SQL script which contains multiple line statements by poj
in thread Run SQL script which contains multiple line statements by karthik.raju

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.