alexvaz Posted April 24, 2006 at 05:35 PM Report Share #24000 Posted April 24, 2006 at 05:35 PM Tenho que contruir uma função em oracle, penso k é em PL/SQL pra um trabalho da escola. Sei +/- como se faz, mas n estou a ver k tipos de funções podem ser uteis. Alguém me pode dar exemplos? Estou a tentar fazer um exemplo que devolve o username de um jogador com o maior saldo, mas dá-me erro de compilação. O código é o seguinte: create or replace function melhor_jogador () return char is ret char; begin select username into ret from Cliente where saldo = (select max(saldo) from Cliente); return (ret); end; Alguém me sabe dizer qual é o erro? Link to comment Share on other sites More sharing options...
ouvi_dizer Posted April 26, 2006 at 11:09 AM Report Share #24396 Posted April 26, 2006 at 11:09 AM PL/SQL já a muito que não mexo, mas penso que o teu erro seja na definição da variável. Ela não está dentro de bloco algum e devia estar, tenta coloca-la depois do begin Link to comment Share on other sites More sharing options...
Destineo Posted June 6, 2006 at 12:23 PM Report Share #31432 Posted June 6, 2006 at 12:23 PM Boas, O teu problema está em teres os () a seguir ao nome da função. Se não existem argumentos, não se colocam os () : create or replace function melhor_jogador return char is ret char; begin select username into ret from Cliente where saldo = (select max(saldo) from Cliente); return (ret); end; - Destineo Link to comment Share on other sites More sharing options...
M6 Posted June 6, 2006 at 12:32 PM Report Share #31433 Posted June 6, 2006 at 12:32 PM Boas, O teu problema está em teres os () a seguir ao nome da função. Se não existem argumentos, não se colocam os () : create or replace function melhor_jogador return char is ret char; begin select username into ret from Cliente where saldo = (select max(saldo) from Cliente); return (ret); end; Nem mais. 😁 Estás fixe? 10 REM Generation 48K! 20 INPUT "URL:", A$ 30 IF A$(1 TO 4) = "HTTP" THEN PRINT "400 Bad Request": GOTO 50 40 PRINT "404 Not Found" 50 PRINT "./M6 @ Portugal a Programar." Link to comment Share on other sites More sharing options...
pedrotuga Posted June 7, 2006 at 12:20 PM Report Share #31590 Posted June 7, 2006 at 12:20 PM iaux!!! anda aqui pessoal que ainda mexe em Pl/SQL!!! o fórum bomba eheheheh... plsql é mesmo daquelas coisas que n me puxa e que é bue de rápido esquecer... tirando os triggerzitos que dão bue de jeito é uma coisa que posso dizer que não percebo grande pistola, apesar de me ter sido ensinado. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now