The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Perl - PostGreSql query garric UNIX and Linux Applications 0 06-01-2008 12:17 AM
Query in perl Dana Evans UNIX for Dummies Questions & Answers 2 11-21-2007 07:27 PM
perl query bishweshwar Shell Programming and Scripting 1 04-30-2007 06:03 AM
Perl CGI Query pondlife Shell Programming and Scripting 4 06-08-2006 06:28 PM
Query string assingment for other variable in PERL maheshsri Shell Programming and Scripting 0 01-30-2006 12:45 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-04-2006
Registered User
 

Join Date: Jan 2006
Posts: 125
Incorrect SQL query in perl

I the the following perl script, however it does not return anything. Did i form my syantax wrongly?
Code:
$sth=$dbh->prepare("select a.rowid,a.* from Table1 a 
  		      where a.field1 = \'$Indicator1\' 
  		      and a.schedule = \'$Indicator2\'  and a.lastdate <= sysdate");
  		 $sth->execute()
After i hardcoded my code to the following, it worked
Code:
$sth=$dbh->prepare("select a.rowid,a.* from Table1 a 
  		      where a.field1 = 'Valid' 
  		      and a.schedule = 'Y'  and a.lastdate <= sysdate ");
  		 
$sth->execute()
i think the ' and \ could have messed up the syntax, how can i resolve it?
Indicator1 and indicator2 are not supposed to be hardcoded.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 04-04-2006
Registered User
 

Join Date: Jan 2006
Posts: 125
Hi all, i found my mistake. I mixed up my columns. The escaping is fine. I also realised that without the \, it would also work.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:24 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0