--
-- 
--                                GBase.
-- 
--                            PROPRIETARY DATA
-- 
--  Licensed Material - Property Of GBase
-- 
--  "Restricted Materials of GBase"
-- 
--  GBase Client SDK
-- 
--  (c)  Copyright GBASE  2002. All rights reserved.
-- 
-- ***************************************************************************
-- 

     

DROP DATABASE dotnet_demodb;
CREATE DATABASE dotnet_demodb WITH LOG;
GRANT connect TO public;
	  GRANT dba TO public;
      DATABASE dotnet_demodb;
	  CREATE TABLE xa_tab1(a int);

CREATE TABLE customer (cust_num INTEGER PRIMARY KEY, 
      fname VARCHAR(10),
      lname VARCHAR(10),
      address1 VARCHAR(20),
      city VARCHAR(15),
      state  VARCHAR(5),
      zip VARCHAR(6));
      
CREATE TABLE item (item_num    INTEGER PRIMARY KEY,
      description VARCHAR(20),
      stock SMALLINT,
      ship_unit VARCHAR(10),
      unit_price  DECIMAL(5,2), 
      advert TEXT);

CREATE TABLE orders (order_num  INTEGER PRIMARY KEY,
      cust_num INTEGER,
      item_num INTEGER,
      order_date DATE,
      quantity INTEGER,
      FOREIGN KEY (cust_num) REFERENCES customer (cust_num),
      FOREIGN KEY (item_num) REFERENCES item (item_num));
     
CREATE PROCEDURE is_null(x VARCHAR(32)) RETURNING BOOLEAN;
		IF x IS NULL THEN RETURN 't'; ELSE RETURN 'f'; END IF;
	  END PROCEDURE;
