Home » RDBMS Server » Server Administration » Constraint
Constraint [message #374837] Thu, 05 July 2001 10:34 Go to next message
Cindy
Messages: 88
Registered: November 1999
Member
Hi,

Does anyone know how to add a constraint to a table that DOES NOT allow % symbol character to be inserted into a particular field of a table? I have tried this:
ALTER TABLE tablename
ADD CONSTRAINT "constraint_name" CHECK (field_name NOT LIKE '%\%%' ESCAPE '\')

But it seems like this constraint did not kick in, because it still allow me to insert this % symbol into that field_name of the table. Does anyone have any idea why or have alternative solution to is issue?

Thanks!
-- Cindy
Re: Constraint [message #374928 is a reply to message #374837] Thu, 12 July 2001 03:26 Go to previous message
murarishettysrinivas
Messages: 9
Registered: July 2001
Junior Member
yes...

try the following

create table friends
(id number(2) primary key,
name varchar2(20) check(instr(name,'%',1)=0));
Previous Topic: creat table by Dynamic SQL
Next Topic: It's not solved my problem :(
Goto Forum:
  


Current Time: Wed Jul 03 03:07:58 CDT 2024