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]

Reply via email to