2
I am studying Database, using Oracle 11g and making the tables in SQLPLUS. I create the table:
CREATE TABLE COMPRAS (ID NUMBER PRIMARY KEY, VALOR NUMBER, DATA DATE,
OBSERVACOES VARCHAR2(30), RECEBIDO CHAR CHECK (RECEBIDO IN (0,1)));
And right after, I create a sequence:
CREATE SEQUENCE ID_SEQ;
With this, I will enter the data with this command:
INSERT INTO COMPRAS (ID, VALOR, DATA, OBSERVACOES, RECEBIDO) VALUES
(ID_SEQ.NEXTVAL, 100, ’12-MAY-2007’, ‘Compras de Maio’, ‘1’);
And to see the data inserted in the table, I rotate:
SELECT * FROM COMPRAS;
There were probably two errors before you hit the INSERT command. Even when an error occurs the sequence is updated and so there may be holes.
– anonimo
Hello @Vagner, do not change your question to indicate that you have managed to find a solution, I am happy to know that you want to help others with the same problem, in which case the best option is to answer your own question, but later the system will release you to accept your own answer. Tip: how you found the solution in the documentation is worth you adding the documentation link in your reply. = D --- I will reverse your edit, you can see it here
– Icaro Martins