sub __select_recordset{ my $loc_select = shift; #SQL SELECT clause my $loc_from = shift; #SQL FROM clause including join, if any my $loc_where = shift; #SQL WHERE clause my $loc_order = shift; #SQL ORDER BY clause my $loc_sth ; #Statement handle my $loc_sql_string; # Complete SQL string without ";" # # Removes leading and training whitespace from parameters. # if (__trim($loc_where) ne "" ){ $loc_sql_string = "select ".__trim($loc_select)." from ".__trim($loc_from)." where ".__trim($loc_where)." order by ".__trim($loc_order); } else { $loc_sql_string = "select ".__trim($loc_select)." from ".__trim($loc_from)." order by ".__trim($loc_order); } $loc_sth=$gl_dbh->prepare($loc_sql_string) or die "Can't prepare sql statement" . DBI->errstr; $loc_sth->execute() or die "Can't execute sql statement" . DBI->errstr; return $loc_sth; } #### sub select_record_set { my ($SQL_select_clause, #I just named the vars according to $SQL_from_clause, #your comment code $SQL_where_clause, #pick new names if you like $SQL_order_by_clause, #pick a name that renders #the #comment useless ) = @_; my $statement_handle = (); #not sure that you need these my $sql_string = (); #vars # I get lost here.... # prepare(), execute() # for that matter, if you are passing in an SQL statement, # why do you need the $SQL vars above? Prepare the statement and # then run it. }