I have to create a plsql function in oracle with return the value "True" if the record is found. If the record is not found then it will return "False".
I am new in plsql .Can any body help me by providing example for the above scenario ?
Thanks in Advance
Well, you don;t say anything about your table or the search criteria you have, so I will give a general example.
Code: Select all
CREATE OR REPLACE FUNCITON rec_check (p_id IN my_table.id%TYPE)
WHERE id = p_id;
WHEN NO_DATA_FOUND THEN
The function accepts a parameter indicating the ID of the row you are searching for. The query pulls back that row. If it finds it, it returns TRUE. If the row is not found a NO_DATA_FOUND exception is triggered, which is caught and returns FALSE.
If you want anything more specific, send the CREATE TABLE and INSERT statements to build a test case and be more specific about your requirements.
Oracle ACE Director
Oracle ACE of the Year 2006 - Oracle Magazine Editors Choice Awards
OCP DBA 7.3, 8, 8i, 9i, 10g, 11g
OCP Advanced PL/SQL Developer
Oracle Database: SQL Certified Expert
My website: https://oracle-base.com
My blog: https://oracle-base.com/blog
Who is online
Users browsing this forum: No registered users and 1 guest