下面是我的代码给出如下。我试图添加5个参数,该函数将这些参数放入Employee表中。但我没有成功,做了很多事情。Oracle中的存储函数无法将值插入所需的表
错误
ORA-01858: a non-numeric character was found where a numeric was expected ORA-06512: at "xxxxxxx.A1SF_ADDEMP", line 14 01858. 00000 - "a non-numeric character was found where a numeric was expected" *Cause: The input data to be converted using a date format model was incorrect. The input data did not contain a number where a number was required by the format model. *Action: Fix the input data or the date format model to make sure the elements match in number and type. Then retry the operation.
加上我怎么测试存储功能具有插入/更新或删除它的声明?
执行语句
Select A1SF_ADDEMP('Adesh', '33', 'M', 8000, '26/03/1990')
From dual;
代码
CREATE OR REPLACE Function A1SF_ADDEMP
(pEmpName In Varchar2,
pTaxFileNo In Varchar2,
pGender In Varchar2,
pSalary In Number,
pBirthdate In Varchar2
) Return Varchar2
Is
tEmpId Number(38,0);
tBirthDate Date;
BEGIN
tEmpId := A1Seq_Emp.nextval;
tBirthdate := to_date('pBirthdate','dd/mm/yyyy');
Insert Into Employee(EmpId, EmpName, TaxFileNo, Gender, Salary, Birthdate)
Values (tEmpId, pEmpName, pTaxFileNo, pGender, pSalary, tBirthdate);
Commit;
Return null;
END;
我将如何执行上述功能牢记DML语句是否必须使用游标或其他? – 2012-03-24 13:26:29
@ extinguisher33,正如我在我的回答中解释的那样,你必须将它包装在PL/SQL块中;但我会将它转化为一个程序。 – Ben 2012-03-24 13:27:40
程序事情我知道的原因我已经学习了SQL Server,但我非常感兴趣知道如何调用,在Sql开发人员上测试此函数,以及如何从Visual Studio调用它) – 2012-03-24 13:29:30