Personal the question is this:
Develop 4 screens of cadastros
, Usuários
, Cidades
, UF
and Produtos
. For each screen you should have the procedures of insert
, updade
and delete
. You should also have the validation triggers and key generation functions
of each table.
I've already done the tables:
CREATE TABLE TBUSUARIO
(
CODIGO NUMBER
, NOME VARCHAR2(50)
, SENHA VARCHAR(6)
, SITUACAO VARCHAR(1)
, PRIMARY KEY (COD_USER)
);
CREATE TABLE TBCIDADES
(
CODIGO NUMBER
, NOME VARCHAR2(30)
, UF VARCHAR2(2)
, COD_IBGE NUMBER
, PRIMARY KEY (COD_CID)
);
CREATE TABLE TBUF
(
COD_UF NUMBER
, NOME VARCHAR2(30)
, SIGLA VARCHAR2(2)
, PRIMARY KEY (COD_UF)
);
CREATE TABLE TBPRODUTOS
(
COD_PROD NUMBER
, NOME VARCHAR2(30)
, QTDE NUMBER
, PRECO (14,2)
, PRIMARY KEY (COD_PROD)
);
The procedure I did was as follows:
CREATE OR REPLACE PROCEDURE PCNOVOLOGIN
(
NNOME IN VARCHAR
, NSENHA IN VARCHAR
) IS
BEGIN
INSERT INTO TBUSUARIO(NOME, SENHA) VALUES(NNOME, NSENHA);
IF NNOME IS NOT NULL AND NSENHA IS NOT NULL
ALTER TABLE TBUSUARIO ADD SITUACAO = 'A' END IF;
END PCNOVOLOGIN;
Am I on the right track?
How do I do the procedure of update
and delete
? (putting the USUARIO
table in question).
One more, how do I function
to generate sequential table code?
I'm very inexperienced in sql , I need help from you ! grateful.