too many declarations of '+' match this call ,, help me [message #198936] |
Thu, 19 October 2006 04:10 |
qewani
Messages: 51 Registered: December 2005 Location: uaq
|
Member |
|
|
i have put a pre insert trigger on my block level to take max value of id and increase + 1 to it to generate a new id
here is my code
declare
max_SYSid PT_EMP_DOCUMENT_HEAD.EDH_SYS_ID%TYPE;
begin
select max(EDH_SYS_ID) into max_SYSid from PT_EMP_DOCUMENT_HEAD;
max_SYSid := max_SYSid + 1;
message ('The New SYS id is :'||to_char(max_SYSid ));
:PT_EMP_DOCUMENT_HEAD.EDH_SYS_ID := max_SYSid ;
end;
declare
max_docno PT_EMP_DOCUMENT_HEAD.EDH_DOC_NO%TYPE;
begin
select max(EDH_DOC_NO) into max_docno from PT_EMP_DOCUMENT_HEAD;
max_docno := max_docno + 1;
message ('The New Doc. NO is :'||to_char(max_docno));
:PT_EMP_DOCUMENT_HEAD.EDH_DOC_NO := max_docno ;
end;
but while complie it it give me an error which says
too many declarations of '+' match this call,
too many declarations of 'to_char' match this call,
, can any one help me ?
[Updated on: Thu, 19 October 2006 04:14] Report message to a moderator
|
|
|
Re: too many declarations of '+' match this call ,, help me [message #199013 is a reply to message #198936] |
Thu, 19 October 2006 11:35 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
It seems that MAX_DOCNO already IS of a character datatype (actually, as you've declared it as PT_EMP_DOCUMENT_HEAD.EDH_DOC_NO%TYPE, EDH_DOC_NO must be a character.
If so, in order to add 1 (a number) to the last MAX_DOCNO value, you'll have to code it a little bit:
max_docno := TO_CHAR(TO_NUMBER(max_docno) + 1);
message ('The New Doc. NO is :'|| max_docno);
Finally, if this (what I've figured out) is true, could you consider storing NUMBER values into NUMBER datatype columns (instead of putting them into CHARACTER ones)?
|
|
|