hi i am a new user of perl. i have two sql queries written with perl script.the problem is when i run the script i need the queries to be linked and then run.but this is not happening.can you tell me what is wrong here.here is the query and perl sript in between it.
# Query the database for a list of accounts, contracts and products that are of interest.
# Where "of interest" is defined as may have terminated a required product in the last
# 2 months.
my $sqlcmd="select cmf.account_no, cc.contract_type,to_char(cc.start_dt,'mon dd YYYY HH:MM:ss')start_dt, ciem.external_id, emf_p.element_id,to_char(emf_p.product_inactive_dt,'mon dd YYYY HH:MM:ss')product_inactive_dt
from CMF cmf, CUSTOMER_CONTRACT cc, SERVICE emf, SERVICE emf_c, PRODUCT emf_p, CUSTOMER_ID_EQUIP_MAP ciem ,product_charge_map pcm
where cmf.account_no = emf_c.parent_account_no
and ((cmf.account_no = cc.parent_account_no and cc.contract_level = 1)
or (emf_c.subscr_no = cc.parent_subscr_no and emf_c.subscr_no_resets = cc.parent_subscr_no_resets and cc.contract_level = 3))";
# Add list of interesting contracts.
$sqlcmd ="$sqlcmd and (";
$i = 0;
foreach $contract_key (sort(keys(%contracts)))
{
$sqlcmd="$sqlcmd cc.contract_type = $contract_key";
$i++;
if ($i < $contract_count)
{
$sqlcmd=" $sqlcmd or ";
}
}
$sqlcmd="$sqlcmd )";
$sqlcmd =" $sqlcmd and (cc.end_dt is NULL or cc.end_dt >= emf_p.product_inactive_dt)
and cmf.account_no = emf.parent_account_no
and emf.subscr_no = emf_c.subscr_no
and emf.subscr_no = ciem.subscr_no
and emf.subscr_no_resets = ciem.subscr_no_resets
and ciem.external_id_type = 1
and emf.subscr_no = emf_p.parent_subscr_no
and emf.subscr_no_resets = emf_p.parent_subscr_no_resets
and emf_p.tracking_id =pcm.tracking_id
and emf_p.tracking_id_serv=pcm.tracking_id_serv
and emf_p.parent_account_no=pcm.parent_account_no
and PCM.inactive_dt is not NULL
and PCM.billed_thru_dt is not NULL
and emf_p.product_inactive_dt <= to_date('$now','mm/dd/yyyy')
and emf_p.product_inactive_dt > to_date('$one_month','mm/dd/yyyy')";
please help with this.
thanks in advance.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.