MySQL Forums
Forum List  »  Perl

Re: executing an SQL statement
Posted by: Randy Clamons
Date: April 18, 2007 03:52PM

Lois,

You have the basic idea. You'll need to wrap each field in your statement inside the RPAD function. Your example will look like this:

$dbh->prepare("SELECT RPAD(myfield1,10,' '),RPAD(myfield2,10,' ') FROM mydatabtable WHERE clause....");

Don't forget, the whole thing inside $dbh->prepare() must be quoted as in the above example. Your field names should not be quoted ('), or you will get the field name returned. You can use backticks (`) around field names and table names, but it's only necessary if there are embedded spaces in the field names.

Options: ReplyQuote


Subject
Written By
Posted
April 10, 2007 04:15PM
April 11, 2007 10:02AM
April 11, 2007 03:56PM
April 11, 2007 10:08AM
April 13, 2007 12:26PM
April 17, 2007 04:26PM
April 18, 2007 12:30PM
Re: executing an SQL statement
April 18, 2007 03:52PM
April 18, 2007 04:02PM
April 23, 2007 04:08PM
April 24, 2007 09:20AM
April 24, 2007 11:39AM
April 24, 2007 02:26PM
April 24, 2007 02:20PM
April 24, 2007 02:31PM
April 24, 2007 03:57PM
April 25, 2007 11:46PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.