Can you find a bug? Do not display the result [closed]









up vote
-1
down vote

favorite












It is my function and i don't understand why it is not work?



 CREATE FUNCTION MYFUNCTION1(GENRES IN VARCHAR2)
RETURN NUMBER IS
TOTAL NUMBER;
BEGIN
SELECT COUNT(*) INTO TOTAL FROM ARTISTS WHERE genre=GENRES;
RETURN TOTAL;
END;


DECLARE
TOTAL NUMBER:=0;
BEGIN
TOTAL:=MYFUNCTION1('POP');
DBMS_OUTPUT.PUT_LINE('SUM:' || TOTAL);
END;


enter image description here










share|improve this question















closed as off-topic by Ken White, rsjaffe, Kaushik Nayak, William Robertson, Jeffrey Kemp Nov 12 at 5:20


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Ken White, rsjaffe, Kaushik Nayak, William Robertson, Jeffrey Kemp
If this question can be reworded to fit the rules in the help center, please edit the question.








  • 4




    What exactly is "not working"? Do you get an error? If yes, what is the error?
    – a_horse_with_no_name
    Nov 10 at 15:23






  • 1




    An obvious syntax error is the missing forward slash on a line by itself after the END; line in the function definition. Then you must compile the function first, by itself, since you are calling it in a separate PL/SQL block.
    – mathguy
    Nov 10 at 15:30










  • Did you set serveroutput on?
    – Littlefoot
    Nov 10 at 15:44










  • By the way, you should give some thought to programming style. And your caps lock is on.
    – William Robertson
    Nov 11 at 10:39














up vote
-1
down vote

favorite












It is my function and i don't understand why it is not work?



 CREATE FUNCTION MYFUNCTION1(GENRES IN VARCHAR2)
RETURN NUMBER IS
TOTAL NUMBER;
BEGIN
SELECT COUNT(*) INTO TOTAL FROM ARTISTS WHERE genre=GENRES;
RETURN TOTAL;
END;


DECLARE
TOTAL NUMBER:=0;
BEGIN
TOTAL:=MYFUNCTION1('POP');
DBMS_OUTPUT.PUT_LINE('SUM:' || TOTAL);
END;


enter image description here










share|improve this question















closed as off-topic by Ken White, rsjaffe, Kaushik Nayak, William Robertson, Jeffrey Kemp Nov 12 at 5:20


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Ken White, rsjaffe, Kaushik Nayak, William Robertson, Jeffrey Kemp
If this question can be reworded to fit the rules in the help center, please edit the question.








  • 4




    What exactly is "not working"? Do you get an error? If yes, what is the error?
    – a_horse_with_no_name
    Nov 10 at 15:23






  • 1




    An obvious syntax error is the missing forward slash on a line by itself after the END; line in the function definition. Then you must compile the function first, by itself, since you are calling it in a separate PL/SQL block.
    – mathguy
    Nov 10 at 15:30










  • Did you set serveroutput on?
    – Littlefoot
    Nov 10 at 15:44










  • By the way, you should give some thought to programming style. And your caps lock is on.
    – William Robertson
    Nov 11 at 10:39












up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











It is my function and i don't understand why it is not work?



 CREATE FUNCTION MYFUNCTION1(GENRES IN VARCHAR2)
RETURN NUMBER IS
TOTAL NUMBER;
BEGIN
SELECT COUNT(*) INTO TOTAL FROM ARTISTS WHERE genre=GENRES;
RETURN TOTAL;
END;


DECLARE
TOTAL NUMBER:=0;
BEGIN
TOTAL:=MYFUNCTION1('POP');
DBMS_OUTPUT.PUT_LINE('SUM:' || TOTAL);
END;


enter image description here










share|improve this question















It is my function and i don't understand why it is not work?



 CREATE FUNCTION MYFUNCTION1(GENRES IN VARCHAR2)
RETURN NUMBER IS
TOTAL NUMBER;
BEGIN
SELECT COUNT(*) INTO TOTAL FROM ARTISTS WHERE genre=GENRES;
RETURN TOTAL;
END;


DECLARE
TOTAL NUMBER:=0;
BEGIN
TOTAL:=MYFUNCTION1('POP');
DBMS_OUTPUT.PUT_LINE('SUM:' || TOTAL);
END;


enter image description here







oracle plsql






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 10 at 15:28

























asked Nov 10 at 15:21









Ablaykhan Chazhabaev

11




11




closed as off-topic by Ken White, rsjaffe, Kaushik Nayak, William Robertson, Jeffrey Kemp Nov 12 at 5:20


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Ken White, rsjaffe, Kaushik Nayak, William Robertson, Jeffrey Kemp
If this question can be reworded to fit the rules in the help center, please edit the question.




closed as off-topic by Ken White, rsjaffe, Kaushik Nayak, William Robertson, Jeffrey Kemp Nov 12 at 5:20


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – Ken White, rsjaffe, Kaushik Nayak, William Robertson, Jeffrey Kemp
If this question can be reworded to fit the rules in the help center, please edit the question.







  • 4




    What exactly is "not working"? Do you get an error? If yes, what is the error?
    – a_horse_with_no_name
    Nov 10 at 15:23






  • 1




    An obvious syntax error is the missing forward slash on a line by itself after the END; line in the function definition. Then you must compile the function first, by itself, since you are calling it in a separate PL/SQL block.
    – mathguy
    Nov 10 at 15:30










  • Did you set serveroutput on?
    – Littlefoot
    Nov 10 at 15:44










  • By the way, you should give some thought to programming style. And your caps lock is on.
    – William Robertson
    Nov 11 at 10:39












  • 4




    What exactly is "not working"? Do you get an error? If yes, what is the error?
    – a_horse_with_no_name
    Nov 10 at 15:23






  • 1




    An obvious syntax error is the missing forward slash on a line by itself after the END; line in the function definition. Then you must compile the function first, by itself, since you are calling it in a separate PL/SQL block.
    – mathguy
    Nov 10 at 15:30










  • Did you set serveroutput on?
    – Littlefoot
    Nov 10 at 15:44










  • By the way, you should give some thought to programming style. And your caps lock is on.
    – William Robertson
    Nov 11 at 10:39







4




4




What exactly is "not working"? Do you get an error? If yes, what is the error?
– a_horse_with_no_name
Nov 10 at 15:23




What exactly is "not working"? Do you get an error? If yes, what is the error?
– a_horse_with_no_name
Nov 10 at 15:23




1




1




An obvious syntax error is the missing forward slash on a line by itself after the END; line in the function definition. Then you must compile the function first, by itself, since you are calling it in a separate PL/SQL block.
– mathguy
Nov 10 at 15:30




An obvious syntax error is the missing forward slash on a line by itself after the END; line in the function definition. Then you must compile the function first, by itself, since you are calling it in a separate PL/SQL block.
– mathguy
Nov 10 at 15:30












Did you set serveroutput on?
– Littlefoot
Nov 10 at 15:44




Did you set serveroutput on?
– Littlefoot
Nov 10 at 15:44












By the way, you should give some thought to programming style. And your caps lock is on.
– William Robertson
Nov 11 at 10:39




By the way, you should give some thought to programming style. And your caps lock is on.
– William Robertson
Nov 11 at 10:39

















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3

Museum of Modern and Contemporary Art of Trento and Rovereto