Home » Developer & Programmer » Forms » Auto Generated No with varchar2(2)
Auto Generated No with varchar2(2) [message #165917] Mon, 03 April 2006 05:42 Go to next message
kamran.it
Messages: 265
Registered: September 2005
Location: Karachi
Senior Member
Dear All

I created a form
there are 2 fields
1. srno number(4)
2. alpha varchar2(2)

srno is auto generated field.

I want to create record like :-

srno = 1 , alpha= A
srno = 1 , alpha= B
srno = 1 , alpha= C

when I whould like to change srno, change it..


there is any possibility.

Re: Auto Generated No with varchar2(2) [message #166074 is a reply to message #165917] Tue, 04 April 2006 06:45 Go to previous messageGo to next message
ahmad_uaf
Messages: 68
Registered: March 2006
Location: Pakistan
Member

plz. explain ur question.....
what u want to do??
what combination u r going to make for sr# + varhcar field.
Waiting......................
Re: Auto Generated No with varchar2(2) [message #166171 is a reply to message #165917] Wed, 05 April 2006 00:15 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Always populate these values in the When-Create-Record trigger. These look like detail records using a master with 'srno=1'. Increment the 'srno' in the master record in the When-Create-Record trigger then in the detail record for the 'srno' use the item property 'Copy Value From' to point back to the master record. To increment the alphabetic values you may have to use a 'select' statement as some PL/SQL functions don't work in an assignment statement (depending on the version of PL/SQL you are running).
select chr(ascii('a')+1)
  from dual;
returns 'b'.

David

[Updated on: Wed, 05 April 2006 00:15]

Report message to a moderator

Re: Auto Generated No with varchar2(2) [message #166237 is a reply to message #166171] Wed, 05 April 2006 06:21 Go to previous messageGo to next message
kamran.it
Messages: 265
Registered: September 2005
Location: Karachi
Senior Member
WE MAKE ORDER SHEET
WE HAVE TO ASSIGN UNIQUE NUMBER TO EACH ORDER
EXAMPLE:

A PARTY GAVE US 3 ORDERS WHICH CONSIST SAME PARTICULAR BUT DATE ARE DIFFERENT.
WE WANT TO ASSIGN NUMBER
ORDER NO = 1-A
ORDER NO = 1-B
ORDER NO = 1-C

1 IS AUTOGENERATED BUT A.
Re: Auto Generated No with varchar2(2) [message #166349 is a reply to message #166237] Wed, 05 April 2006 18:21 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Please ask your question again, I don't understand what extra information you require.

David
Re: Auto Generated No with varchar2(2) [message #166393 is a reply to message #166349] Thu, 06 April 2006 02:34 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
If I understand correctly, you want an alphanumeric sequence. Is this right?

MHE
Re: Auto Generated No with varchar2(2) [message #166432 is a reply to message #166393] Thu, 06 April 2006 05:12 Go to previous messageGo to next message
kamran.it
Messages: 265
Registered: September 2005
Location: Karachi
Senior Member
yes you can sey it is alphanumeric sequence

Example:

One Table Created.
create table pp_kd(
 Pono number(6),
 subpo varchar2(2),
 constraints pono_subpo_pk1 primary key(pono,subpo),

Here I want to empty feild subpp which is not possible in this condition.

Numeirc is Autogenerated No but Character we will enter

1. pono number(6)
2. s_pono varchar2(2)

One thing we can not define in primary key both fields because s_pono no some time empty.

I have entered data
PONO = 1 (Autogenerated)
S_Pono = A

here i created a button NEW and ADD
When I press NEW it shows new PONO (autogenerated)
When I press ADD it Shows same PONO but S_pono empty,

Again I am entering data and Press ADD button
When I enter S_pono = A
show error msg
because it will search Pono and S_pono already exist.

Upd-mod: You almost got the code tags right.

[Updated on: Thu, 06 April 2006 19:48] by Moderator

Report message to a moderator

Re: Auto Generated No with varchar2(2) [message #166538 is a reply to message #166432] Thu, 06 April 2006 20:20 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
How about you trap the error and present the user with an alert saying that "'A' has been used, lowest available value is 'B'"?

David
Previous Topic: how change form mod from insert to query such as cancel
Next Topic: how to sign a jar file
Goto Forum:
  


Current Time: Fri Sep 20 06:38:53 CDT 2024