0
I can insert with this query in ORACLE
INSERT INTO CONF_CODE (ID, OPTION_NAME, ISCHECKED) VALUES (SEQ_CONF_CODE.NEXTVAL, 'Producao', 0);
But I need to fill this table CONF_CODE
with a SELECT
from another table like this:
INSERT INTO CONF_CODE (OPTION_NAME, ISCHECKED)
SELECT DISPLAY_NAME, 0 FROM CONF_LABEL_LOCAL
WHERE "TYPE" = 2 ORDER BY ID;
I don’t include the ID
in the first line even being a field not-null
because I don’t know how to insert a NEXTVAL SEQUENCE with the SELECT
down below.
I am using Dbeaver because my 'PL/SQL Developer' has expired
It gave an error in SEQUENCE: SQL Error [2287] [42000]: ORA-02287: sequence number not allowed here. I only have the properties of seq value:1, increment: 1 val_min: 0 val_max: 99999999. have pq idea?
– Luke Negreiros
I am reading the documentation where SEQUENCE cannot be used in sub-query
– Luke Negreiros
of course you can, look at this example I’ve put together now: http://sqlfiddle.com/#! 4/c5fe63/1 must be doing something wrong in the query or using a wrong query
– Ricardo Pontual
yes. it worked. It was SEQUENCE, I remade it (silly thing!)
– Luke Negreiros