RE: USE Statement

From: James Moosmann (james.moosmann_at_bankofamerica.com)
Date: 12/23/04


Date: Thu, 23 Dec 2004 12:41:11 -0500
To: "'Ron Wingfield'" <rtwingfield@archaxis.net>, dbi-users@perl.org

That is not recommended.

You should instead use the fully qualified path.

ie.

Instead of:

use customerDb

select A.name, B.order
from info A, orders B
where A.id = B.customerId
...

do this:

select A.name, B.order
from customerDb..info A,
      customerDb..info B
where A.id = B.customerId
...

*** That being said.
If you pull out the use statement and execute it before you do the rest of
the query.
It will work also.. I do this by using a 'go' in the raw sql and then
splitting the
sql strings into an array and executing them in order.

 

-----Original Message-----
From: Ron Wingfield [mailto:rtwingfield@archaxis.net]
Sent: Thursday, December 23, 2004 12:40 PM
To: dbi-users@perl.org
Subject: USE Statement

I would like to the specify the USE argument dynamically as for example:

     USE $database;

Apparently, the scalar is not recognized (compile error). Is it possible to
provide a dynamic insertion such that a user could specify via a run-time
parameter, which database the program is to use?

BTW, I'm a new forum user. Can someone please respond is this message
appears on the forum?

Thanks,
Ron W.



Relevant Pages

  • Re: USE Statement
    ... Ron, your message did make it to the list:) ... I would like to the specify the USE argument dynamically as for ... I'm a new forum user. ...
    (perl.dbi.users)
  • USE Statement
    ... I would like to the specify the USE argument dynamically as for example: ... the scalar is not recognized (compile error). ... I'm a new forum user. ...
    (perl.dbi.users)