I'm starting with data in the database. It's SQL statements and I'm 
populating arrays in perl.

I don't need to build a hash but the statement. I thought an array or hash 
would be the easiest.

[EMAIL PROTECTED] wrote:
>
>Vincent
>
>I will have several suggestions, but I need to know what data you're
>starting with, and what form it's in. Are you starting with a real database
>or just a paper specification? Is the hash you're describing something you
>need to build anyway or is it simply a means to build the SQL statement?
>
>Bring the answer back to the mail group so that others can learn.
>
>Cheers,
>
>Rob
>
>----- Original Message -----
>From: "Vincent Lee" <[EMAIL PROTECTED]>
>To: "Rob" <[EMAIL PROTECTED]>
>Sent: Tuesday, October 15, 2002 3:03 PM
>Subject: Re: creating a string on the fly
>
>
>> Hi Rob,
>>
>> Thanks for helping me out!!
>>
>> Yes you are correct...hmmm...so yes, I didn't
>> understand what I was doing (new to perl).
>>
>> Any suggestions on what I could do?
>>
>> I just want to be able to create a string that takes
>> this information and makes a create view statement
>>
>> "CREATE VIEW_$TABLENAME AS SELECT [array of
>> columns]...."
>>
>>
>> --- Rob <[EMAIL PROTECTED]> wrote:
>> > Hi Vincent
>> >
>> > I /think/ you're misunderstanding hashes, but I need
>> > to make sure.
>> >
>> > Do you mean that your has array contains:
>> >
>> >     ORG      => ID
>> >     ORG      => COL1
>> >     ORG      => COL2
>> >     EMPLOYEE => ID
>> >     EMPLOYEE => COL1
>> >     EMPLOYEE => COL2
>> >
>> > Because you can't do that.
>> >
>> > A hash represents a one-to-one correspondence, so
>> > you can have only one
>> > value per
>> > table name. That entry can be a /list/ of columns
>> > though, so the way to do
>> > what you
>> > want is to set up a hash of array references:
>> >
>> >     ORG      => ['ID', 'COL1', 'COL2']
>> >     EMPLOYEE => ['ID', 'COL1', 'COL2']
>> >
>> > Tell me if I'm right.
>> >
>> > Cheers,
>> >
>> > Rob
>> >
>> > ----- Original Message -----
>> > From: "Vincent Lee" <[EMAIL PROTECTED]>
>> > To: <[EMAIL PROTECTED]>
>> > Sent: Tuesday, October 15, 2002 12:55 AM
>> > Subject: creating a string on the fly
>> >
>> >
>> > > Can someone help me with some basic logic?
>> > >
>> > > I have an array with unique tablenames from a DB
>> > > catalog view
>> > >
>> > > TABNAME
>> > > -------
>> > > Org
>> > > Employee
>> > > Dept
>> > >
>> > > Each of these tablenames has columns in a hash
>> > array
>> > >
>> > > For example, ORG would have 3 columns and the
>> > array
>> > > would be as follows:
>> > >
>> > > ORG  ID
>> > > ORG  COL1
>> > > ORG  COL2
>> > > EMPLOYEE ID
>> > > EMPLOYEE COL1
>> > > EMPLOYEE COL2....etc.
>> > >
>> > > I'm trying to build a statement that iterates
>> > through
>> > > the array and builds a statement for each table.
>> > >
>> > > I have another array that stores just the table
>> > names.
>> > >
>> > > I can't seem to build a statement like this:
>> > >
>> > > ID, COL1, COl2
>> > >
>> > > I've got two loops one for the tables
>> > > but then I want to test if the $table_name=keys
>> > > (%col_hash) then print the columns...
>> > >
>> > >
>> > > Anyone iwth some idea?
>> > >
>> > > Best regards,
>> > > Vincent
>> > > _______________________________
>> > > Vincent J. Lee
>> > > EMAIL: [EMAIL PROTECTED] |
>> > [EMAIL PROTECTED]
>> > > MOBILE: 917.318.8251
>> > >
>> > >
>> > > --
>> > > To unsubscribe, e-mail:
>> > [EMAIL PROTECTED]
>> > > For additional commands, e-mail:
>> > [EMAIL PROTECTED]
>> > >
>> >
>> >
>> > --
>> > To unsubscribe, e-mail:
>> > [EMAIL PROTECTED]
>> > For additional commands, e-mail:
>> > [EMAIL PROTECTED]
>> >
>>
>>
>> =====
>> Regards,
>> Vincent
>>
>> __________________________________________________
>> Do you Yahoo!?
>> Faith Hill - Exclusive Performances, Videos & More
>> http://faith.yahoo.com
>


Best Regards,

Vincent Lee
[EMAIL PROTECTED]
917.318.8251


_______________________________________________________
Sent through e-mol. E-mail, Anywhere, Anytime. http://www.e-mol.com




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to