Home » Developer & Programmer » Forms » urgently help required
urgently help required [message #83819] Mon, 15 December 2003 11:01 Go to next message
Messages: 76
Registered: April 1999
I have a primary key column in the database and the requirement is to add values values like MS01,MS02,MS03.....

how do i do this by click of a button called ADD on the form.

i do not have a sequence for this in the backend


Re: urgently help required [message #83821 is a reply to message #83819] Mon, 15 December 2003 13:06 Go to previous messageGo to next message
Messages: 25
Registered: August 2002
Junior Member
hi vinod ,
I think you requirement is to trap the numbers at the last and increment it by 1.Okay if it is so then you can use SUBSTR to remove the first two character MS and with the number left with you can add 1 to it and later concat with the removed character MS.I think this what you are expecting.


Re: urgently help required [message #83859 is a reply to message #83821] Mon, 22 December 2003 01:38 Go to previous message
Messages: 129
Registered: September 2002
Senior Member
This practice is not very commonly used.Especially if your field is primary key.Coz char data take more query time then numeric data.Anyways this is how you can do it.Create a sequence then
seqval number ;
select test.nextval into seqval from dual ;
if length(seqval) > 1 then
:block.item:= 'MS'||seqval ;
:block.item := 'MS0'||seqval ;
end if ;

end ;
Try to put this code in Pre-Insert.So that your sequence is generated when the user really wants to insert record.
Previous Topic: urgent help required
Next Topic: Form status
Goto Forum:

Current Time: Wed May 22 04:59:15 CDT 2024