SQL> CREATE TABLE emp
2 (id VARCHAR2(10) NOT NULL,
3 course VARCHAR2(10),
4 year VARCHAR2(4),
5 PRIMARY KEY (id));
Table created.
SQL>
SQL>
SQL> CREATE OR REPLACE FUNCTION emp_Course(s_id emp.id%TYPE)
2 RETURN VARCHAR2 IS
3 v_course VARCHAR(10);
4 BEGIN
5 SELECT course INTO v_course
6 FROM emp
7 WHERE id = s_id;
8 RETURN v_course;
9 END emp_Course;
10 /
Function created.
SQL>
SQL> drop table emp;
Table dropped.
|