Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your input parameter <code>%type</code> statements claim the column names are <code>col_name</code> and <code>col_price</code>. But that is not how you refer to them in your stored procedure (<code>name</code> and <code>price</code>).</p> <p>Bad things can happen when you name variables after column names. <a href="http://asktom.oracle.com/pls/apex/f?p=100:11:0%3a%3a%3a%3aP11_QUESTION_ID:6729304326802" rel="nofollow">AskTom</a> recommends a limited convention of variable naming conventions:</p> <ul> <li>local variables start with <code>L_</code></li> <li>parameters start with <code>P_</code></li> <li>global package variables start with <code>G_</code></li> </ul> <p>That link has a good general discussion on PL/SQL naming conventions. I personally just use <code>V_</code> for most variables (aside from indexes and other obvious things), but that's just me.</p> <p>Lastly, the <code>col_</code> in the column names seem redundant; simply use <code>name</code> and <code>price</code> as column names.</p> <p>So, that said, I think this does what you want:</p> <pre><code>create table table1 ( name varchar2(30), price number ); create or replace procedure TEST( p_name IN table1.name%type, p_price IN table1.price%type ) is begin update table1 set name = p_name where price = p_price; commit; end TEST; / insert into table1 values ('John', 500); commit; select * from table1; exec TEST(p_name =&gt; 'Bob', p_price =&gt; 500); select * from table1; -- Clean up test artifacts drop procedure test; drop table table1; </code></pre> <p>Giving the output:</p> <pre><code>table TABLE1 created. PROCEDURE TEST compiled 1 rows inserted. committed. NAME PRICE ------------------------------ ---------- John 500 anonymous block completed NAME PRICE ------------------------------ ---------- Bob 500 procedure TEST dropped. table TABLE1 dropped. </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload