Advertisement
Guest User

Untitled

a guest
Dec 10th, 2016
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. create tablespace Farmacia DATAFILE 'C:\oraclexe\app\oracle\oradata\XE\Farmacia.DBF' SIZE 30M;
  2. create user norma
  3. identified by norma
  4. default tablespace Farmacia
  5. QUOTA 10M ON Farmacia;
  6. create user vendedor1
  7. identified by user1
  8. default tablespace Farmacia
  9. QUOTA 10M ON Farmacia;
  10. GRANT dba, connect, resource TO norma;
  11. GRANT connect, create session TO vendedor1;
  12. Grant select, insert TO norma;
  13.  
  14. --una vez ya ya creada tablespace y losusuarios
  15. -- se hace uso de llos con la siguiente sentencia
  16. conn norma
  17. -- creacion de tablas una vez ya conectados con en usuario creado
  18. create table Detalle
  19. (
  20. id_Detalle NUMBER primary key,
  21. fk_Producto NUMBER,
  22. constraint fk_detalle_producto foreign key (fk_Producto) references Producto(id_Producto),
  23. fk_Venta NUMBER,
  24. constraint fk_detalle_venta foreign key(fk_venta) references venta(id_venta),
  25. Cantidad NUMBER
  26. );
  27. create SEQUENCE detalle_id_seq;
  28. create trigger trg_detalle_id
  29. before insert on Detalle
  30. for each row
  31. begin
  32. select detalle_id_seq.NEXTVAL
  33. into :new.id_Detalle
  34. from dual;
  35. end;
  36. /
  37. -
  38. -
  39. -
  40. -
  41. -
  42. -
  43. -- se puede desconectar con la siguiente sentencia
  44. discon
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement