I think I understand this a lot better now, thank you.
I have one more related quick question.
In my first statement the where on SSN has a % sign on it, because the user only enters the last 4 digits, how do I do this with placeholders?
The original line was:
and SSN like '%$ssn'
Here is my new SQL with placeholders:
my $sql = <<"END"
SELECT
SSN, RTRIM(LAST_NAME,' '),
TO_CHAR(BIRTH_DATE,'YYYY'),
STORE
FROM
PYHADMIN.PY_EMP_SHADOW
where
TO_CHAR(BIRTH_DATE,'YYYY') like ?
and SSN like ?
and RTRIM(LAST_NAME,' ') like upper(?)
and rownum <= 1
END
;
my $yi = $dbh->prepare($sql);
$yi->execute($year, $ssn, $name);
#--------Send the values from the query into variables
($SSNc, $LAST_NAMEc, $YEARc, $storenum) = $yi->fetchrow_array;
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.