Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create tablespace Farmacia DATAFILE 'C:\oraclexe\app\oracle\oradata\XE\Farmacia.DBF' SIZE 30M;
- create user norma
- identified by norma
- default tablespace Farmacia
- QUOTA 10M ON Farmacia;
- create user vendedor1
- identified by user1
- default tablespace Farmacia
- QUOTA 10M ON Farmacia;
- GRANT dba, connect, resource TO norma;
- GRANT connect, create session TO vendedor1;
- Grant select, insert TO norma;
- --una vez ya ya creada tablespace y losusuarios
- -- se hace uso de llos con la siguiente sentencia
- conn norma
- -- creacion de tablas una vez ya conectados con en usuario creado
- create table Detalle
- (
- id_Detalle NUMBER primary key,
- fk_Producto NUMBER,
- constraint fk_detalle_producto foreign key (fk_Producto) references Producto(id_Producto),
- fk_Venta NUMBER,
- constraint fk_detalle_venta foreign key(fk_venta) references venta(id_venta),
- Cantidad NUMBER
- );
- create SEQUENCE detalle_id_seq;
- create trigger trg_detalle_id
- before insert on Detalle
- for each row
- begin
- select detalle_id_seq.NEXTVAL
- into :new.id_Detalle
- from dual;
- end;
- /
- -
- -
- -
- -
- -
- -
- -- se puede desconectar con la siguiente sentencia
- discon
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement