Solved

Perl in oracle query

Posted on 2007-11-20
3
251 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
  • 2
3 Comments
 
LVL 39

Accepted Solution

by:
Adam314 earned 500 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Oracle Database Upgrade 13 62
Oracle - Stored Procedure Privilge access 3 39
html form to write data to csv 24 97
Oracle 10g standard edition server with 4 processors 3 37
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to recover a database from a user managed backup

896 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now