Home » SQL & PL/SQL » SQL & PL/SQL » checking contents of a variable
checking contents of a variable [message #37782] Thu, 28 February 2002 01:46 Go to next message
MarcoC
Messages: 10
Registered: February 2002
Junior Member
hi all,

I need to check if a variable holds only values contained in a string. i.e. '.ABCDEFGHILMNOPQRSTUVZ'.
What would it be the best way to achieve this?
Is there any built-in SQL function returning a boolean?
Thanks Marco
Re: checking contents of a variable [message #37787 is a reply to message #37782] Thu, 28 February 2002 03:30 Go to previous messageGo to next message
pratap kumar tripathy
Messages: 660
Registered: January 2002
Senior Member
use translate function

translate(column_name,'.ABCDEFGHILMNOPQRSTUVZ',' ')

and test if it returns null or not null
Re: checking contents of a variable [message #37799 is a reply to message #37782] Thu, 28 February 2002 07:26 Go to previous messageGo to next message
MarcoC
Messages: 10
Registered: February 2002
Junior Member
Hi,

select nvl(translate(:v_user_subpgm,'._ABCDEFGHILMNOPQRSTUVZ1234567890',' '),'NULL')
from dual

why I get result equal to ' ' when I set v_user_subpgm to 'SCAN_SUBPGM' but I get 'NULL' when I set it to 'FORMAZIONE.SCAN_SUBPGM'? Thanks,
Marco
Re: checking contents of a variable [message #37824 is a reply to message #37799] Fri, 01 March 2002 00:09 Go to previous message
pratap kumar tripathy
Messages: 660
Registered: January 2002
Senior Member
use ltrim and rtrim as u r translating to blank space
Previous Topic: one column into multiple rows
Next Topic: cursor
Goto Forum:
  


Current Time: Fri Apr 26 00:32:23 CDT 2024