[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 262
  • Last Modified:

Perl in oracle query

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
chisun7679
Asked:
chisun7679
  • 2
1 Solution
 
Adam314Commented:

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
 
Adam314Commented:
Line 3 should have been:
    chomp $schema;
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now