On Jun 26, 10:25 am, [EMAIL PROTECTED] (Philip Garrett)
wrote:
[EMAIL PROTECTED] wrote:
Good morning,
I was given some tables on an Oracle database, but unfortunately I do
not know the field/column names of the table. I've made numerous
attempts to print such a list for a given table
Hi Folks
There are Perl modules designed to solve this problem. One is:
http://search.cpan.org/~rsavage/DBIx-Admin-TableInfo-2.00/
--
Ron Savage
[EMAIL PROTECTED]
Good morning,
I was given some tables on an Oracle database, but unfortunately I do
not know the field/column names of the table. I've made numerous
attempts to print such a list for a given table, but they never seem
to work. I've been trying SQL queries such as:
SELECT column_name FROM
[EMAIL PROTECTED] wrote:
Good morning,
I was given some tables on an Oracle database, but unfortunately I do
not know the field/column names of the table. I've made numerous
attempts to print such a list for a given table, but they never seem
to work. I've been trying SQL queries
i think there is a syscolumns and systables tables that contain that
data.
On Jun 26, 2007, at 7:31 AM, [EMAIL PROTECTED] wrote:
Good morning,
I was given some tables on an Oracle database, but unfortunately I do
not know the field/column names of the table. I've made numerous
attempts
[EMAIL PROTECTED] wrote:
Good morning,
I was given some tables on an Oracle database, but unfortunately I do
not know the field/column names of the table. I've made numerous
attempts to print such a list for a given table, but they never seem
to work. I've been trying SQL queries
Hi Bill,
Bill Moseley [EMAIL PROTECTED] wrote:
How do I get the column names as a list to match the order of the
rows returned when using select/fetchall_arrayref [...] I'm not
having luck finding it in the docs.
See the Statement Handle Attributes section of the DBI docs:
http
How do I get the column names as a list to match the order of the
rows returned when using select/fetchall_arrayref and using an ARRAY
slice? I'm not having luck finding it in the docs.
I don't know the column names ahead of time -- I'm passed a query and
want to return the data in the column
On 5/3/06, Bill Moseley [EMAIL PROTECTED] wrote:
How do I get the column names as a list to match the order of the
rows returned when using select/fetchall_arrayref and using an ARRAY
slice? I'm not having luck finding it in the docs.
I don't know the column names ahead of time -- I'm passed
Alexander Foken wrote:
snip
You could slowly migrate your system, a first step would be to make sure
all table and column names match /^[A-Za-z][A-Za-z0-9_]+$/. Next, move
the tables and the business logic to a real database. Then finally,
get rid of ODBC drivers and Access on the clients
don't have an Oracle License, you could also use
the free (as in beer) MSDE, or the free (as in beer and speech) PostgreSQL.
You could slowly migrate your system, a first step would be to make sure
all table and column names match /^[A-Za-z][A-Za-z0-9_]+$/. Next, move
the tables
At 9:44 AM +0100 2/1/06, Alexander Foken wrote:
You could slowly migrate your system, a first step would be to make
sure all table and column names match /^[A-Za-z][A-Za-z0-9_]+$/.
Next, move the tables and the business logic to a real database.
Then finally, get rid of ODBC drivers and Access
Darren Duncan wrote:
At 9:44 AM +0100 2/1/06, Alexander Foken wrote:
You could slowly migrate your system, a first step would be to make
sure all table and column names match /^[A-Za-z][A-Za-z0-9_]+$/.
Next, move the tables and the business logic to a real database.
Then finally, get rid
On Wed, Feb 01, 2006 at 02:08:32AM +0100, [EMAIL PROTECTED] wrote:
use backticks instead of double quotes:
my $sth=$dbh-prepare('select * from taskhours_per_date where `employee
name`=?');
That's not portable.
The DBI has a $dbh-quote_identifier method to abstract this and
On Wed, 01 Feb 2006 13:36:41 +0100, Alexander Foken wrote:
Hi Alexander
Right. But using a restrictive set of characters for table and
column names makes things easier. The column for the number of
Just as I raved about back in 2003 :-):
http://savage.net.au/Ron/html/naming-database
At 9:30 AM +1100 2/2/06, Ron Savage wrote:
On Wed, 01 Feb 2006 13:36:41 +0100, Alexander Foken wrote:
Right. But using a restrictive set of characters for table and
column names makes things easier. The column for the number of
Just as I raved about back in 2003 :-):
Now, I understand
On Wed, 1 Feb 2006 15:46:31 -0800, Darren Duncan wrote:
Hi Darren
snip valid points
It would be quite natural for such users to make identifiers like
'Person' and 'Home Address' and 'Home Telephone' and 'Work
Telephone' and so on; it isn't natural for them to say
'Home_Telephone' and such.
I am using the ODBC module to talk to an Access database. In that
database some of the column names have spaces in them (something like
EMPLOYEE NAME).
I have tried a bunch of stuff (backticking, brackets, braces, variables)
but I cannot seem to do a select on that table.
my $sth = $dbh
I believe you want square-brackets for Access:
my $sth = $dbh-prepare(SELECT * FROM taskhours_per_date WHERE [EMPLOYEE NAME]
= ?);
Paul
Quoting Robert Hicks [EMAIL PROTECTED]:
I am using the ODBC module to talk to an Access database. In that
database some of the column names have spaces
old Access
versions have some very strange behaviours.
Alexander
Robert Hicks wrote:
I am using the ODBC module to talk to an Access database. In that
database some of the column names have spaces in them (something like
EMPLOYEE NAME).
I have tried a bunch of stuff (backticking, brackets
Subject: Column names have spaces in them!!!
I am using the ODBC module to talk to an Access database. In that
database some of the column names have spaces in them (something like
EMPLOYEE NAME).
I have tried a bunch of stuff (backticking, brackets, braces, variables)
but I cannot seem
Alexander Foken wrote:
You need to pass the quotes to the SQL engine. And by the way, you
should either use parameters or the quote function for values:
my $sth=$dbh-prepare('select * from taskhours_per_date where employee
name=?');
$sth-execute('NAME HERE');
Maybe MS Acesss has other ways
use backticks instead of double quotes:
my $sth=$dbh-prepare('select * from taskhours_per_date where `employee
name`=?');
Regards,
Renee
Am 31.01.2006 um 23:58 Uhr haben Sie geschrieben:
Alexander Foken wrote:
You need to pass the quotes to the SQL engine. And by the way, you
should
. September 2005 13:36
An: dbi-users@perl.org
Betreff: need help to know the column names and data types
Hi
I am new to DBI programming. I am trying to write a generic package which
will handle all the database operations like create table, insert records,
delete and also modify records
Hi
I am new to DBI programming. I am trying to write a generic package which
will handle all the database operations like create table, insert records,
delete and also modify records. For a query user need to enter the table
name only and the package will get the column names, data types
to know the column names and data types
Hi
I am new to DBI programming. I am trying to write a generic package
which
will handle all the database operations like create table, insert
records,
delete and also modify records. For a query user need to enter the table
name only and the package
On Fri, 30 Sep 2005 17:05:35 +0530, Umesh Barik wrote:
Hi Umesh
1) http://charlotte.pm.org/kwiki/index.cgi?BreadProject
2) http://search.cpan.org/ and search for CGI::Application
or DBIx::Admin
3) (Old code) http://savage.net.au/Perl-tutorials.html (# 35 or 41)
--
Cheers
Ron Savage, [EMAIL
Hi everybody,
what I want to do is something like
$dbh-prepare('UPDATE table SET ? = ? WHERE id=?');
$dbh-execute($column,$value, $id);
The encountered problem relates to the bind-process of $column.
As I suppose I have to explicitly call the bind_param-method the tell the
driver not to quote
On Tue, 2004-07-06 at 08:33, [EMAIL PROTECTED] wrote:
Hi everybody,
what I want to do is something like
$dbh-prepare('UPDATE table SET ? = ? WHERE id=?');
$dbh-execute($column,$value, $id);
The encountered problem relates to the bind-process of $column.
As I suppose I have to
]
cc:
06.07.2004 08:33 Subject: binding column names
On Tue, 23 Sep 2003 09:37:42 +1000, Fox, Michael wrote:
If you are not worried about the order in which the columns come back, you
could select straight into a hash and save a few lines of code
Or blend the two aproaches, use $sth-{NAME} to get an array of names in
the proper order, and use a
Hey,
Basically trying to get 1 set of results returned, along with all column
names at the same time.
Is there an easier way to do it than this? Here's what I have:
(Note: MySQL database)
my $tablename = tablename; #get around taint warning
$sql = LISTFIELDS $tablename;
$sth = $dbh-prepare
On Mon, 22 Sep 2003 07:23:17 +0200 JoeJoeJoeJoe [EMAIL PROTECTED] wrote:
Basically trying to get 1 set of results returned, along with all
column names at the same time.
Is there an easier way to do it than this? Here's what I have:
There is, see below.
(Note: MySQL database)
my
) { print $col_name is
$r_results-{$col_name}br; }
-Original Message-
From: JoeJoeJoeJoe [mailto:[EMAIL PROTECTED]
Sent: Monday, 22 September 2003 3:23 PM
To: [EMAIL PROTECTED]
Subject: Better way to get column names with values?
Hey,
Basically trying to get 1 set of results returned
Nickolayev
Cc: [EMAIL PROTECTED]
Sent: 6/10/2003 10:37 PM
Subject: Re: How can I fetch column names?
Try this (I use mysql - thus your mileage can vary):
$column_list = $connect-prepare(LISTFIELDS $oppanel_table) ;
$column_list-execute() ;
$column_list_numrows = $column_list
for informix. You mileage will vary.
# This function queries the database about a table. Returns three values:
# 1) The strings that represent how to reconstruct the
# table. IE: biblio_id CHAR(7),
# 2) The number of columns in the table.
# 3) The array of column names.
sub
Greetings. Maybe the answer for my question will be RTFM, but i still cant find
it myself. The problem is: i need to fetch just list, contains column names - and
i dont know how to do it. I didnt find it in DBI manual page, and anywhere else.
Thanks anyway, and sorry for my english.
(keys(%$ref)) {
print $key\t$$ref{$key}\n;
}
}
Does that help?
Paul
Quoting Anthony Nickolayev [EMAIL PROTECTED]:
Greetings. Maybe the answer for my question will be RTFM, but i still cant
find
it myself. The problem is: i need to fetch just list, contains column
::errstr\n;
-Original Message-
From: Anthony Nickolayev [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 3:34 AM
To: [EMAIL PROTECTED]
Subject: How can I fetch column names?
Greetings. Maybe the answer for my question will be RTFM, but i still cant
find
it myself. The problem is: i need
question will be RTFM, but i still cant find
it myself. The problem is: i need to fetch just list, contains column names - and
i dont know how to do it. I didnt find it in DBI manual page, and anywhere else.
Thanks anyway, and sorry for my english.
Which database? It usually varies.
On Jun 10, Anthony Nickolayev scribed:
Greetings. Maybe the answer for my question will be RTFM, but i still cant find
it myself. The problem is: i need to fetch just list, contains column names - and
i dont know how to do it. I didnt find it in DBI manual
, June 10, 2003 4:30 PM
To: Anthony Nickolayev
Cc: [EMAIL PROTECTED]
Subject: Re: How can I fetch column names?
Which database? It usually varies.
On Jun 10, Anthony Nickolayev scribed:
Greetings. Maybe the answer for my question will be RTFM, but i still cant find
it myself. The problem is: i
Nickolayev
Cc: [EMAIL PROTECTED]
Subject: Re: How can I fetch column names?
Which database? It usually varies.
On Jun 10, Anthony Nickolayev scribed:
Greetings. Maybe the answer for my question will be RTFM, but i still
cant find
it myself. The problem is: i need to fetch just list, contains
:
@rwl.buryatia.ru Subject: How can I fetch column names
Snethen, Jeff wrote:
I've worked with the DBI some, but I'm now starting to experiment with DBD::CSV. I'm
trying to read a table without
column headers, letting CSV create the column names for me. If I understand the
documentation correctly, an empty array
reference should cause the driver
I've worked with the DBI some, but I'm now starting to experiment with DBD::CSV. I'm
trying to read a table without
column headers, letting CSV create the column names for me. If I understand the
documentation correctly, an empty array
reference should cause the driver to name the columns
If you're using mysql try a 'DESCRIBE TABLE' query first.
If not mysql find a similar command in your database and use that first,
Once you have the name and position of the column names you can do what you want with
them
While associating them to the data in the subsequent select statement
Thanks Dave
But i made the mistake of caling it a table but actually it is a view and table_info
ethod does not work for that. Also i tried to run table_info for a table but it does
not return the column names.
There is a column info method for tables to do this. But it does not work for views
On Tue, 18 Feb 2003 17:57:12 -0500, Manisha Gupta wrote:
Hello
Hi Manisha
I see you've been given 3 answers. I suggest reading DBI.html.
The data you want is clearly documented in DBI.html (generate this
from DBI.pm), under the heading 'Statement Handle Attributes'
--
Cheers
Ron Savage, [EMAIL
are not as efficient as the array ref
functions, so, if performance is an issue, it may be worth performing a
select from the database system tables to determine column names (and
types?) before using the arrayref functions.
There is a table_info function that will give you the table definitions
Manisha
Hello
Hi
I am working with Perl CGi. There is a query where i have to select all
columns in a table and display the data on the web page.
the query is something like
select * from tablename
But the problem is I am not able to get the column names.
I am using the DBI module
On Wed, 19 Feb 2003 09:13:48 +, [EMAIL PROTECTED]
wrote:
Hi,
Hi Philip
fetchrow_hashref returns a reference to a hash, with each hash
having the
column name as it's keys.
$row = $sth-fetchrow_hashref;
print $row-{NAME},$row-{ADDRESS}
Sure but there are other things to consider:
1)
On Wed, 19 Feb 2003 08:15:27 -0500, Dave K wrote:
Hi Dave
advice. If you would like to see another approach you can visit:
http://www.geocities.com/k2001evad/pindex.html
Thanx for the demo.
--
Cheers
Ron Savage, [EMAIL PROTECTED] on 20/02/2003
http://savage.net.au/index.html
Hello
I am working with Perl CGi. There is a query where i have to select all columns in a
table and display the data on the web page.
the query is something like
select * from tablename
But the problem is I am not able to get the column names.
I am using the DBI module. Is there a way to get
]]
Sent: Tuesday, February 18, 2003 5:57 PM
To: [EMAIL PROTECTED]
Subject: retrieving column names from a table using DBI module
Hello
I am working with Perl CGi. There is a query where i have to select all
columns in a table and display the data on the web page.
the query is something like
to an array containing one hashref
per result row and, again, an array containing the names of all your
columns.
Brian McCain
- Original Message -
From: Manisha Gupta [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 18, 2003 2:57 PM
Subject: retrieving column names from a table
Hi,
Is there a way to get the column names for a cursor call instead of
:B1, :B2, etc?
Thanks,
G. Botorog
On Mon, 4 Nov 2002 19:08:27 +0100 Georg Botorog [EMAIL PROTECTED] wrote:
Is there a way to get the column names for a cursor call instead of
:B1, :B2, etc?
Those names are usually associated with bind variables, not columns.
Some example code might make it easier for someone here to figure out
Can someone give me a sample of how to use the column_info method in DBI
1.30? I've read the docs, and I believe this method has the information I
seek, but I'm an examples kind of person when it comes to stuff like this.
I'm primarily interested in getting my hands on the column names and data
Hello
How can I get SQL to return the column names when doing a select using
the DBI?
Why do I need this? I am trying to make one sub that will do my various
selects. Right now I'm doing it with discrete subs. I find that these
subs are EXACTLY the same except for parsing the SQL returns
On Mon, Sep 09, 2002 at 05:03:48PM -0400, Kyle wrote:
Hello
How can I get SQL to return the column names when doing a select using
the DBI?
Why do I need this? I am trying to make one sub that will do my various
selects. Right now I'm doing it with discrete subs. I find
Check out the NAME and NAME_uc attributes associated with
the statement handle. They essentially give you a hash of
column names.
Steve Sapovits
[EMAIL PROTECTED]
-Original Message-
From: Kyle [SMTP:[EMAIL PROTECTED]]
Sent: Monday, September 09, 2002 5:04 PM
To: PERL DBI
Hi there,
How can I retrieve the column names in the result set using DBI?
Thanks,
David
From: Zhao, David [PRDUS Non JJ] [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, April 04, 2002 17:26
Subject: retrieve column names in the result set
How can I retrieve the column names in the result set using DBI?
It's in the fine manual. Run 'perldoc DBI' and look for the NAME
Hi,
I have a problem with getting colunm count and their names.
I have to get the list of all tables in the users account (Oracle).
This I do by selecting * from cat.
Second step is to show every table contents (by clicking on link with table
name).
To do this I need to know how many columns
all_tab_columns
order by
OWNER,
TABLE_NAME,
COLUMN_ID
=
Pekka Siiskonen
-Original Message-
From: Marius Keraitis [mailto:[EMAIL PROTECTED]]
Sent: 11. tammikuuta 2002 12:40
To: DBI Perl; Begginers Perl
Subject: Column names and etc
[beginners list snipped]
On Fri, 11 Jan 2002 11:40:03 +0100, Marius Keraitis wrote:
Second step is to show every table contents (by clicking on link with table
name).
To do this I need to know how many columns is in table, and all names of columns
in table.
You can do (very portable):
On Friday, January 11, 2002, at 07:09 AM, Bart Lateur wrote:
[beginners list snipped]
On Fri, 11 Jan 2002 11:40:03 +0100, Marius Keraitis wrote:
Second step is to show every table contents (by clicking on link
with table
name).
To do this I need to know how many columns is in table,
On 11 Jan 2002, at 9:07, Terrence Brannon wrote:
On Friday, January 11, 2002, at 07:09 AM, Bart Lateur wrote:
[beginners list snipped]
On Fri, 11 Jan 2002 11:40:03 +0100, Marius Keraitis wrote:
Second step is to show every table contents (by clicking on link
with table name). To
On Thu, 01 Nov 2001 18:56:18 -0800, Venkataramana Mokkapati wrote:
How do I get column names and order of column names
for a select * from ... query.
If you have
$sth = $dbh-prepare(select * from ...);
then try
@column_names = @{$sth-{NAME}};
You may have to do an execute
In article [EMAIL PROTECTED],
[EMAIL PROTECTED] (Bart Lateur) wrote:
On Thu, 01 Nov 2001 18:56:18 -0800, Venkataramana Mokkapati wrote:
How do I get column names and order of column names
for a select * from ... query.
If you have
$sth = $dbh-prepare(select * from
On Fri, 02 Nov 2001 07:27:49 -0500, Scott R. Godin wrote:
my %db;
$sth-bind_columns( \( @db{ @{ $sth-{NAME} } } ));# magic
while ($sth-fetch)
{
#... and no worries about which order the columns get returned in
#... since you access them via the $db{ColumnName}
Scott R. Godin writes:
the absolute neatest trick I've seen with this, that is so totally
perlish it defies description.. you stare at it for a bit and suddenly
all becomes clear.
$sth-execute
or die(Cannot Execute SQL Statement: , $sth-errstr(), \n);
On Fri, Nov 02, 2001 at 02:18:15PM +0100, Bart Lateur wrote:
On Fri, 02 Nov 2001 07:27:49 -0500, Scott R. Godin wrote:
my %db;
$sth-bind_columns( \( @db{ @{ $sth-{NAME} } } ));# magic
while ($sth-fetch)
{
#... and no worries about which order the columns get
In article [EMAIL PROTECTED],
[EMAIL PROTECTED] (Tim Bunce) wrote:
On Fri, Nov 02, 2001 at 02:18:15PM +0100, Bart Lateur wrote:
On Fri, 02 Nov 2001 07:27:49 -0500, Scott R. Godin wrote:
my %db;
$sth-bind_columns( \( @db{ @{ $sth-{NAME} } } ));# magic
while
In article [EMAIL PROTECTED],
[EMAIL PROTECTED] (Michael Peppler) wrote:
my $rows = $sth-rows;
# only expecting one row for a unique ID . this should NEVER happen.
safe_error(invalid number of rows returned from database ($rows) for
ID $id)
if $rows 1;
#
On Fri, Nov 02, 2001 at 02:41:05PM -0500, Scott R. Godin wrote:
In article [EMAIL PROTECTED],
[EMAIL PROTECTED] (Tim Bunce) wrote:
On Fri, Nov 02, 2001 at 02:18:15PM +0100, Bart Lateur wrote:
On Fri, 02 Nov 2001 07:27:49 -0500, Scott R. Godin wrote:
my %db;
of bind_columns instead of fetchrow_hashref, and
the ability to access the columns by name, and it keeps all the columns in
order for the use in execute or print or whatever else might be useful. I
find it very slick when I need column names.
Steve H.
-Original Message-
From: Scott R
May be a simple Q...
How do I get column names and order of column names
for a select * from ... query.
I dont want to use selecthash_ref just for column names.
Thanks in advance,
--MVRamana
_
Get your FREE download of MSN
Is it possible to fetch the names of all columns in a table? How
about all tables in a database?
--
My brain hurts!
SeanC
Mediatek Training Institute
26 Crart Ave., Berea, Durban, South Africa
phone: +27 (0)31 202 1886 [EMAIL PROTECTED]
You can do a DESC command in SQL, although most interfaces also provide
a specific way of doing this.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 08 May 2001 10:45
To: [EMAIL PROTECTED]
Subject: Fetching Column Names
Is it possible to fetch
On 8 May 2001, at 11:45, Sean Carte wrote:
Is it possible to fetch the names of all columns in a table?
First, prepare a statement that will select all columns from that table:
$sth = $dbh-prepare('select * from blurfle');
Next, you may have to execute the handle. (Whether this is
Many thanks your helpful replies Gregory, Sikkandar, and Philip!
--
SeanC
83 matches
Mail list logo