nvs.schreib.at

Laborbericht - DBI - 5CHIF 16/17

Name: Juri Schreib
Datum: 2017-02-04
HW-Beschreibung:

products_schreib.plsql

create or replace procedure proc_products as
   v_tablecnt number;
begin
  select count(*)
    into v_tablecnt
    from all_tables
    where table_name = 'products' and owner = 'schreib_explain';

  if v_tablecnt = 0 then
    execute immediate
      'create table products(
        product_series integer,
        product_category integer,
        insurance_plan integer,
        name  varchar(255),
        activation_date date,
        warrenty_years integer,
        insurance_years integer,
        sold_date date,
        products_sold integer,
        product_price decimal(7,2),
        insurance_price decimal(7,2),
        activated number,
        repairs integer,
        repair_cost decimal(7,2),
        primary key(product_series, product_category, insurance_plan)
      )';
  end if;
end;

products_schreib.sql

call proc_products();
exit;

products_schreib.sh

#!/bin/bash
sqlplus schreib_explain/oracle @Desktop/products_schreib.plsql &
sqlplus schreib_explain/oracle @Desktop/producs_schreib.sql

Anhänge

Bilder