CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: DBI:
Perl DBI: store the ddl of a column in a variable

 



db_fan
New User

May 9, 2015, 3:12 PM

Post #1 of 6 (8304 views)
Perl DBI: store the ddl of a column in a variable Can't Post

Hi,
In Perl DBI, can I store the ddl of a column in a variable? My objective, is to use the definition of the column to create a temp table in another database.

Mike


Zhris
Enthusiast

May 9, 2015, 3:31 PM

Post #2 of 6 (8301 views)
Re: [db_fan] Perl DBI: store the ddl of a column in a variable [In reply to] Can't Post

Hi,

DBI has a column_info method, as well as similar methods for fetching other schema level data. Of course you can also select this information from the ddl's internal views yourself, the relevant DBD module source should provide useful statements.

Chris


(This post was edited by Zhris on May 9, 2015, 3:42 PM)


db_fan
New User

May 9, 2015, 3:42 PM

Post #3 of 6 (8294 views)
Re: [Zhris] Perl DBI: store the ddl of a column in a variable [In reply to] Can't Post

Thank you Chris.
What if I have a number of columns? in Perl DBI, I need to create a temp table of those columns and generate a ddl of the temp table on Database A. Then, the DDL of the temp table will be loaded on database B.
Do you have any hints on how to do that?

Mike


Zhris
Enthusiast

May 9, 2015, 3:44 PM

Post #4 of 6 (8293 views)
Re: [db_fan] Perl DBI: store the ddl of a column in a variable [In reply to] Can't Post

What database driver are you using, MySQL?

Chris


db_fan
New User

May 9, 2015, 3:44 PM

Post #5 of 6 (8291 views)
Re: [Zhris] Perl DBI: store the ddl of a column in a variable [In reply to] Can't Post

Using DB2

Mike


Zhris
Enthusiast

May 9, 2015, 3:51 PM

Post #6 of 6 (8288 views)
Re: [db_fan] Perl DBI: store the ddl of a column in a variable [In reply to] Can't Post

I'm not familiar with DB2, have you looked into the syscat tables, specifically the syscat.columns table? It appears you can select all the information you require in one hit off this table.

Apologies, are you stuck on using Perl's DBI module, as oppose to how to get the information as per your original post?

Chris


(This post was edited by Zhris on May 9, 2015, 4:06 PM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives