title: Constraint on a character varying using numbers
body: <p>I've got this code (just an excerpt)...</p>
  
  <pre><code>CREATE TABLE "Degree"
  (
    ippp_code character varying(5) CONSTRAINT four_or_five_chars_only CHECK (ippp_code &gt;= 4 OR ippp_code &lt;= 5) NOT NULL
  )
  </code></pre>
  
  <p>What i'm try do is make the ippp_code a maximum of 5 characters or a mininum of 4 characters. So you can only enter 4 or 5 characters.</p>
  
  <p>When I run the code I get an error message saying...</p>
  
  <blockquote>
    <p>ERROR:  operator does not exist: character varying >= integer HINT: 
    No operator matches the given name and argument type(s). You might
    need to add explicit type casts.</p>
    
    <p><em><strong></em>***<em></strong> Error <strong></em>**<em>*</em></strong></p>
    
    <p>ERROR: operator does not exist: character varying >= integer SQL
    state: 42883 Hint: No operator matches the given name and argument
    type(s). You might need to add explicit type casts.</p>
  </blockquote>
  
  <p>I wondering can I use the constraint I set using character varying? Also can I get a correction on the code?</p>