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

Posted on 2011-10-09
Last Modified: 2012-05-12
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?
Question by:rgbcof
    LVL 31

    Accepted Solution

    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')

    LVL 9

    Assisted Solution

    You can use Class::DBI with the method find_column:

    Author Closing Comment

    It just might work.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
    There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now