Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8261869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:33:49+00:00 2026-06-08T03:33:49+00:00

I’m trying to write a sql*plus script that runs a single arbitrary procedure. The

  • 0

I’m trying to write a sql*plus script that runs a single arbitrary procedure. The tricky part is that I want to be able to run the procedure regardless of how many parameters that procedure takes.

To figure out the correct number of arguments for the procedure, I’m doing the following:

  SELECT COUNT(*) INTO v_in
  FROM all_arguments
  WHERE LOWER(owner) = LOWER(v_schema) 
    AND LOWER(package_name) = LOWER(v_package)
    AND LOWER(object_name) = LOWER(v_proc)
    AND in_out = 'IN';

When it comes time to build the execute-immediate string, I wanted to use a loop of some sort to do that. The parameters are all being pass in are just numbered, &1 through &n.

  FOR i IN 1..v_in
  LOOP
    v_block := v_block || '''' || &i || '''';
  IF i != v_in THEN
    v_block := v_block || ',';
  END IF;
  END LOOP;

This doesn’t work however. It sees &i and of course thinks that it is a parameter named i, and since the scheduling application (Appworx… ugh) isn’t running a define i=something, this fails miserably.

Is there any way to do indirection in this, such that I can iterate through however many happens to be correct for the given procedure?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T03:33:51+00:00Added an answer on June 8, 2026 at 3:33 am

    You can trick this with new_value and defaulting SQL*Plus parameters.

    Create a script like that, say for example test.sql:

    -- hide output
    set termout off
    
    -- define parameter variables to be set with new_value
    col par1 new_value 1 noprint
    col par2 new_value 2 noprint
    col par3 new_value 3 noprint
    
    -- initialize parameter variables
    select 1 par1, 2 par2, 3 par3 from dual where 1=2;
    
    -- append comma to parameter variables, not needed for first parameter
    select nullif(','||'&2',',') par2, nullif(','||'&3',',') par3 from dual;
    
    -- show output
    set termout on
    
    -- you actual script starts here
    prompt calling procedure my_proc(&1 &2 &3)
    
    -- for next run
    undef 1
    undef 2
    undef 3
    

    Now call with @test 3 4

    Output:

    calling procedure my_proc(3 ,4 )
    

    Or call with @test 1 2 3

    Output:

    calling procedure my_proc(1 ,2 ,3 )
    

    Now you need to extend to this to the maximum expected number of your parameters.

    (Note you have to be logged on to make this work, otherwise the select from dual will fail silently.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create an if statement in PHP that prevents a single post
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.