Home » SQL & PL/SQL » SQL & PL/SQL » Using Substr (Oracle Forms 10g)
Using Substr [message #395765] Thu, 02 April 2009 09:40 Go to next message
UaEe
Messages: 9
Registered: March 2009
Junior Member
Hi,

guys i want to create a program unit that check if the filed is contain number or not.

For example: Name filed >> so if the user has enter a number or any symbols an alert msg will appear for him to tell him that he/she can't enter a number or symbols in this filed.

any idea?

Re: Using Substr [message #395769 is a reply to message #395765] Thu, 02 April 2009 09:42 Go to previous messageGo to next message
BlackSwan
Messages: 25050
Registered: January 2009
Location: SoCal
Senior Member
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/toc.htm
URL above contains your answer.

You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
Re: Using Substr [message #395782 is a reply to message #395769] Thu, 02 April 2009 10:12 Go to previous messageGo to next message
UaEe
Messages: 9
Registered: March 2009
Junior Member
I checked the site but there is no any link for substr ... can u please tell me which link can i find it?
Re: Using Substr [message #395784 is a reply to message #395765] Thu, 02 April 2009 10:16 Go to previous messageGo to next message
BlackSwan
Messages: 25050
Registered: January 2009
Location: SoCal
Senior Member
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions162.htm#sthref2170

Your answer is just a few clicks beyond the URL below.
http://tahiti.oracle.com
Let us know when you have found your answer

Re: Using Substr [message #395919 is a reply to message #395784] Fri, 03 April 2009 01:47 Go to previous messageGo to next message
UaEe
Messages: 9
Registered: March 2009
Junior Member
oki about the substr I understand how it's work. but in my application the user can enter different names and each name has different length. so what i need is i want from the program unit to get the length for user input and check if it's letter or not. if it's number then the error msg appear.

because what i understood that you give the substr length. for example; substr(2,4) and that will take the second letter till the four. but my situation is the user can enter different name.

Sad
Re: Using Substr [message #395923 is a reply to message #395919] Fri, 03 April 2009 01:59 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Use translate to replace all non-allowed characters to a special character and then replace that character with an empty string.
Then compare the length of the original string with the length of the converted string.
To check is a string only contains numbers: do a to_number. If there is no exception thrown, it was a number.
Re: Using Substr [message #395924 is a reply to message #395919] Fri, 03 April 2009 02:02 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
You probably want to do validation like that in the application software, not in the database.

It is easy, with functions like INSTR, or REGEXP_INSTR, or TO_NUMBER to check whether a field contains a numerib character, or is a valid number, but pl/sql can only return an exception/message code - it cannot display any sort of alert box.
Interaction with the user like that is what the application software does.
Previous Topic: NLS for KHMER Cambodian lamguage
Next Topic: Problem in uploading file
Goto Forum:
  


Current Time: Sat Dec 10 16:50:43 CST 2016

Total time taken to generate the page: 0.12792 seconds