> > Hello, > > I hope I am addressing this question to a correct email. > > I am trying to make multiple prepare statements on one > database connection, however I am getting errors. I would > just like to know if this is possible. The logic goes something like: > > my $DBH = DBI->connect(); > my $sth = $DBH->prepare( SELECT ...); > my $rv = $sth->execute(); > > my $sth2 = $DBH->prepare( SELECT ...); > my $rv2 = $sth2->execute();
You probably need to provide more input as to which database you are using and which specific error message you get. Given what you've provided the answer is yes and no. Yes, I do exactly that all the time with Oracle (and DBD::Oracle). Yes, you can do that with, say, SQL*Server, but it will complain if you haven't completely retrieved all the results from $sth before you use $sth2. [See the archives and FAQ for this list for workarounds, etc on "Multiple statements" or something similar if this is your situation.] Regards, Jeff