Jump to content

Recommended Posts

Posted

Estou a criar a seguinte função em Oracle que me deveria deixar retornar o registo com o menor custo de um grupo de registos.

create or replace function menorcust(origemserv number, destinoserv number) return rotasinfo%rowtype
is
reg rotasinfo%rowtype;
BEGIN
select * into reg from rotas s,rotasinfo ri where s.origem=origemserv AND s.destino=destinoserv and s.IDRota = ri.IDRota and ri.custo = (select min(custo) from rotasinfo t, rotas s where s.origem=origemserv AND s.destino=destinoserv and t.IDRota = s.IDRota);
RETURN reg;
END menorcust;

Ao tentar compilar dá-me o seguinte erro:

Compilation failed,line 5 (19:05:40)
PL/SQL: ORA-00947: não há valores suficientes
Compilation failed,line 5 (19:05:40)
PL/SQL: SQL Statement ignored

cumps

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.