pls-00363输入参数,赋值

csga3l58  于 2021-07-26  发布在  Java
关注(0)|答案(1)|浏览(330)

我无法将变量值作为输入参数添加到过程upd\u用户。

PROCEDURE reset_pass (in_row IN users%ROWTYPE)
  IS
  l_random_pass varchar2(4000);
  BEGIN
  SELECT DBMS_RANDOM.string('x',10) INTO l_random_pass FROM DUAL;
  in_row.password  := l_random_pass;

  account_api.upd_users( table_row => in_row );
  END reset_pass;

当我试着去整理时 PLS-00363: expression 'in_row.password' cannot be used as an assignment target 我无法为输入参数赋值,但过程upd\u users还有%rowtype参数。我不能再增加一个值了。call reset\u pass中的另一个输入值应该是用户的id
编辑:upd\U用户程序:

PROCEDURE upd_users (
    table_row    IN   users%rowtype
) IS
BEGIN     
    UPDATE users
    SET
        row = table_row
    WHERE
        id = table_row.id;         
END upd_users;
jv4diomz

jv4diomz1#

您应该将in参数转换为in out

PROCEDURE reset_pass (in_row IN OUT users%ROWTYPE)

另一种方法是,获取本地记录对象,以防无法将其修改为in-out。

PROCEDURE reset_pass (in_row IN users%ROWTYPE)
  IS
  l_random_pass varchar2(4000);
  in_row_local users%ROWTYPE;
  BEGIN
  in_row_local := in_row;
  SELECT DBMS_RANDOM.string('x',10) INTO l_random_pass FROM DUAL;
  in_row_local.password  := l_random_pass;

  account_api.upd_users( table_row => in_row_local );
  END reset_pass;

相关问题