How to Dynamically Pass Parameter to plsql Function & Capture its Output Value in a Shell Variable?

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

  1. The problem statement, all variables and given/known data:

  2. Relevant commands, code, scripts, algorithms:

#! /bin/ksh
 
  
  v="ORG_ID"
  
 get_next_xfer_id ()
{
NEXT_ID=$(sqlplus -s $1 <<\!
  set pages 0 feed off
  select bolinf.brok_fndload_pkg.brok_fndload_profile_chk('$2')  
 from dual;
!
)

}
  
  
 get_next_xfer_id $1 $v
 

echo $NEXT_ID

When I am passing like this function it is not working.

#! /bin/ksh
 
  
  
  
 get_next_xfer_id ()
{
NEXT_ID=$(sqlplus -s $1 <<\!
  set pages 0 feed off
  select bolinf.brok_fndload_pkg.brok_fndload_profile_chk('ORG_ID')  
 from dual;
!
)

}
  
  
 get_next_xfer_id $1 
 

echo $NEXT_ID

when I am passing like above like i am hardcoding the paramter in function the plsql function is working .

Please let me know how to pass the parameter dynamically to plssql function as well at the same time capture the output value in a shell variable 3. The attempts at a solution (include all code and scripts):

  1. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
Oracle India, Bangalore,India

Please make sure you fill in ALL relevant form sections, esp. No. 4!

And No. 1.