Home > Ask the Oracle Database / Applications Experts > Questions & Answers > Calling variable name packages
Ask The Oracle Expert: Questions & Answers
EMAIL THIS

Calling variable name packages

Brian Peasland EXPERT RESPONSE FROM: Brian Peasland

Pose a Question
Other Oracle Categories
Meet all Oracle Experts
Become an Expert for this site
>
QUESTION POSED ON: 27 May 2003
I want to call variable name packages because the name of the package changes in some states. For example:
 
 if i = 1 then exm_pck.pr_exm(x,x)
 elsif i = 2 then exm_pck.pr_exm(x,x)
 .
 .
 .
The names of the packages and the states are in the a table.
 
 select pck_name , state_name
 into v_pck_name, v_state_name
 from xxx_table
 where state_name = 'XXX'
How can I call the v_pck_name without using a dynamic SQL command?

>

In your PL/SQL block, you can use a simple IF-THEN-ELSE statement to choose how to call a stored procedure, based on a value you have. To illustrate, look at the following sample code:

BEGIN
  SELECT pck_name, state_name INTO v_pck_name,
v_stat_name
  FROM xxx_table
  WHERE state_name='XXX';
-- Depending on package name, run the appropriate package
  IF (v_pck_name='PKG1') THEN
     exm_pkg1.pr_exam(x,x);
  ELSIF (v_pck_name='PKG2') THEN
     exm_pkg2.pr_exam(x,x);
  ELSE
     DBMS_OUTPUT.PUT_LINE('No valid package');
  END IF;
END;
It should be easy to see how the IF-THEN-ELSE is used to determine which package to use.

For More Information


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



Oracle White Papers: Fusion Middleware
HomeNewsTopicsTipsAsk the ExpertsMultimediaWhite PapersProductsBlogs
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2003 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts