Home » SQL & PL/SQL » SQL & PL/SQL » dynamic input value passing (ORACLE 10G)
dynamic input value passing [message #638684] Thu, 18 June 2015 04:40 Go to next message
arun888
Messages: 100
Registered: June 2015
Location: INDIA
Senior Member
hi I have created a procedure and passing the store value staticly in the below procedure.

if the user need to pass the store value as input. how to re-write the code.
any idea please.
create or replace procedure test10 is
c_str store.store%type;
c_subchain store.subchain%type;
c_chain store.chain%type;
BEGIN
c_str :=47377;
select chain, subchain INTO c_chain, c_subchain from store where store = c_str;
DBMS_OUTPUT.PUT_LINE(c_chain);
END;
Re: dynamic input value passsing [message #638686 is a reply to message #638684] Thu, 18 June 2015 04:48 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Use a parameter.
create or replace procedure test10 (par_c_str in number) is
...
where store = par_c_str
...


Then call the procedure as
begin
  test10(47377);
end;
/

[Updated on: Thu, 18 June 2015 04:49]

Report message to a moderator

Re: dynamic input value passsing [message #638688 is a reply to message #638686] Thu, 18 June 2015 05:13 Go to previous messageGo to next message
arun888
Messages: 100
Registered: June 2015
Location: INDIA
Senior Member
thanks for your help. its worked.

I am new to pl sql. just started learning PL SQL.

Thanks for your help again.
Re: dynamic input value passsing [message #638694 is a reply to message #638688] Thu, 18 June 2015 09:47 Go to previous message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Two good books for you:
PL/SQL User's Guide and Reference
Application Developer's Guide - Fundamentals
Previous Topic: PL SQL - Need to create archive table - [MERGED]
Next Topic: Function declartation
Goto Forum:
  


Current Time: Thu Apr 25 02:36:23 CDT 2024