If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Perl and the DBI > Getting ORA-01722 error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-27-07, 14:42
ssmith001 ssmith001 is offline
Registered User
 
Join Date: Sep 2005
Posts: 220
Getting ORA-01722 error

I get this error when I try to run this subroutine and I can't figure out why or how to fix it:

Code:
sub GetRowsOverThreshold
{	
	# This subroutine will check the SKU table to see if there are any rows that 
	# exceed the allowable threshold and have been flagged with DELETEME 

	my $threshold = shift;
																				
	my $sth = $global_dbh->prepare("SELECT /*+ index (s, sku2) */                             				 
	                                l.P_PLANNERCODE
                                , s.loc
                                , COUNT(*)
                             FROM stsc.SKU s, stsc.LOC l 
                            WHERE s.p_deleteme = 'DELETEME'
                              AND s.LOC = l.LOC
                            GROUP BY l.P_PLANNERCODE, s.LOC HAVING COUNT(*) >= ?") or die "Unable to prepare statement: $DBI::errstr";
  
  my $numrows = $sth->execute($threshold) or die "Can't execute statement: $DBI::errstr";
  
  $numrows = 0 if $numrows eq "0E0";
 
 	if ( $numrows > 0 ) 
 		{
			my( $plannercode, $dealer, $count );
  		$sth->bind_columns( undef, \$plannercode, \$dealer, \$count );

			LogMsg("Here are the dealers that have more than $threshold DELETEME's");
			LogMsg("");
	
  		while( $sth->fetch() ) {
    			LogMsg("\t\t\t$plannercode, $dealer, $count");
    			push @output_array, [ $plannercode, $dealer, $count ]
  			}   
  
  		LogMsg("");
  
  		# sort the array    	
			@output_array = sort @output_array;
	
  		# check for problems which may have terminated the fetch early
 		 die $sth->errstr if $sth->err;
 		 
 		 $global_dbh->disconnect()        
 		 
	  }
	  else
	  {
	  	LogMsg("There are no records counts that exceed the threshold of $threshold");
	  }	
}
Here's the exact error:

Code:
DBD::Oracle::st execute failed: ORA-01722: invalid number (DBD ERROR: error possibly near <*> indicator at char 386 in 'SELECT
                                        l.P_PLANNERCODE
                                , s.loc
                                , COUNT(*)
                             FROM stsc.SKU s, stsc.LOC l
                            WHERE s.p_deleteme = 'DELETEME'
                              AND s.LOC = l.LOC
                            GROUP BY l.P_PLANNERCODE, s.LOC HAVING COUNT(*) >= :<*>p1') [for Statement "SELECT
                                        l.P_PLANNERCODE
                                , s.loc
                                , COUNT(*)
                             FROM stsc.SKU s, stsc.LOC l
                            WHERE s.p_deleteme = 'DELETEME'
                              AND s.LOC = l.LOC
                            GROUP BY l.P_PLANNERCODE, s.LOC HAVING COUNT(*) >= ?" with ParamValues: :p1=DBI::db=HASH(0x2022435c)] at DeleteMeProcess.pl line 115.
Can't execute statement: ORA-01722: invalid number (DBD ERROR: error possibly near <*> indicator at char 386 in 'SELECT
                                        l.P_PLANNERCODE
                                , s.loc
                                , COUNT(*)
                             FROM stsc.SKU s, stsc.LOC l
                            WHERE s.p_deleteme = 'DELETEME'
                              AND s.LOC = l.LOC
                            GROUP BY l.P_PLANNERCODE, s.LOC HAVING COUNT(*) >= :<*>p1') at DeleteMeProcess.pl line 115.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On