Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6956319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:51:14+00:00 2026-05-27T14:51:14+00:00

Am using Oracle 11g as my database and PL/SQL as the SQL language to

  • 0

Am using Oracle 11g as my database and PL/SQL as the SQL language to validate certain columns inside a table.

Requirement(s):

  1. Validate a “City Name” so that it only contains alpha characters and no numbers.

  2. Can contain a space for cities such as San Jose or San Francisco.

    function ValidateCity(city in varchar2) return varchar2 is
        valid varchar2(50) := 'valid';
    begin
        if not REGEXP_LIKE (city, '^[A-Z\s]*$') then
           valid := (case when valid = 'valid' then '' else valid end) 
                     || 'Does not match pattern ^[A-Z\s]*$ ';
        else
           valid := 'Required ';
        end if;
       return valid;
    end;
    

This works when I pass in a single city name like “Tucson” but not when there is a space, e.g. San Francisco or Los Angeles.

Any hints / suggestions / advice is welcome!

Thank you for taking the time for reading this…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:51:14+00:00Added an answer on May 27, 2026 at 2:51 pm

    normal* (special normal*)* again…

    ^[[:alpha:]]+([-[:space:]][[:alpha:]]+)*$

    Oracle regexes do not support \s, see here. [:alpha:] and [:space:] are POSIX character classes and always need to be in character classes. [-[:space:]] means “a dash, or a space character”. You may wish to replace [:space:] with a single space character instead.

    [edited to simplify: special here is really only either a dash or a space]

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found out that Oracle Database 10g and 11g treat the following PL/SQL block
Using .Net and Oracle 11g - I've been returning dataTables from a procedure inside
we have written a C# 3.5 client talking to an Oracle database (11g) using
first some data: we are using Oracle 11g databases. A primary database running on
I am using the external table approach with Oracle 11g to load data from
We have an Oracle 11g database table with around 35 million rows. We are
I am using oracle 11g. I write code to connect oracle database with java
I am developing an application using oracle 11g, Java(struts2) and Hibernate. I have table
Have some dates in my local Oracle 11g database that are in this format:
We've got an Oracle 11g installation that is starting to get big. This database

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.