DEV Community

eknh
eknh

Posted on

Hi Dev

CREATE OR REPLACE FUNCTION get_student_rec (p_student_id IN NUMBER)
RETURN STUDENT%ROWTYPE
AUTHID CURRENT_USER
RESULT_CACHE RELIES_ON (student)
IS
v_student_rec STUDENT%ROWTYPE;
BEGIN
SELECT *
INTO v_student_rec
FROM student
WHERE student_id = p_student_id;
RETURN v_student_rec;
EXCEPTION
WHEN no_data_found
THEN
RETURN NULL;
END get_student_rec;
/
— Execute newly created function
DECLARE
v_student_rec STUDENT%ROWTYPE;
BEGIN
v_student_rec := get_student_rec (p_student_id => 230);
END;
I welcome you all with this PLSQL code sample.

Top comments (1)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay