1
I have a table "usuario" (idUsuario, nome, departamentoId)
and another table "departamento" (idDepartamento, nome)
.
I would like to enter random data in the user table, but for this, I need to consider only the Ids (Fks) of the departments that have already been entered.
I think it should be something like:
INSERT INTO usuario (idusuario, nome, departamentoId)
VALUES (seq_usuario.nextVal, 'nomealeatorio', FK_ALEATORIA_DEPARTAMENTO);
How do I generate this 'nominaleatorio' and take a department FK that already exists?
It worked! Thank you so much! Abs.
– mauriciourbano
Using the package dbms_random, you can generate random numbers and strings, useful if you need to generate different "names" for some test.
– Motta
http://www.oracle-base.com/articles/misc/dbms_random.php
– Motta