Skip site navigation (1) Skip section navigation (2)

POSTGRESQL and PERL?

From: Peter Landis <ntwebdeveloper(at)yahoo(dot)com>
To: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: POSTGRESQL and PERL?
Date: 2000-05-26 15:58:18
Message-ID: 20000526155818.9972.qmail@web3204.mail.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-sql
Hi-
   I'm a newbie at postgresql and was working on
sorting by category.  What my question is, how do you
sort by category when using a variable.  For instance,
you can sort by name in perl by doing:
 
$sqh = $dbh->prepare(q{select name from company order
by name;});
$sqh->execute();

but what if you have a variable set like:
$sort_selection = "name";

How do you sort by the variable?

For instance you cannot do:
$sqh = $dbh->prepare(q{select name from company order
by ?;});
$sqh->execute($sort_selection);

OR

$sqh = $dbh->prepare(q{select name from company order
by $sort_selection;});
$sqh->execute();

If anyone could help, I would greatly appreciate it.

Thanks again!



__________________________________________________
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/

Responses

pgsql-sql by date

Next:From: Wallingford, TedDate: 2000-05-26 16:14:16
Subject: RE: POSTGRESQL and PERL?
Previous:From: Tom LaneDate: 2000-05-26 15:52:57
Subject: Re: date() indexing error..

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group