as for your first question, There is a third method, besides using count(*) and sth->rows, and that is, write a PL/SQL function (return type varchar2) in Oracle,by passing it the primary key of the row to check for.if the row is not present, insert the row, or else return back the appropriate message like "row already exists". The advantage of this is that the code will be precompiled and on the database tier, will run faster, and can be called from more than one perl script, thus improving code reuse)...

as for your second problem, i've found that dbh->quote does work nicely to remove all the unwanted characters from the SQL i want to execute (thanks to blakem who pointed this out to me); instead of calling the filter sub for each variable, just form the SQL first and then write :
$dbh->quote($sql)

In reply to Re: DBI conditional insert (and things of those nature) by screamingeagle
in thread DBI conditional insert (and things of those nature) by data67

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.