您好我有一个oracle数据库,我正在尝试添加一个过程来根据输入选择驱动程序 但是我收到此错误消息
ORA-06502 numeric or value error
ORA-06512: at line 9
create or replace
PROCEDURE "SELECTDRIVE"
(LicenseNumber in number, FirstNamee out VARCHAR2, LastNamee out VARCHAR2, ContactNumberr out NUMBER)
as
begin
select d.firstname, d.lastname, d.contactnumber
into FirstNamee , LastNamee , ContactNumberr
from Driver d
where d.license = LicenseNumber;
end;
,这是从
中选择的表格LICENSE NUMBER(10,0)
FIRSTNAME VARCHAR2(15 BYTE)
LASTNAME VARCHAR2(15 BYTE)
PHOTO BLOB
CONTACTNUMBER NUMBER(11,0)
任何想法? 感谢
答案 0 :(得分:0)
哪一行第9行?
这段代码没有错,至少在我尝试时是这样:
SQL> create table driver (
2 LICENSE NUMBER(10,0),
3 FIRSTNAME VARCHAR2(15 BYTE),
4 LASTNAME VARCHAR2(15 BYTE),
5 PHOTO BLOB,
6 CONTACTNUMBER NUMBER(11,0));
Table created.
SQL> insert into driver (license, firstname, lastname, contactnumber)
2 values (1, 'Little', 'Foot', 1234);
1 row created.
SQL> create or replace PROCEDURE SELECTDRIVE
2 (LicenseNumber in number,
3 FirstNamee out VARCHAR2,
4 LastNamee out VARCHAR2,
5 ContactNumberr out NUMBER)
6 as
7 begin
8 select d.firstname, d.lastname, d.contactnumber
9 into FirstNamee , LastNamee , ContactNumberr
10 from Driver d
11 where d.license = LicenseNumber;
12 end;
13 /
Procedure created.
SQL> declare
2 l_fn driver.firstname%type;
3 l_ln driver.lastname%type;
4 l_cn driver.contactnumber%type;
5 begin
6 selectdrive(1, l_fn, l_ln, l_cn);
7 end;
8 /
PL/SQL procedure successfully completed.
SQL>
请复制/粘贴您的SQL * Plus会话,以便我们可以看到会发生什么。
答案 1 :(得分:0)
确保输入参数LicenseNumber
的值不超过(10,0)的精度。据我所知,当您调用该过程而不是在创建过程时,您会收到错误。
捕获数据库端传入参数的值。