title: Creating Table with CC Exp Date - Oracle PL SQL
body: <p>I'm trying to create a table with date constraint that will make the date value of MM/YY for credit card expiration date. When I try to create the below table I receive the error:</p>
  
  <pre><code>  CONSTRAINT exp_check CHECK TO_CHAR(exp_date,'MM/YY'),
                         *
    ERROR at line 19: 
    ORA-00906: missing left parenthesis 
  
  
   Create table Orders    
   (o_id int NOT NULL,
   c_id int NOT NULL,
   p_id int NOT NULL,
   s_id int NOT NULL,
   order_date date DEFAULT sysdate,
   o_qty number NOT NULL,
   order_total number NOT NULL,
   card_type varchar2(50) NOT NULL,
   cc_number varchar2(50) NOT NULL,
   exp_date date NOT NULL,
   shipping_date date,
   shipping_status varchar2(50) DEFAULT 'Not Shipped Yet',
    UNIQUE (o_ID, c_ID, p_ID),
    CONSTRAINT order_ID PRIMARY KEY (O_ID),
   CONSTRAINT fk_cust_id FOREIGN KEY (C_ID) REFERENCES customers(C_ID),
   CONSTRAINT fk_ship_id FOREIGN KEY (S_ID) REFERENCES shipping(S_ID),
   CONSTRAINT qty_check CHECK (o_qty &gt;= 0),
   CONSTRAINT exp_check CHECK TO_CHAR(exp_date,'MM/YY'),
   CONSTRAINT s_check CHECK (shipping_status IN 
   ('Not shipped yet', 'Shipped', 'Delivered'))
   ); 
  </code></pre>
  
  <p>Once I'm able to create the table I will create a executed stored procedure that will execute the below:</p>
  
  <pre><code>  SET SERVEROUTPUT ON;
    DECLARE
    i_result varchar2(100);
  BEGIN
    place_order(2200,1,'Regular','VISA','1111-1111-2222-3333',11/19,1040,i_result);
   END;
  </code></pre>