Home » Developer & Programmer » Forms » how to set a format of characters (oracle 10g)
how to set a format of characters [message #585800] Thu, 30 May 2013 01:31 Go to next message
oraclehi
Messages: 41
Registered: July 2012
Location: India
Member
hello

i have to enter pan_no through my form into database, and pan_no format is like BWHPK2334M
as first 5 is alphabets then 4 letters and last one is alphabet, how to validate it in my form. can i do this by set fomat mask in property palette and if yes then how, oterwise the 2nd option may be is trigger when validate item, but with which format i should match the entered data.

thanks.
Re: how to set a format of characters [message #585804 is a reply to message #585800] Thu, 30 May 2013 02:21 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
What is the format exactly?
5 characters, 4 numbers then a character?
Re: how to set a format of characters [message #585806 is a reply to message #585804] Thu, 30 May 2013 02:30 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I'd try with regular expressions, such as
SQL> with test as
  2    (select 'BWHPK2334M' col from dual union
  3     select 'abc123'         from dual union
  4     select 'BWHPK23344'     from dual union
  5     select '12345abcd6'     from dual union
  6     select 'AABWHPK2334MXX' from dual
  7    )
  8  select col
  9  from test
 10  where regexp_like(col, '^[[:alpha:]]{5}[[:digit:]]{4}[[:alpha:]]{1}$');

COL
--------------
BWHPK2334M

SQL>
Re: how to set a format of characters [message #585917 is a reply to message #585806] Thu, 30 May 2013 23:53 Go to previous messageGo to next message
oraclehi
Messages: 41
Registered: July 2012
Location: India
Member
sorry i couldn't get u, as i dont hv to take it from database, i have to fill it in form and if it is not in desired format of 5 char,4 numbers and then 1 char then it must show an error. how to code it in when validate trigger.
Re: how to set a format of characters [message #585929 is a reply to message #585917] Fri, 31 May 2013 01:05 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
WHEN-VALIDATE-ITEM trigger:
if not regexp_like(:block.item, '^[[:alpha:]]{5}[[:digit:]]{4}[[:alpha:]]{1}$') then
   message('Invalid format');
   raise form_trigger_failure;
end if;
Re: how to set a format of characters [message #586090 is a reply to message #585929] Mon, 03 June 2013 06:56 Go to previous message
oraclehi
Messages: 41
Registered: July 2012
Location: India
Member
Thanks, it works...Smile
Previous Topic: Blank line getting generated on save button
Next Topic: How to save multiple records at once?
Goto Forum:
  


Current Time: Tue Apr 23 17:14:18 CDT 2024