perl script processing error

open(IN,"input_file") or die "Can't open Input file.\n";

while (<IN>) {
    
    chomp;
    $line = $_;
    if($line != '') {
        
        print "\nprocessing $line\n";

        $size = 0;
        $hrid = $line;
        @project_id_array = null;
        $size = @project_id_array;
        
        $query1 = $dbh->prepare("select project_tb.project_id from project_tb JOIN 
        project_event_tb ON project_tb.project_id=project_event_tb.project_id 
        where ((project_tb.created_by = ? or PROJECT_EVENT_TB.owner_id = ? ) 
        and project_tb.PROJ_STATUS not in ('Complete','Cancelled'))");
        $query1->execute($hrid,$hrid);

        while ( ($project_id) = $query1->fetchrow_array() ) 
         {
         push @project_id_array, $project_id;
         }
        
        $size = @project_id_array - 1;
        print "$size \n";
        if($size == 0)
            {
            print "This user $hrid doesn't have any project with 'Open' status. Need to check more...\n";
            }

i am getting this error

Started assign users process: Mon Dec 27 06:57:18 EST 2010

==== CONNECTED TO  AS USER  ====
Connected to Database  as user : Mon Dec 27 06:57:19 EST 2010

processing 7770030
DBD::Oracle::st execute failed: ORA-01008: not all variables bound (DBD ERROR: OCIStmtExecute) [for Statement "select project_tb.project_id from project_tb JOIN
                project_event_tb ON project_tb.project_id=project_event_tb.project_id
                where ((project_tb.created_by = ? or PROJECT_EVENT_TB.owner_id = ? )
                and project_tb.PROJ_STATUS not in ('Complete','Cancelled'))" with ParamValues: :p1=7770030, :p2=7770030] at projnew.pl line 42, <IN> line 1.

I guess nobody volunteered to find the ? and stick in $hrid, so why don't you do it in the first place.

I found the wiki -- no quotes in the wiki: Perl - Oracle FAQ

can u tell me clearly what you are trying to say. i was not clear with ur statement.. please can u make it clear.

  1. If the parameters are not dynamic, or dynamic does not do anything profitable, just format them into the query with string concatenation.
  2. Look at your query and look at the wiki query -- you have " and they do not.