Yes, but you can do that with the File::Slurp as well (untested)
my $myClient = 97; my $deliverymethod = 'USPS'; my $sql = read_file("$ref->{config}->{SQLDIR}/USPS.sql"); &getOrders($ref,$sql,$myClient,$deliverymethod); sub getOrders { my $ref = shift(@_); my $sql = shift(@_); my $myClient = shift(@_); my $deliverymethod = shift(@_); my $query = $dbh->prepare($sql); push(@ARRAY,$deliverymethod); # have to put this var in array twice # because we reference it twice push(@ARRAY,$myClient); push(@ARRAY,$myClient); $query->execute(@ARRAY); return; }
Where USPS.sql is
select ORDER_ID, BATCH_ID, FIRST_NAME, LAST_NAME, TITLE, ADDRESS1, ADDRESS2, CITY, STATE, POSTAL_CODE, PHONE, EMAIL_ADDRESS, STORE_NUMBER, DELIVERY_METHOD, DELIVERY_ERROR, REWARD_VALUE, CRM_REFERENCE, ASSIGNED_CARD_ID, CARD_ACTIVE_DATE, CARD_EXPIRED_DATE, REQUEST, ORDER_DATE, ITEM_CODE, CONVERT_ELIGIBLE, PROCESS_BATCH_ID, RESPONSE, PASSPHRASE, CONVERSION_SERIAL from INTEGRATION.OL_ORDER WHERE JET_CLIENT_ID = ? AND BATCH_ID = (SELECT * FROM (SELECT BATCH_ID FROM INTEGRATION.OL_ORDER WHERE JET_CLIENT_ID = ? AND DELIVERY_METHOD = ? GROUP BY BATCH_ID ORDER BY BATCH_ID DESC NULLS LAST) WHERE ROWNUM <= 1)

In reply to Re^2: SQL in files or File::Slurp? by crusty_collins
in thread SQL in files or File::Slurp? by crusty_collins

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.