As you're creating a new statement handle, I wouldn't think it would be a problem. (that's not to say that there aren't any database that won't have a problem, but in the general sense of it, having multiple selects shouldn't be a problem). (trying to hold open a select cursor too long could be a problem if you're trying to ensure read consistency in your transaction, especially if you're performing a lot of writes in that same transaction)

I would make sure that I explicitly cleaned up after myself, though:

$sth->finish()

(yes, I know that Perl's garbage collection should take care of it when it goes out of scope, I'm just paranoid)

Also, if you're using Oracle, there's built in heirarchy handling, via CONNECT BY. It's possible that other databases might have ways of handling it, as well.


In reply to Re: Recursive dbh executions by jhourcle
in thread Recursive dbh executions by Sid

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.