为什么我在调用此过程时出错?
Why do I get an error in calling this procedure?
我有一个名为 student_id
的过程
procedure student_id ( v_surname in varchar2,
v_name in varchar2,
v_date_birth in varchar2,
v_gender in varchar2,
v_state in varchar2) is l_student_id varchar2;
begin
l_student_id := par_surname(v_surname) ||'-'||
par_name(v_name) ||'-'||
par_date_birht(v_date_birth) ||'-'||
par_gender(v_gender) ||'-'||
par_state(v_state);
dbms_output.put_line('Student ID : ' || l_student_id);
end student_id;
在我写入值后我的预期输出应该是什么:
(学号:JOHN-SMITH-170692-M-CALIFORNIA)
我得到的错误:
Error with beginning of line: 291 in the command -
procedure cod_fiscale ( v_surname in varchar2,
Report error -
unknown command
Error with beginning of line : 292 in the command -
v_name in varchar2,
Report error -
unknown command
Error with beginning of line : 293 in the command -
v_date_birth in varchar2,
Report error -
unknown command
Error with beginning of line : 294 in the command -
v_gender in varchar2,
Report error -
unknown command
SP2-0044:to get the list of known commands, enter HELP
and enter EXIT to exit.
Error with beginning of line : 295 in the command -
v_state in varchar2) is l_student_id varchar2;
Report error -
unknown command
Error with beginning of line : 296 in the command -
begin
l_student_id := par_surname(v_surname) ||'-'||
par_name(v_name) ||'-'||
par_date_birht(v_date_birth) ||'-'||
par_gender(v_gender) ||'-'||
par_state(v_state);
dbms_output.put_line('Student ID : ' || l_student_id);
end student_id;
Report error -
ORA-06550: line 9, column 25:
PLS-00103: Found symbol ""
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
我粗略翻译了我得到的错误,因为它是另一种语言。
*注意:这不是一个独立的过程,这段代码与我之前的问题有关。
发现于:*
我这里的错误是什么?错误原因是什么?
没有看到你包裹的其余部分,我可以发现一个问题:
procedure student_id ( v_surname in varchar2,
v_name in varchar2,
v_date_birth in varchar2,
v_gender in varchar2,
v_state in varchar2) is
l_student_id varchar2; -- you need to declare the length of your variable
begin
...
您已经声明了变量的类型,但没有说明它需要多长时间。它应该是这样的:
l_student_id varchar2(400);
尽管您应该将 400 更改为正确的值,以获得将存储在该变量中的值的预期最大长度。
我有一个名为 student_id
的过程 procedure student_id ( v_surname in varchar2,
v_name in varchar2,
v_date_birth in varchar2,
v_gender in varchar2,
v_state in varchar2) is l_student_id varchar2;
begin
l_student_id := par_surname(v_surname) ||'-'||
par_name(v_name) ||'-'||
par_date_birht(v_date_birth) ||'-'||
par_gender(v_gender) ||'-'||
par_state(v_state);
dbms_output.put_line('Student ID : ' || l_student_id);
end student_id;
在我写入值后我的预期输出应该是什么:
(学号:JOHN-SMITH-170692-M-CALIFORNIA)
我得到的错误:
Error with beginning of line: 291 in the command -
procedure cod_fiscale ( v_surname in varchar2,
Report error -
unknown command
Error with beginning of line : 292 in the command -
v_name in varchar2,
Report error -
unknown command
Error with beginning of line : 293 in the command -
v_date_birth in varchar2,
Report error -
unknown command
Error with beginning of line : 294 in the command -
v_gender in varchar2,
Report error -
unknown command
SP2-0044:to get the list of known commands, enter HELP
and enter EXIT to exit.
Error with beginning of line : 295 in the command -
v_state in varchar2) is l_student_id varchar2;
Report error -
unknown command
Error with beginning of line : 296 in the command -
begin
l_student_id := par_surname(v_surname) ||'-'||
par_name(v_name) ||'-'||
par_date_birht(v_date_birth) ||'-'||
par_gender(v_gender) ||'-'||
par_state(v_state);
dbms_output.put_line('Student ID : ' || l_student_id);
end student_id;
Report error -
ORA-06550: line 9, column 25:
PLS-00103: Found symbol ""
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
我粗略翻译了我得到的错误,因为它是另一种语言。
*注意:这不是一个独立的过程,这段代码与我之前的问题有关。
发现于:
我这里的错误是什么?错误原因是什么?
没有看到你包裹的其余部分,我可以发现一个问题:
procedure student_id ( v_surname in varchar2,
v_name in varchar2,
v_date_birth in varchar2,
v_gender in varchar2,
v_state in varchar2) is
l_student_id varchar2; -- you need to declare the length of your variable
begin
...
您已经声明了变量的类型,但没有说明它需要多长时间。它应该是这样的:
l_student_id varchar2(400);
尽管您应该将 400 更改为正确的值,以获得将存储在该变量中的值的预期最大长度。