Return text in plpgsql?

0

I am doing an exercise for class in which they ask me the following:

  

Create a function that returns a text with a list of the notes of a   student indicated by parameter. The input parameter is mandatory.   You have to return null if the parameter is null. It should not be used   courses, but use FOR ... IN SELECT

     

There is Generate the exception 'internal_error' if the student does not exist,   capture this exception and display a notification (NOTICE) indicating   Student's message not found '

     

You have to return a different text if the student does not have any   note. You also have to use the necessary escape characters   to format the list (line breaks, tabs, etc ...)

Examples:

 escuela => SELECT notes_alumne (1);
           notes_alumne
 ----------------------------------   
 Las notas del alumno Alex son:   
 M10 09:50   
 M07 08:50




 escuela => SELECT notes_alumne (3);
           notes_alumne
 ------------------------------   
 El alumno Anna no tiene ninguna nota

The problem that I have, is that I do not know how to make a function return text, and much less, organized text in the form of a list, everything else I have already done, I only need this, to be able to capture the text, Someone can give me a cable? Thanks in advance!

    
asked by THR4SH3RP0L0 29.03.2017 в 16:49
source

0 answers