I have to make a procedure that will create me autonomously a STUDENT_ID with the input parameters as Name, Surname, Gender, Date_Birth, State.
Example :
Output:
STUDENT_ID is : JHN-STH-M-17596-CLFN
I put "-" to make it see better in the question but in the output it should be JHNSTHM17596CLFN
I have made 5 separate procedures that will calculate name, surname ecc.. I want to write a procedure that will calculate the STUDENT_ID using the procedures I made (in order) , and also have an "input" parameter and input/output "student" that will "print" the STUDENT_ID
procedure student_id (surname in varchar2,
name in varchar2,
gender in varchar2,
date_birth in varchar2,
state in varchar2) is
begin
....
dbms_output.put_line ('Student_ID is :');
This code is "supposed" to be the input parameter, I don't know if its written correctly
To me, it looks as if
STUDENT_ID
into functions
STUDENT_ID
valuesSomething like this:
function f_name (par_name in varchar2) return varchar2 is
retval varchar2(20);
begin
retval := whatever code you have to find it
return retval;
end;
function f_surname (par_surname in varchar2) return varchar2 is
retval varchar2(20);
begin
retval := whatever code you have to find it
return retval;
end;
etc.
procedure student_id (par_surname in varchar2, par_name in varchar2, ...)
is
l_student_id varchar2(30);
begin
l_student_id := f_name (par_name) ||'-'||
f_surname(par_surname) ||'-'||
f_gender (par_gender) ||'-'||
...
f_state (par_state);
dbms_output.put_line('Student_ID is: ' || l_student_id);
end;
Finally, as all those functions and procedure deal with the same problem, it would be nice to put them all into a package.