Search Postgresql Archives

Selecting all records which are in upper case

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello

I have a simple table 'location' :
id -> Int (associated with a sequence)
name -> Character varying (100)

I have to delete all records where values in name field are all in upper case. For example, if the test data is as follows:

id    name
1    abccvvvv
2    Abc dsase
3    CDF FDER
4    Amcddd FFR
5    EE DFEW
6    Sedcd

Only reecords #3 and #5 are to be deleted. The closest I could reach was this:
"delete from location where (ascii(substring(name from 1 for 1)) between 65 and 90) and (ascii(substring(name from char_length(name) for 1)) between 65 and 90)"
The problem with this query is it would also delete record #4.

How do I get it to select only those records in which all characters are in uppercase?


Amitabh

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux