Avatar of GNOVAK
GNOVAKFlag for United States of America

asked on 

Oracle PL/SQL: Calling a dynamic procedure

My head hurts.
Is ther any way to pass a procedure or function  and have another routine run it?
For example (simplistic logic - not syntactically correct):
X = "My Package."
X = X + "My_Routine"
...
...
Function Do_it  ( x as ??)
  Run routine X
end function

Is something like this possible in PL/SQL?
 
Oracle Database

Avatar of undefined
Last Comment
Sean Stuber
SOLUTION
Avatar of johnsone
johnsone
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Sean Stuber
Sean Stuber

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Sean Stuber
Sean Stuber

First example in the docs shows a more complete scenario including in/out parameters


http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17126/dynamic.htm#BHCEBBAI
Avatar of GNOVAK
GNOVAK
Flag of United States of America image

ASKER

Thanks everyone - excellent solution.
Appreciate it!
Avatar of GNOVAK
GNOVAK
Flag of United States of America image

ASKER

what if I wish to pass parameters - can this be done?
Say in the example provided, I wished to pass what it prints out - I want to pass 'Hello' or a var instead of a hard coded 'This is Proc_X'
I've tried a number of concantenations and single quoted strings and have a problem getting it to work.
Is this even possible?
Avatar of Sean Stuber
Sean Stuber

example  7-1 in the link above shows parameter usage
Oracle Database
Oracle Database

Oracle is an object-relational database management system. It supports a large number of languages and application development frameworks. Its primary languages are SQL, PL/SQL and Java, but it also includes support for C and C++. Oracle also has its own enterprise modules and application server software.

81K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo