[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 240
  • Last Modified:

perl, how to check if a column on a table exists

Let say I have a table "mytable", and I want to check if the column "firstname" exists in the table.
How do I check for that in perl?
0
rgbcof
Asked:
rgbcof
2 Solutions
 
farzanjCommented:
It is more of SQL question.  You would query table from schema using Perl.  Depends upon the type of DB you have.
$dbh->do('select * into SOME_TABLE from SCHEMA.TABLE')

0
 
parparovCommented:
You can use Class::DBI with the method find_column:
http://search.cpan.org/~tmtm/Class-DBI-v3.0.17/lib/Class/DBI.pm#find_column
0
 
rgbcofAuthor Commented:
It just might work.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now