Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Executing a dynamic script name from SQLPLUS?

TR81Mar 9 2014 — edited Mar 10 2014

I have a script that will be executed from SQLPLUS.

I need the script to query a table, and assign the result value to a variable.  I then need to call a second script with the value of that variable.

Here is a generic non-working example of what I need to do.  I need to put a value in the ScriptName variable then execute the script with that name.  Is it possible?  Passing the value from a bat file or something isn't possible in this situation.

DECLARE ScriptName VARCHAR2(50);

BEGIN

-- Get name of script

SELECT NextScript INTO ScriptName FROM GenericTable;

-- Execute the script

@ScriptName

END;

/

This post has been answered by BluShadow on Mar 10 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 7 2014
Added on Mar 9 2014
9 comments
2,794 views