?
Solved

Perl in oracle query

Posted on 2007-11-20
3
Medium Priority
?
258 Views
Last Modified: 2013-12-19
i need to write a perl script to substitute the schema name in the from clause of my query and incorporate it in my query,so that it ask me to enter schema name evrytime the query runs.

select

sysdate,
prd_id,
prd_name,
member_id,
member_name,
treatment_date,
Service_id,
Service_Begin_date,
service_end_date,
Service_Desc

from

test.treatment,
test.member,
test.provider,
test.services

where

prd_id = service_prd_id_auth
and
Service_id = treatment_service_id
and
treatment_member_uid = member_id

group by
prd_id,member_id,service_id
0
Comment
Question by:chisun7679
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 39

Accepted Solution

by:
Adam314 earned 2000 total points
ID: 20320573

print "Enter schema: ";
my $schema = <STDIN>;
chomp;
 
my $sql = "
select
 
sysdate,
prd_id,
prd_name,
member_id,
member_name,
treatment_date,
Service_id,
Service_Begin_date,
service_end_date,
Service_Desc
 
from 
 
$schema.treatment,
$schema.member,
$schema.provider,
$schema.services
 
where
 
prd_id = service_prd_id_auth
and
Service_id = treatment_service_id
and
treatment_member_uid = member_id
 
group by
prd_id,member_id,service_id"

Open in new window

0
 
LVL 39

Expert Comment

by:Adam314
ID: 20320577
Line 3 should have been:
    chomp $schema;
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
Suggested Courses

777 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