PLS-00363: expression '%s' cannot be used as an assignment targetwhere %s is a placeholder for the actual string that applies to the particular case.
Oracle raises this error at compilation time when it detects an unsuitable parameter type in the parameter list of a procedure or function call, as in the following cases (the list i give here is presumably a sub-set of all possible situations):
case #1
case #2
declare
c_val constant varchar2(10) := 'test';
begin
test_proc(c_val); -- test_proc's parameter is declared as IN/OUT,
-- but c_val is a constant
end;
ORA-06550: line 4, column 11:
PLS-00363: expression 'C_VAL' cannot be used as an assignment target
ORA-06550: line 4, column 1:
PL/SQL: Statement ignored
create or replace procedure test_proc2 (p_in in varchar2) is
begin
test_proc(p_in); -- test_proc's parameter is IN/OUT,
-- but p_in is an IN parameter of the calling procedure
end;
PLS-00363: expression 'P_IN' cannot be used as an assignment target
case #3
The same error is raised in the previous situations if procedure's parameter is declared as OUT instead of IN/OUT.
begin
test_proc(10); -- test_proc's parameter is IN/OUT,
-- but you are passing a literal value
end;
ORA-06550: line 2, column 11:
PLS-00363: expression '10' cannot be used as an assignment target
ORA-06550: line 2, column 1:
PL/SQL: Statement ignored
case #4
declarehowever we could use the function to initialize the constant value inside the declaration:
rtn_val constant varchar2(10) := 'test';
begin
rtn_val := test_fn('silly case'); -- cannot assign function's result to a constant
end;
ORA-06550: line 4, column 3:
PLS-00363: expression 'RTN_VAL' cannot be used as an assignment target
ORA-06550: line 4, column 3:
PL/SQL: Statement ignored
declareNeedless to say, assigning a value to a constant inside the program body is forbidden in all cases as it is a nonsense. Constants must be always initialized with some value in the declaration section.
rtn_val constant varchar2(10) := test_fn('silly case');
begin
dbms_output.put_line(rtn_val);
end;
See message translations for PLS-00363 and search additional resources.
No comments:
Post a Comment